Microcontroller › 8051 › NEED HELP with Data Acquisition System With LCD 16*2
- This topic has 2 replies, 2 voices, and was last updated 12 years, 9 months ago by Ahmed.
-
AuthorPosts
-
April 6, 2012 at 9:27 pm #4768AhmedParticipant
Hi every one
I have a problem with DAQ system and LCD. The problem is i receved the data from ADC0808 and put it in array but can’t display it on LCD!!!
I notes that port0 (P0) don’t get out the data so i used spisific data like string or number but the same problem accured???
i think there is something wrong with the program!
i used AT89C52 becuase of 8K EEPROM
I upload both Software and simulation (Proteus Version 7.6 SP0)
Any Help Or Suggestion
Thanks
This is the Program and simulation
http://www.4shared.com/rar/1g-IcdOC/ADCLCD.html
And This is the program here:-#include <REGX52.H>sbit start=P3^3;sbit end=P3^4;sbit oe=P3^5;sbit ale=P3^6;sbit clock=P3^2;unsigned char sensor=0,reading[7];//
LCD writing
sfr lcd_data_pin=0x80; // data port P0sbit rs=P1^3; // Register select pinsbit rw=P1^4; // Read write pinsbit en=P1^5; // Enable pinlong int b=0; //for math operationint j,num[4]; //num to carry 5 digitvoid delay(unsigned int msec){int k,l;for(k=0;k<msec;k++)for(l=0;l<1275;l++);}void initSerial(){TMOD=0x22;TH1=0xFD;//SCON=0x50;TR1=1;EA=1;}void usDelay(int a){TH0=256-(a/1.085);TR0=1;ET0=1;}void timerRoutine() interrupt 1{clock=~clock;}void latch(){ale=0;delay(2);ale=1;}void startConv(){delay(2);start=0;delay(2);start=1;}void wait(){while(end==1);}void get(){delay(2);oe=0;delay(2);oe=1;}//
LCD Display Function
void lcd_command(unsigned char comm) // function to send command to LCD{lcd_data_pin=comm;en=1;rs=0;rw=0;delay(1);en=0;}void lcd_ini() //Function to inisialize the LCD{lcd_command(0x38);delay(5);lcd_command(0x0F);delay(5);lcd_command(0x80);delay(5);}void lcd_data(unsigned char disp) // function to send data on LCD{lcd_data_pin=disp;en=1;rs=1;rw=0;delay(1);en=0;}lcd_dataa(unsigned char *predisp) // function to send string to LCD{int x;for(x=0;predisp[x]!=0;x++){lcd_data(predisp[x]);}}void lcd_data_int(unsigned int vote) //Function to send 0-9 character values (Divide number into 5 digits){char dig_ctrl_var;int p;for (j=4;j>=0;j–){num[j]=vote%10;vote=vote/10;}j=1;for (p=0;p<=4;p++){dig_ctrl_var = num[p]+48;lcd_data_pin = dig_ctrl_var;rw = 0;rs = 1;en = 1;delay(1);en = 0;if(j==1){lcd_data(0x2E);j=2;}}return;}void main(){int i;initSerial();usDelay(50);while(1){P=0;for(i=0;i<8;i++){if(sensor=={sensor=0;}P1=(P1&0xf8)+sensor;latch();startConv();wait();get();reading=P2;sensor++;}//
LCD man Program
lcd_ini();{lcd_dataa(“Eng Ahmed”);lcd_command(0xC5);b=(100)*196+(0x00);lcd_data_int(b);delay(200);b=0;lcd_command(0x01);}}}April 8, 2012 at 3:15 pm #7402Harsh PandyaParticipantwell , have you connected pull-up resistors on port 0 ? because port zero doesnot have an internal pull-up like other 3 ports
April 9, 2012 at 4:43 pm #7405AhmedParticipantHi Harsh Pandya
Your answer so right i put 10K pull up resistance and it’s worked good… Thanks Pro.
And another discussion in this link if any one need more information.
http://www.engineersgarage.com/forums/8051/pull-resistor
-
AuthorPosts
- You must be logged in to reply to this topic.