// Good: use smallest data type, static, const static const __code u8 sine_table[256] = /* ... */ ; // Good: reuse variables u8 temp __data; // fast
// Device-specific for AT89S52 #define F_CPU 11059200UL iar embedded workbench for 8051
#include "device.h" #include "uart.h" #define BAUDRATE_9600 0xFA // for 11.0592 MHz, timer1 auto-reload // Good: use smallest data type, static, const
void delay_ms(u16 ms) u16 i, j; for(i = 0; i < ms; i++) for(j = 0; j < 120; j++); // approx 1ms @ 11.0592 MHz // Good: use smallest data type