Você está na página 1de 2

This program accepts analog input from the temperature signal conditioning block on the input channel AN0

and converts it to digital form which is passed to the LCD for display #include<P18F452.h> #include<stdio.h> void main(void) { unsigned char binaryNumber1; TRISAbits.TRISA0=0; ADCON0=0x01; ADCON1=0x1D; ADCON2=0x8E; //Analog Channel AN0,A/D enabled //AN0,AN1 analog inputs //2TAD, Fosc/64, right justified

while(1) { delay(1); //Give delay ADCON0bits.GO=1; //Start AD COnverter while(ADCON0bits.DONE==1); binaryNumber1=(int)ADRESL | ADRESH; //Convert 10bit to 8 bit void bit_out(binaryNumber1); o delay(4500); } delay(unsigned int itime) { unsigned inti,j; for(i=0;i<itime;i++) for(j=0;j<135;j++); } } // Call function to trasmit bit by bit t serial EEPROM via I2C bus //4.5 second delay //delay function

This program accepts analog input from the pressure signal conditioning block on the input channel AN1 and converts it to digital form which is passed to the LCD for display void main(void) { unsigned int binaryNumber2; TRISAbits.TRISA0=0; ADCON0=0x05; ADCON1=0x1D; ADCON2=8xE;

//Analog Channel AN1,A/D enabled //AN0,AN1 analog inputs //2TAD, Fosc/64, right justified

while(1) { delay(1); ADCON0bits.GO=1; while(ADCON0bits.DONE==1); binaryNumber2=(int)ADRESL | ADRESH; void bit_out(binaryNumber2); o

// Call function to trasmit bit by bit t

serial EEPROM via I2C bus delay(4500); } delay(unsigned int itime) { unsigned inti,j; for(i=0;i<itime;i++) for(j=0;j<135;j++); } }

Você também pode gostar