I have written a simple, demonstration program showing how to set up a timer and use the timer interrupt. The application of this technique is a crude stepper motor driver.
The program uses several programming techniques to access the ZX hardware directly. This topic was discussed in some depth in AppNote AN-216, although on different hardware. So the specifics of what bits get set and where they are set will be different for the ATMega644P. The technique will be applicable to ALL native mode devices.
Actually, the technique is applicable to all ZX devices in total, but the timer interrupt is only accessible in the native mode devices.
-Tony
P.S. ZBasic makes accessing the interrupts UNBELIEVABLY easy compared to C!!!
ZX24N Demo program for timer interrupt driven stepper motor
ZX24N Demo program for timer interrupt driven stepper motor
- Attachments
-
- Steper_Nat_Int.zip
- ZIP file with the necessary program elements
- (3.48 KiB) Downloaded 3460 times
Re: ZX24N Demo program for timer interrupt driven stepper mo
I thought that they were fairly comparable. In what ways do you consider it being easier?spamiam wrote:ZBasic makes accessing the interrupts UNBELIEVABLY easy compared to C!!!
- Don Kinzer
Re: ZX24N Demo program for timer interrupt driven stepper mo
Well, when you know what you are doing, it is not all that bad to do in C, but the name for each interrupt is cryptic, and not very intuitive (although it has improved), and it is hard to find a document to get the name of the interrupts. Or maybe I just don't know where to look. I usually have to find it in the IOM file for the specific device, which is not easily found either.dkinzer wrote:I thought that they were fairly comparable. In what ways do you consider it being easier?spamiam wrote:ZBasic makes accessing the interrupts UNBELIEVABLY easy compared to C!!!
In earlier incarnations there were two types of interrupt handlers, one of them called "INTERRUPT" was not actually the one you should routinely use!
Anyway, it can't get easier than the ZBasic method, methinks.
-Tony