alsamadi
Newbie level 1
Dear all,
I am having tough time to interface the reading of pressure sensor mpx4115.
I am new to the software and i could not display Pressure= something kPA
i have tried to do some calculation and the interface of the program
but nothing appeared in the Glcd
I am having tough time to interface the reading of pressure sensor mpx4115.
I am new to the software and i could not display Pressure= something kPA
i have tried to do some calculation and the interface of the program
but nothing appeared in the Glcd
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 // Glcd module connections // glcd pinout settings char GLCD_DataPort at PORTD; sbit GLCD_CS1 at RB0_bit; sbit GLCD_CS2 at RB1_bit; sbit GLCD_RS at RB2_bit; sbit GLCD_RW at RB3_bit; sbit GLCD_EN at RB4_bit; sbit GLCD_RST at RB5_bit; sbit GLCD_CS1_Direction at TRISB0_bit; sbit GLCD_CS2_Direction at TRISB1_bit; sbit GLCD_RS_Direction at TRISB2_bit; sbit GLCD_RW_Direction at TRISB3_bit; sbit GLCD_EN_Direction at TRISB4_bit; sbit GLCD_RST_Direction at TRISB5_bit; // End Glcd module connections void main() { unsigned int adcvalue; unsigned int voltage; unsigned char p; char buffer; ////// TRISD = 0; TRISB = 0; while(1) { adcvalue=Adc_Read(0); voltage = 5000.0f/1024*adcvalue; p=0.1111111f*voltage/5+10.555f; ByteToStr(p,buffer); Glcd_Write_Text(buffer, 10, 2, 1); Delay_ms(500); } }
Last edited by a moderator: