PIC18f452 with UART & LCD ,,,, need help urgently

Status
Not open for further replies.

msmomar

Newbie level 3
Joined
Sep 5, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,317
I have several proplem in both UART & LCd
first i connected the TX with the RX of the 18f452 .
the proplems are ,
1 -in UARt , if i send more than 3 characters more the statment (( Uart1_read_text(output, "at+fclass=8 ",255) ; ))
the compiler will not fint it & remain serching for the charcters .


2- in LCD ,
i can't print out the characters in the recived registers on the LCd . as



UART1_Write_text("at");
delay_ms(100);
UART1_Read_text(output,"AT",255);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1,output);
delay_ms(1000);

nothing will be on the lcd



the all code is



// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
unsigned char* uart_rd;
unsigned long* msg1 = "AT+FCLASS=8" ;
unsigned long* msg0 ="a";
unsigned long* output ;
char i =0;

void main(){
TRISB = 0;
TRISD= 0;
PORTB = 0xFF;
TRISB = 0xff;
Lcd_Init(); // Initialize LCD
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize

UART1_Write_text(msg1);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,msg1);
delay_ms(300);

while(1){
if(UART1_data_ready() == 1)
{
UART1_Read_text(output,"AT+FCLASS=8",255);
Lcd_Cmd(_LCD_CLEAR);
delay_ms(1000);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1,output);
delay_ms(1000);
}
}
}

 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…