embRTS
Full Member level 4
- Joined
- Sep 8, 2013
- Messages
- 201
- Helped
- 36
- Reputation
- 72
- Reaction score
- 33
- Trophy points
- 28
- Location
- Bangalore
- Activity points
- 1,191
Hi I want to receive data data from Sim908 module which gives GPS Data when a particular AT command is sent to Sim908 via AVR or any other Microcontroller
Now I wish to use a variable
with Volatile
like
volatile unsigned char buffer[]=" ";
and I am also including ISR for USART
u8 i;
ISR(USART1_RXC_vect)
{
buffer = UDR1;
i++;
}
in the main function
I am sending that At command in an infinite loop at at delay of 10seconds
Now My question will the data changes as I had observed that the data is not changing
sample
main
{
send_sring_uart("AT+CGPSINF=0\r");
_delay_ms(500);
while(buffer!='\0')
{
buffer = UDR1;
i++
}
_delay_ms(1500);
and after this i am printing data
}
So my question is what variable type I use or Can you explain me the concept of Volatile variable
as i have thought that volatile variable changes automatically without accessing the register I mean I am confused on this as data which is receiving is in the UNIVERSAL DATA REGISTER ( UDR ) of a microcontroller
please help me out
Thanks in advance
Now I wish to use a variable
with Volatile
like
volatile unsigned char buffer[]=" ";
and I am also including ISR for USART
u8 i;
ISR(USART1_RXC_vect)
{
buffer = UDR1;
i++;
}
in the main function
I am sending that At command in an infinite loop at at delay of 10seconds
Now My question will the data changes as I had observed that the data is not changing
sample
main
{
send_sring_uart("AT+CGPSINF=0\r");
_delay_ms(500);
while(buffer!='\0')
{
buffer = UDR1;
i++
}
_delay_ms(1500);
and after this i am printing data
}
So my question is what variable type I use or Can you explain me the concept of Volatile variable
as i have thought that volatile variable changes automatically without accessing the register I mean I am confused on this as data which is receiving is in the UNIVERSAL DATA REGISTER ( UDR ) of a microcontroller
please help me out
Thanks in advance