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
Last edited: