Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <targets/AT91SAM7.h>
- #include "PCF8833U8_lcd.h"
- void adcInit() {
- ADC_CR = 1 << 0;
- ADC_CHER = 1 << 6;
- ADC_IDR = 0xFFFFF;
- ADC_MR = (23 << ADC_MR_PRESCAL_BIT) |
- (2 << ADC_MR_STARTUP_BIT) |
- (1 << ADC_MR_SHTIM_BIT) |
- (1 << ADC_MR_LOWRES);
- ADC_CR_START;
- }
- int main() {
- adcInit();
- InitLCD();
- while(1)
- if(ADC_SR & ADC_SR_EOC6)
- if (ADC_CDR6 < 126) PIOB_CODR = 1 << 20;
- else PIOB_SODR = 1 << 20;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement