About the limited resources on 8-bit MCU some points to note

Source: Internet
Author: User

8-bit mcu,51 kernel:

New Pond n76e003at20, more than STM8 with a little more port, more specific what can Baidu, here do not repeat.

Note 1: Reasonable allocation of local variables, generally in the 8-bit microcontroller running on the program logic is relatively simple, single cycle + interrupt.

According to N76 's characteristics, some large array local variables are allocated in Xram. Refer to the EEPROM demo.

Note 2: The 8-bit machine has limited computational power , and the finite and divisible operations can be used directly.

1 th0= (65536-50000)/; 2 tl0= (65536-50000)%; 3 // is equivalent to 4 th0= (65536-50000) >>8; 5 tl0= (65536-50000) &0x00ff;

This does not know that the compiler will not go to active optimization, write their own more at ease.

Note that point 3: 8-bit and 32-bit problems with some data length:

1serialprintf ("Char:%d \n\r",sizeof(Char));2serialprintf ("Short :%d \n\r",sizeof( Short));3serialprintf ("int:%d \n\r",sizeof(int));4serialprintf ("Long:%d \n\r",sizeof(Long));5serialprintf ("Long Long:%d \n\r",sizeof(Long Long));6 //8 Guests7 Char:18  Short:29 int:2Ten Long:4 One Long Long:4 A //32 Guests - Char:1 -  Short:2 the int:4 - Long:4 - Long Long:8

So, please use typedef signed Char int8; To define

Note 4: Use the TIMER0 interrupt 1, which is second only to INT0 in the interrupt priority, while the Ri/ti interrupt is 4.

About the limited resources on 8-bit MCU some points to note

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.