Created
February 8, 2020 01:03
-
-
Save agrif/61d6c63ac3df4406a7d141d27f294a18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stdint.h> | |
__sfr __at 0x00 ioLED; | |
__sfr __at 0x10 ioID0; | |
__sfr __at 0x11 ioID1; | |
__sfr __at 0x12 ioID2; | |
__sfr __at 0x13 ioID3; | |
__sfr __at 0x14 ioID4; | |
__sfr __at 0x15 ioID5; | |
__sfr __at 0x16 ioID6; | |
__sfr __at 0x17 ioID7; | |
__sfr __at 0x20 ioSerialData; | |
__sfr __at 0x21 ioSerialRValid; | |
__sfr __at 0x22 ioSerialRAvailL; | |
__sfr __at 0x23 ioSerialRAvailH; | |
__sfr __at 0x24 ioSerialEnable; | |
__sfr __at 0x25 ioSerialInterrupt; | |
__sfr __at 0x26 ioSerialWSpaceL; | |
__sfr __at 0x27 ioSerialWSpaceH; | |
volatile __at 0x8000 uint8_t memID[8]; | |
volatile __at 0x8008 uint8_t memLED0; | |
volatile __at 0x8009 uint8_t memLED1; | |
void sleep(uint8_t amt) { | |
while (amt > 0) { | |
uint16_t counter = 0xffff; | |
while (counter > 0) | |
counter--; | |
amt--; | |
} | |
} | |
void main() { | |
memID[0] = ioID0; | |
memID[1] = ioID1; | |
memID[2] = ioID2; | |
memID[3] = ioID3; | |
memID[4] = ioID4; | |
memID[5] = ioID5; | |
memID[6] = ioID6; | |
memID[7] = ioID7; | |
memLED0 = 0; | |
while (true) { | |
sleep(10); | |
//ioLED = memLED0; | |
//memLED0++; | |
//memLED1 = ioLED; | |
ioLED = ioSerialData; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment