ravindrareddy2131
Newbie level 4
hi everyone,
i had a problem with reading temperature values on 16*2 lcd. i am transmitting real temperature value through xbee and another xbee transceiver is receiving them successfully but i'm unable to display them on lcd. here is my program which is written in MPLAB. could anyone please help me..
#include<p18f4550.h>
#include<usart.h>
#include<delays.h>
#define ldata PORTD
#define rs PORTBbits.RB0
#define rw PORTBbits.RB1
#define en PORTBbits.RB2
#define led PORTDbits.RD1
#define buzzer PORTBbits.RB7
#pragma config FOSC=HS
#pragma config BOR=OFF
#pragma config PWRT=OFF
#pragma config WDT=OFF, DEBUG=OFF
#pragma config LVP=OFF
#pragma config MCLRE=ON
#pragma config PBADEN=OFF
#pragma config ICPRT=OFF
void lcdcmd (unsigned char);
void lcddata (unsigned char);
void MSDelay (unsigned int);
void main(void)
{
unsigned char C;
TRISB=0;
TRISC=1;
TRISD=0;
en=0;
MSDelay(250);
lcdcmd(0x38);
MSDelay(250);
lcdcmd(0x0E);
MSDelay(15);
lcdcmd(0x01);
MSDelay(15);
lcdcmd(0x06);
MSDelay(15);
lcdcmd(0x86);
MSDelay(15);
lcdcmd(0x01);
MSDelay(15);
lcddata('T');
MSDelay(15);
lcddata('E');
MSDelay(15);
lcddata('M');
MSDelay(15);
lcddata('P');
MSDelay(15);
lcddata(':');
RCSTA=0x90;
TXSTA=0x00;
SPBRG=31;
TRISCbits.TRISC7=1;
while(1)
{
while(PIR1bits.RCIF==0)
C=RCREG;
lcdcmd(0xC0);
MSDelay(15);
lcddata(C);
MSDelay(15);
lcddata(223);
MSDelay(15);
lcddata('C');
MSDelay(15);
}
}
void lcdcmd (unsigned char value)
{
ldata =value;
rs=0;
rw=0;
en=1;
MSDelay(1);
en=0;
}
void lcddata (unsigned char value)
{
ldata = value;
rs=1;
rw=0;
en=1;
MSDelay(1);
en=0;
}
void MSDelay (unsigned int itime)
{
unsigned int i;
unsigned int j;
for(i=0;i<itime;i++)
for(j=0;j<135;j++);
}
i had a problem with reading temperature values on 16*2 lcd. i am transmitting real temperature value through xbee and another xbee transceiver is receiving them successfully but i'm unable to display them on lcd. here is my program which is written in MPLAB. could anyone please help me..
#include<p18f4550.h>
#include<usart.h>
#include<delays.h>
#define ldata PORTD
#define rs PORTBbits.RB0
#define rw PORTBbits.RB1
#define en PORTBbits.RB2
#define led PORTDbits.RD1
#define buzzer PORTBbits.RB7
#pragma config FOSC=HS
#pragma config BOR=OFF
#pragma config PWRT=OFF
#pragma config WDT=OFF, DEBUG=OFF
#pragma config LVP=OFF
#pragma config MCLRE=ON
#pragma config PBADEN=OFF
#pragma config ICPRT=OFF
void lcdcmd (unsigned char);
void lcddata (unsigned char);
void MSDelay (unsigned int);
void main(void)
{
unsigned char C;
TRISB=0;
TRISC=1;
TRISD=0;
en=0;
MSDelay(250);
lcdcmd(0x38);
MSDelay(250);
lcdcmd(0x0E);
MSDelay(15);
lcdcmd(0x01);
MSDelay(15);
lcdcmd(0x06);
MSDelay(15);
lcdcmd(0x86);
MSDelay(15);
lcdcmd(0x01);
MSDelay(15);
lcddata('T');
MSDelay(15);
lcddata('E');
MSDelay(15);
lcddata('M');
MSDelay(15);
lcddata('P');
MSDelay(15);
lcddata(':');
RCSTA=0x90;
TXSTA=0x00;
SPBRG=31;
TRISCbits.TRISC7=1;
while(1)
{
while(PIR1bits.RCIF==0)
C=RCREG;
lcdcmd(0xC0);
MSDelay(15);
lcddata(C);
MSDelay(15);
lcddata(223);
MSDelay(15);
lcddata('C');
MSDelay(15);
}
}
void lcdcmd (unsigned char value)
{
ldata =value;
rs=0;
rw=0;
en=1;
MSDelay(1);
en=0;
}
void lcddata (unsigned char value)
{
ldata = value;
rs=1;
rw=0;
en=1;
MSDelay(1);
en=0;
}
void MSDelay (unsigned int itime)
{
unsigned int i;
unsigned int j;
for(i=0;i<itime;i++)
for(j=0;j<135;j++);
}