hi every one ...feel free to deletd this post if it is not logically !!!
i have 60 bytes data frame(generated inside atmega128), i have to send them as a frame every 10 ms vi uart with 115200 Baud and 11.095200 MHz external crystal
i did this mission by using timer1 compare interrupt (ctc) mode to enable volatile flag and in the main loop i checked that flag and according to its state i started sending the 60 byte using usual for loop.i will be able to fed up you with the code but if my implementation is not good then no matter that code is .
when i simulated with Proteus using hyper terminal the frames sent correctly until the 9th frame,in 9th frame only some bytes was sent (about 10 bytes of 60) and suddenly moved to start sending 10th frame
i am new in micro controller, i do not know if my implementation is the best method. there is another problem also that is the timer compare interrupt not exactly 10 ms it is 10.06 ms according to atmel studio7 watchdog, note that i use 1024 prescale of 11.095200 which result in 107 value for
OCR1A register. can i get the exact delay value by another method ?
is it a good idea to use (_delay()) function instead of timer delay?
also i used the ring buffer library in atmel studio to implement uart function with buffer size equal to 60 (frame size)
should i do the sending operation in Timer1 ISR?
any document, simple example, and you experience will help me.
thank you so much
i have 60 bytes data frame(generated inside atmega128), i have to send them as a frame every 10 ms vi uart with 115200 Baud and 11.095200 MHz external crystal
i did this mission by using timer1 compare interrupt (ctc) mode to enable volatile flag and in the main loop i checked that flag and according to its state i started sending the 60 byte using usual for loop.i will be able to fed up you with the code but if my implementation is not good then no matter that code is .
when i simulated with Proteus using hyper terminal the frames sent correctly until the 9th frame,in 9th frame only some bytes was sent (about 10 bytes of 60) and suddenly moved to start sending 10th frame
i am new in micro controller, i do not know if my implementation is the best method. there is another problem also that is the timer compare interrupt not exactly 10 ms it is 10.06 ms according to atmel studio7 watchdog, note that i use 1024 prescale of 11.095200 which result in 107 value for
OCR1A register. can i get the exact delay value by another method ?
is it a good idea to use (_delay()) function instead of timer delay?
also i used the ring buffer library in atmel studio to implement uart function with buffer size equal to 60 (frame size)
should i do the sending operation in Timer1 ISR?
any document, simple example, and you experience will help me.
thank you so much