msmomar
Newbie level 3
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);
}
}
}
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);
}
}
}