02-25-2009 05:33 PM
Is there a good way to do sub-millisecond timing with LabVIEW Embedded for ARM 8.6?
The standard timing blocks only support integer millisecond values and the timed loop will not allow you to access a MHz clock. You can configure interrupts to operate on tick counts, but is there a way to change the interrupt timing programatically?
Currently I am working on a simple stepper motor controller demonstration with the Keil MCB2300, but I am also envisioning some future applications that would require this type of timing control.
-Patrick
02-25-2009 06:37 PM
Hi patrick,
As far as I know, the only way to obtain sub-millisecond timing is to use the use interrupts (as you mentioned). For changing the timing programmatically, I suggest looking at the source files for the timer interrupts (Timer1.c, Timer2.c, etc.) located in Targets\Keil\Embedded\RealView\Generic\LPC2378\interrupt.
I imagine you can use a c node to change the value of T1MR0 (or T2MR0, etc...) programatically. You may need to reset the timer every time you do this so that timing is correct. (This can be done by writing a 1 to T[1/2/3]CR, waiting for at least one tick, then writing a 0)
02-26-2009 12:05 PM
Thanks for the tip.
Just for reference, I found that you can adjust the interrupt timing by calling the initialization function in a c-node:
Timer1Init(nCount,0);
Where nCount is the timing value and 0 is a boolean value that selects ticks (0) or milliseconds (1).
This function includes a reset of the interrupt.
02-26-2009 02:04 PM
02-26-2009 04:05 PM
Hello Patrick,
I don't believe the init function is actually resetting the interrupt. If you want to reset the interrupt you will need to write T1CR = 2 (I was wrong when I said above T1CR = 1 will reset, instead it will enable).
You might try doing:
T1CR = 0; // disable counter
T1MR0 = nCount;
T1CR = 1; // enable counter
This ensures that the timer is actualy disabled and wont be triggering any interrupts. If you are just using the LabVIEW VI to disable the timer interrupt, you are simply ignoring the interrupt.
Also, you want to avoid any extreme values such as numbers near 0x0 or 0xFFFF FFFF.
When tweaking the hardware registers you can't really depend on LabVIEW to abstract these issues, so it may be something completely different. I'm afraid I can't help you much further than this without actually developing the application myself, but try consulting the user manual (or even the errata sheet) for the LPC2378.
thanks