Elixyra
Newbie level 5
Here are the details:
1)MCU : ATmega 128L
2)Gsm Module: Sim900 module from simcom
3)LCD module: JHD 204A
The code used is:
#include <avr/io.h>
#include <lcd.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "uart.h"
#include <util/delay.h>
#define UART_BAUD_RATE 9600 /* 9600 baud */
#define xtalCpu 7372800
unsigned char CtrlZ=0x1A;
int i;
int main(void)
{ int k=0;
char j=0;
char i=0;
uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
sei();
lcd_init(LCD_DISP_ON);
uart_puts("AT\r\n");
_delay_ms(3000);
//uart_puts("AT+IPR=9600\r\n");
//_delay_ms(200);
uart_puts("AT+CMGF=0\r\n");//Message format “AT+CMGF=[mode]1”
//[mode] integer type: 0 is PDU mode, 1 is text mode.
_delay_ms(200);
uart_puts("AT+CMGR=1\r\n");// Read Message
while(1)
{i=uart_getc();
//if (i=='+')
//{
//while (s<100)
if(i!=NULL)
{
//c=uart_getc();
lcd_putc(i);
_delay_ms(100);
//s++;
}
}
}
The problem is that I am getting garbage characters on the LCD.The Sim900 module is communicating with mcu using uart. onlt the rx and tx lines are connected. I've checked multiple websites for a similar problem. All seem to be using a similar code.I've used the following library:
**broken link removed**
Please suggest a solution to the display problem. Should i use a different library or are any AT commands available for data transfer from sim900 to Atmega 128L ??
1)MCU : ATmega 128L
2)Gsm Module: Sim900 module from simcom
3)LCD module: JHD 204A
The code used is:
#include <avr/io.h>
#include <lcd.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "uart.h"
#include <util/delay.h>
#define UART_BAUD_RATE 9600 /* 9600 baud */
#define xtalCpu 7372800
unsigned char CtrlZ=0x1A;
int i;
int main(void)
{ int k=0;
char j=0;
char i=0;
uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
sei();
lcd_init(LCD_DISP_ON);
uart_puts("AT\r\n");
_delay_ms(3000);
//uart_puts("AT+IPR=9600\r\n");
//_delay_ms(200);
uart_puts("AT+CMGF=0\r\n");//Message format “AT+CMGF=[mode]1”
//[mode] integer type: 0 is PDU mode, 1 is text mode.
_delay_ms(200);
uart_puts("AT+CMGR=1\r\n");// Read Message
while(1)
{i=uart_getc();
//if (i=='+')
//{
//while (s<100)
if(i!=NULL)
{
//c
lcd_putc(i);
_delay_ms(100);
//s++;
}
}
}
The problem is that I am getting garbage characters on the LCD.The Sim900 module is communicating with mcu using uart. onlt the rx and tx lines are connected. I've checked multiple websites for a similar problem. All seem to be using a similar code.I've used the following library:
**broken link removed**
Please suggest a solution to the display problem. Should i use a different library or are any AT commands available for data transfer from sim900 to Atmega 128L ??
Last edited: