Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

input i given through switch..o/p diisplay on lcd..

Status
Not open for further replies.

jaya krishna

Member level 1
Joined
May 10, 2012
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
India,coimbatore
Activity points
1,770
hi every one, i give input through switch if its high means display 1 on lcd if its low means display 0 on lcd.... i done the program it execute correctly....but in Proteus the lcd display show nothing....but i connect in led it work correctly...i think i do some mistake in my program pls any one can help me ....
PHP:
#if defined(__PCH__)
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#endif

#define  RS PIN_C0
#define  RW PIN_C1
#define  EN PIN_C2

void lcdcmd(unsigned char cmd);
void lcddata(unsigned char dat);

void main()
{

int x;

set_tris_b(0x00);
set_tris_a(0xff);

 lcdcmd(0x38);
 lcdcmd(0x0E);
 lcdcmd(0x01);
 lcdcmd(0x86);

while(1)
{

//x = input(PIN_A0);

x = input_a();
if(x==1)
{
//output_high(PIN_B0);
lcddata(0x01);
}
else
{
//output_low(PIN_B0);
lcddata(0x00);
}
}
}

void lcdcmd(unsigned char cmd)
{

 output_c(cmd);
 output_low(RS);
 output_low(RW);
 output_high(EN);
 delay_ms(1);
 output_low(EN);
}
void lcddata(unsigned char dat)
{

  output_c(dat);
  output_high(RS);
  output_low(RW);
  output_high(EN);
  delay_ms(1);
  output_low(EN);
}
 

Attachments

  • switch.JPG
    switch.JPG
    200.7 KB · Views: 31
Last edited:

You might want to try
Code:
lcddata('1');
instead of
Code:
lcddata(0x01);

and a similar type of thing for zero. (Guessing your LCD expects ASCII).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top