Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include <string.h>
- #include <targets\AT91SAM7.h>
- #include <stdbool.h>
- #include "pcf8833u8_lcd.h"
- void wait(int ms){
- volatile int i,j;
- for(i = 0; i < ms; i++){
- for(j = 0; j <= 3000; j++){
- __asm__("NOP");
- }
- }
- }
- int main(void){
- char z[4];
- int a;
- InitLCD(); // inicjalizacja ekranu
- SetContrast(5); // ustawienie kontrastu
- Backlight(BL_ON);
- LCDClearScreen(); // czyszczenie ekranu
- PMC_PCER = 1 << 17;
- ADC_CR = 1 << 0;
- ADC_CHER = 1 << 6;
- ADC_MR = (23 << ADC_MR_PRESCAL_BIT | 1 << ADC_MR_SHTIM_BIT | 2 << ADC_MR_STARTUP_BIT);
- ADC_CR = 1 << 1;
- while(1){
- while((ADC_SR & 1<<6) == 0){};
- ADC_CR = 1 << 1;
- a = ADC_CDR6;
- itoa(a,z,10);
- LCDPutStr(z,20,20,LARGE,WHITE,BLACK);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement