I Plan to use the atmel chip (MEGA8) on a high precision application and therefore I want to disable timer0 or at least I don't want it associated with the arduino functions.
So the first thing that comes to mind is, should I need any delays, how shall these be implemented?
The second is how hard it would be to implement the same code on the VR compiler. I am programming in low level C, but need serial at a rather unusual frequency (4.19xxxMHz).
I Plan to use the atmel chip (MEGA8) on a high precision application and therefore I want to disable timer0 or at least I don't want it associated with the arduino functions.
So the first thing that comes to mind is, should I need any delays, how shall these be implemented?
The second is how hard it would be to implement the same code on the VR compiler. I am programming in low level C, but need serial at a rather unusual frequency (4.19xxxMHz).
Regards
Instead disabling Arduino timer and functions, and if you are working on avr studio, why dont you just program on bare AVR C and forget about Wiring?
That is not going to happen, the UART needs feeding with 16 times the baud rate.
Care to elaborate?
Well no.
It is a statement of fact. Look at the data sheet about how USARTS work. You need to set the programmable clock at 16 times the baud rate, so it is not going to happen because 16 * 4 = 64MHz does the clock even go that fast.
Atmel Studio and Arduino use the same avr-gcc toolchain, studio will have a later version. You should also download the docs for avr-libc (Google, I don't remember the URL).
That is not going to happen, the UART needs feeding with 16 times the baud rate.
Care to elaborate?
Well no.
It is a statement of fact. Look at the data sheet about how USARTS work. You need to set the programmable clock at 16 times the baud rate, so it is not going to happen because 16 * 4 = 64MHz does the clock even go that fast.
I still don't understand what you're trying to say.
For an ATMEGA8 the baud rating can be set anywhere from 250000 and 61bps, assuming a clock frequency of 4MHz
This is using the provided equations on Pag. 132 of the device datasheet that can be found here: Redirect Notice
I just tested at 57600bps using a 4MHz Crystal, so perhaps what you are trying to say is that it wont work as fast as with a 16MHz clock?
Figure 62 on that data sheet.
See there is a divide by 2 a divide by 4 and a divide by 2 block between the oscillator and the USART clock. Add that up and you get divide by 16.
If the clock you are using is a 4MHz one then the maximum baud rate you can get is 250,000 baud.
You said:-
but need serial at a rather unusual frequency (4.19xxxMHz).
Well unless you have a 64MHz clock you can get no where close to that.
If you think I am spouting rubbish then go ahead and try it.
Grumpy_Mike:
Figure 62 on that data sheet.
See there is a divide by 2 a divide by 4 and a divide by 2 block between the oscillator and the USART clock. Add that up and you get divide by 16.
If the clock you are using is a 4MHz one then the maximum baud rate you can get is 250,000 baud.
You said:-
but need serial at a rather unusual frequency (4.19xxxMHz).
Well unless you have a 64MHz clock you can get no where close to that.
If you think I am spouting rubbish then go ahead and try it.
I get what you're saying now.
I managed to get it working in the past with 14.318Mhz and 24.586Mhz crystals by adjusting the baud rate on the program. For example, instead of 9600 I would rather use (16/24.586)*9600 = 6247 or 6248bps.
The result was accurate enough to get it going, so fingers crossed.
This is for an LCD, so I can choose the best baud rate between both to match the frequency nicely.