LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub millisecond timing with ARM 8.6?

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

0 Kudos
Message 1 of 5
(7,138 Views)

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)

 

 

Message 2 of 5
(7,135 Views)

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.

0 Kudos
Message 3 of 5
(7,107 Views)
I have to add an addendum to that. The method I suggested works sometimes. After a seemingly random number of changes, the interrupt just stops working and will not respond until the board is reset. I tried disabling the interrupt before changing the timing register, but that didn't seem to make much difference. Any ideas?
0 Kudos
Message 4 of 5
(7,100 Views)

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

 

 

0 Kudos
Message 5 of 5
(7,096 Views)