Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Change encoder output count

Hi All,

Anyone know how to change the encoder count for an PCIe-8255R on the fly in C++?

 

The following call sets up the output pulse at 40 encoder ticks after the trigger input and works fine.  

 

RetVal = imaqIOPulseCreate(m_id,

   IMAQIO_TIMEBASE_ENCODER_TICKS, 40, //Encoder count

   IMAQIO_TIMEBASE_MICROSECONDS, 100, //Pulse width

   IMAQIO_SIGNAL_ISO_IN, 8, IMAQIO_POLARITY_HIGH_TRUE, //Trigger from TTL8

   IMAQIO_SIGNAL_TTL_OUT, 2, IMAQIO_POLARITY_HIGH_TRUE, //output on TTL2

   IMAQIO_PULSE_MODE_SINGLE_REARM, &pulseID2); //single shot, requires trigger

 

 

 

What I need to do is to change the IMAQIO_TIMEBASE_ENCODER_TICKS value within my program WITHOUT stopping the Pulse Train.

E.G.

This encoder output fires at 40 on this rotation, then the next at 45 then 50...

 

The imaqIOSetAttribute function in the help says that it's not implimented so I can't use that. Any other way of doing this??

 

 

Thanks in advance,

DJack

 

 

 

 

 

0 Kudos
Message 1 of 5
(4,229 Views)

Hi DJack,

 

I am looking into this for you. Please let me know if you have any additional comments/updates.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 5
(4,215 Views)

Hi, Adnan,

To clarify.

I'm looking at a fast rotating shaft with a camera and triggering it based on an encoder position.  I've set up the encoder input OK and can trigger the output when I get the correct number of pulses showing the shaft at the same position each rev.

 

However, I need to view the shaft at any position so I need to change the count at which the output occurs. I know I could stop and dispose of the pulse then re-create it at another position but it takes too long. 

Ideally, I'd like to be able to let the user "advance" or "retard" the  position of the shaft so he can inspect it.

(Hope that made sense)

 

 

Thanks for the reply

DJack

0 Kudos
Message 3 of 5
(4,210 Views)

Hi DJack,

 

I have looked into this for you and unfortunately our C API is not as flexible as our LabVIEW API (since it's possible to achieve this in there, I assumed that might be the case in C as well). There is no way to dynamically change the pulse properties. If you call the Pulse Create function again, it will actually stop the pulse and you will have to call start again. So you don't, necessarily, have to call the dispose function, but will still need to call the start function to set it back up and get it ready. Hopefully, that is much faster. I apologize for the bad news and wish you luck with your application. Please let me know if there is anything else I can help you out with.

 

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 5
(4,200 Views)

Thanks Adnan,

 

It's not what I wanted to hear but I'll see if stopping and starting the pulse is smooth enough. Otherwise, I'll have to find an alternative solution.

 

Thanks again for your help,

DJack

 

0 Kudos
Message 5 of 5
(4,197 Views)