Hi,
Working on Gsm Project. I wanna comunicate to GSM800C with ATMEGA. But its not responding at all.
I made the F_CPU=16000000 and tried. again i changed the F_CPU=7372800 and again tried. but no success.In the pin configuration i connected mcu txd to gsm rxd and mcu rxd to gsm txd. pin configuration seems all correct. One more important thing i am using the port D(PD2,PD3,PD4) for my LCD command port. I have configured the D as such (DDRD =0b11111110).
==================================================================
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((( F_CPU / 16) + ( USART_BAUDRATE / 2)) / ( USART_BAUDRATE )) - 1)
void USART_Init(unsigned long BAUDRATE) /* USART initialize function where BAUDRATE=9600 */
{
UCSRB = (1 << RXEN) | (1 << TXEN); // Turn on the transmission and reception circuitry
UCSRC = (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes
UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
UBRRL = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
UCSRB |= (1 << RXCIE); // Enable the USART Receive Complete interrupt (USART_RXC)
sei(); // Enable the Global Interrupt Enable flag so that interrupts can be processed
}
=======================================================
I tried to send the following at command..
USART_SendString("AT\r"); /* send AT to check module is ready or not */
LCD_String_xy(1,0,"AT");
==========================================================
ISR(USART_RXC_vect)
{
buff[buffer_pointer] = UDR; /* copy UDR(received value) to buffer */
buffer_pointer++;
status_flag = 1; /* flag for new message arrival */
}
===========================================================
when I print "buff" on LCD, its print junk. not any output. I think something i missed to configure.
Working on Gsm Project. I wanna comunicate to GSM800C with ATMEGA. But its not responding at all.
I made the F_CPU=16000000 and tried. again i changed the F_CPU=7372800 and again tried. but no success.In the pin configuration i connected mcu txd to gsm rxd and mcu rxd to gsm txd. pin configuration seems all correct. One more important thing i am using the port D(PD2,PD3,PD4) for my LCD command port. I have configured the D as such (DDRD =0b11111110).
==================================================================
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((( F_CPU / 16) + ( USART_BAUDRATE / 2)) / ( USART_BAUDRATE )) - 1)
void USART_Init(unsigned long BAUDRATE) /* USART initialize function where BAUDRATE=9600 */
{
UCSRB = (1 << RXEN) | (1 << TXEN); // Turn on the transmission and reception circuitry
UCSRC = (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes
UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
UBRRL = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
UCSRB |= (1 << RXCIE); // Enable the USART Receive Complete interrupt (USART_RXC)
sei(); // Enable the Global Interrupt Enable flag so that interrupts can be processed
}
=======================================================
I tried to send the following at command..
USART_SendString("AT\r"); /* send AT to check module is ready or not */
LCD_String_xy(1,0,"AT");
==========================================================
ISR(USART_RXC_vect)
{
buff[buffer_pointer] = UDR; /* copy UDR(received value) to buffer */
buffer_pointer++;
status_flag = 1; /* flag for new message arrival */
}
===========================================================
when I print "buff" on LCD, its print junk. not any output. I think something i missed to configure.