|
发表于 2014-12-7 02:46:11
|
显示全部楼层
My code:
- dat=eeprom_read(2); //read eeprom
- while (dat==0x19) IO_FLP(LED_PORT, LED1); //if eeprom(2)=0x19, flip led1
- eeprom_write(2, 0x19); //otherwise, save 0x19 to eeprom(2)
- while (1) {
- IO_FLP(LED_PORT, LED0); //flip led0
- }
复制代码
Essentially, it flips LED1 (=GPIO1) if eeprom(2) = 0x19; Otherwise, it writes 0x19 to eeprom(2) and then flips LED0(=GPIO0).
The simulation:
1) the waveform on the top is for the first execution (eeprom uninitialized);
2) the waveform on the bottom is from the 2nd and thereafter executions (eeprom has been initialized).
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|