1, the pointer to the array of code area should also be added with the code keyword declaration.
For example, unsigned char code arr[30]; array, to point to it with a pointer, to declare the pointer as unsigned charcode * p;
Later, I found that many other places do not need to be declared as such, as long as unsigned char *p; just fine, but clearly remember that it is really necessary to add a code keyword declaration.
2. In 51, the bit variable seems to be finite.
If you want to use a Boolean type as the identification variable, you can use the bit type variable to save the control, but you have encountered a bit type variable error in the DRS1000 project. It is OK to change to the unsigned char type. At that time, the variable defined is already a lot. It may be that the storage area that can be addressed by the bit is used up.
3. When the INT interrupt is triggered by a mechanical switch:
Since the mechanical switch will vibrate, the resulting voltage will have burrs that will trigger an interrupt multiple times. There are two factors that can cause multiple triggers:
(1) Vibration when the switch is pressed. The first low level will enter the interrupt handler, and even if these vibrations are generated during the execution of the interrupt handler, even if the total interrupt is turned off after entering the interrupt handler, these glitch will still set the interrupt flag. The interrupt handler will be triggered again immediately after the end of the interrupt handler.
(2) Vibration when the switch is released. When the first high level comes, the interrupt handler will be exited, and the subsequent glitch will enter the interrupt handler again.
Solution:
At the end of the interrupt handler, add a low wait code, wait for the low end and then delay for 5ms (to eliminate the glitch interference when the switch is released), and then clear the interrupt flag after the 5ms delay (executed in the interrupt handler) The interrupt flag bit may have been triggered again during the process). code show as below:
Void int0() interrupt 0
{
/*Do something*/
While(rollRA==0);//waiting for low end
Delay5(1);//waiting the end of the glitch released by the button
IE0=0; //Clear the interrupt flag bit to prevent the interrupt from entering again.
}
4. For the 15 series MCU, the value of the AUXR register must be specified when using the serial port, otherwise the program will not run normally.
This situation has been encountered many times, as long as the 15 series MCU uses the serial port, the value of the well-known AUXR register must be known. Unlike the 12 series, this register can be ignored.
In the use of 15 series of microcontrollers, a habit was established: the first sentence of the main function makes AUXR=0; the serial port is initialized as needed.
E-Cigarette Atomizer type Disposable ecig have a completely enclosed design, reducing the need for charging and replacing cartridges. The no-charge design also reduces the occurrence of faults. It is understood that with rechargeable e-cigarettes, each cartridge needs to be charged at least once and the battery efficiency is extremely low, while the design of disposable ecig can solve this problem very well.
E-Cigarette Atomizer Disposable E-Cigarette,E-Cigarette Atomizer Mini E Cigarette,E-Cigarette Atomizer Electronic Cigarette Customizing,Rechargeable E Cigarette
Shenzhen E-wisdom Network Technology Co., Ltd. , https://www.healthy-cigarettes.com