Last active
October 20, 2018 15:12
-
-
Save Ryanhu1015/db9c5b1a9fa17e3254a4b8de9319d041 to your computer and use it in GitHub Desktop.
embedded rookie
This file contains 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
unsigned short ADCbuffer; | |
unsigned short wc_DelayTimeOutCounter; | |
//skip the functions prototypes | |
void main(){ | |
//initiate hardware | |
//.. | |
//.. | |
while(1){ | |
if(wc_DelayTimeOutCounter==100){ // grab the value per second | |
ADCbuffer = (ADB<<4) + (ADR&0x0F); | |
txsenddata(ADCbuffer); | |
ADM &= 0xDF;//clear EOC bit to 0 | |
ADM |= 0x40;//cause after conversion, ADS bit will automatically change into 0 | |
wc_DelayTimeOutCounter=0; | |
} | |
} | |
void Timer0_ISR(void) interrupt ISRTimer0 { | |
TH0=0x97;// 10 millis per cycle | |
TL0=0xD5; | |
wc_DelayTimeOutCounter++; | |
//skip the part below | |
//.. | |
//.. | |
} | |
void txsenddate(short da){ | |
//skip this part | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment