How to manipulate 16-bit INT data in an 8-bit microcontroller?

2021-01-06 18:40:30 fandoukeji

How to manipulate 16-bit INT data in an 8-bit microcontroller?




8-bit single-chip microcomputers do not have 16-bit operation instructions. The two are different. All INT data should be operated separately with two bytes. The usage method is different, and the generated code is different. Of course, the efficiency is also different. Obtain valid codes by pointing to 16-digit operations; before operations, effective program development is required.


For example, to receive data through the serial port, or read data from the serial memory, or read data from the A/D larger than 8 bits, because the data line of an 8-bit microcontroller is 8 bits, so data with more than 8 bits should be used two Bytes are read and then written to the memory for calculation, or 16-bit integer data will be read from the memory and stored in the EEPROM, or sent to D/A, or sent through the serial port; in many methods This operation can be implemented, but generally speaking, the reading conditions are very similar and cannot be repeated; some methods do not use Keil compiled code, and it is easier to generate more concise code, which is exactly the same as the code generated by the joint; The best way is that the code is concise and effective, but the syntax will be a bit complicated.


label: MCU