Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Volatile variable uasge in USART receiving /or relation with UDR register in AVR

Status
Not open for further replies.

embRTS

Full Member level 4
Full Member level 4
Joined
Sep 8, 2013
Messages
201
Helped
36
Reputation
72
Reaction score
33
Trophy points
28
Location
Bangalore
Visit site
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
 

In my view couple of things
1) please specify the size of buffer that is intended to be used
2) if you are using multiple files use proper #include header file description
3) check that interrupt flag is cleared while receive operation.
4) check uart baud rate is matching with sim908.
5) make sure that use of time out in case u are not using character in case of character receive operation for break condition.
6) global deceleration of uart interrupts must be made with certain uart_init() function


With these modification code should work

Good luck
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top