Bonjour tout le monde
J'ai besoin de votre aide, je veux programmer en mikroc un message tapé par mon clavier (en utilisant Virtual Terminal) et qu'il soit afficher sur LCD.
Voici mon schéma ISIS:
et voici le code :
Il affiche juste "hello" et "msg = " , mais lorsque je tape un msg en Virtual Temrinal rien ne se passe :/Code:// LCD pinout setting sbit LCD_RS at RE1_bit; sbit LCD_EN at RE2_bit; sbit LCD_D0 at RD0_bit; sbit LCD_D1 at RD1_bit; sbit LCD_D2 at RD2_bit; sbit LCD_D3 at RD3_bit; sbit LCD_D4 at RD4_bit; sbit LCD_D5 at RD5_bit; sbit LCD_D6 at RD6_bit; sbit LCD_D7 at RD7_bit; // Pin Direction; sbit LCD_RS_Direction at TRISE.B1; sbit LCD_EN_Direction at TRISE.B2; sbit LCD_D0_Direction at TRISD.B0; sbit LCD_D1_Direction at TRISD.B1; sbit LCD_D2_Direction at TRISD.B2; sbit LCD_D3_Direction at TRISD.B3; sbit LCD_D4_Direction at TRISD.B4; sbit LCD_D5_Direction at TRISD.B5; sbit LCD_D6_Direction at TRISD.B6; sbit LCD_D7_Direction at TRISD.B7; // End LCD module connections // Buffers should be in USB RAM, please consult datasheet unsigned char RD_buffer[64] absolute 0x500; unsigned char WR_buffer[64] absolute 0x540; /*// fonction de convertion en binaire char * Bin2Ascii(unsigned char untel) { unsigned char masque=0x80; int indice=0; unsigned char Binary[9]; while (masque > 0) { Binary[indice]='0'; if (untel & masque) Binary[indice]='1'; masque = masque >> 1; indice++; } Binary[8]=0; // string terminator return (Binary); }*/ char uart_rd; char msg; void main () { TRISC=0b00000000; // Configure PORTC pins as digital ADCON1=0b00001111; Lcd_Init(); Lcd_Out(1,1,"Start"); Delay_ms(100); Lcd_Cmd(_LCD_CLEAR); UART1_Init(9600); // Initialize UART module at 9600 bps Delay_ms(100); // Wait for UART module to stabilize UART1_Write_Text("Start"); UART1_Write(13); UART1_Write(10); while (1) { // Endless loop if (UART1_Data_Ready()) { // If data is received, uart_rd = UART1_Read(); // read the received data, UART1_Write(uart_rd); // and send data via UART msg = uart_rd ; } } Lcd_Out(1,1,"msg = ") ; Delay_ms(100); Lcd_Out(2,1,msg); Lcd_cmd(_Lcd_cursor_off) ; }
Merci d'avance.
-----