Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <targets/AT91SAM7.h>
- #include <stdlib.h>
- #include "PCF8833U8_lcd.h"
- void adcInit() {
- ADC_CR = 1 << 0;
- ADC_CHER = 1 << 5;
- ADC_IDR = 0xFFFFF;
- ADC_MR = (23 << ADC_MR_PRESCAL_BIT) |
- (2 << ADC_MR_STARTUP_BIT) |
- (1 << ADC_MR_SHTIM_BIT);
- ADC_CR_START;
- }
- int main() {
- adcInit();
- InitLCD();
- char buffer[10];
- while(1)
- if(ADC_SR & ADC_SR_EOC5) {
- int termVoltage = ADC_CDR5;
- itoa(termVoltage, buffer, 10);
- LCDPutStr(buffer, 20, 20, LARGE, WHITE, BLACK);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement