This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

porting C code from AVR to 8051

The code does alot of IO port operations.
Keil uses SFR and SBIT declarations whereas the AVR code uses defines to set IO port locations and
byte operations to set/clear/test bits. There has to be a better way than slogging through the text conversion and then slogging through the debug???

Parents
  • If minimizing code change is the priority, then you could continue to use #defines to reference the I/O port addresses, and byte operations to set bits. The 8051 provides byte-wide access to the I/O bits via the port SFR addresses (0x80, 0x90, etc). The bit operations are more efficient, but it's not the only way to set bits in a port.

Reply
  • If minimizing code change is the priority, then you could continue to use #defines to reference the I/O port addresses, and byte operations to set bits. The 8051 provides byte-wide access to the I/O bits via the port SFR addresses (0x80, 0x90, etc). The bit operations are more efficient, but it's not the only way to set bits in a port.

Children
No data