Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

PCIe-1433: pulse train to CC1, in C++?

I'm sure this should be a simple question and there's a lot of good information from previous threads but I can't quite put it together.

 

I have a PCIe-1433 and a Point Grey Gazelle; everything works okay, and in the Camera File Generator, I can put the camera into bulb-shutter mode and correctly control the exposure. So, through the camera file, control of CC1 works well.

 

But now I want to programmaticaly generate a simple pulse train, to CC1 of this camera. CC1 is already set as "external" line 0 in MAX. I believe I am correctly putting the camera into external trigger mode because the frame rate drops to 0 (or the timeout rate). The commands are a bit confusing to me; currently I am using

 

imgPulseCreate2(PULSE_TIMEBASE_50MHZ, 50000, 50000, IMG_SIGNAL_STATUS, IMG_IMMEDIATE,
IMG_TRIG_POLAR_ACTIVEH,IMG_SIGNAL_EXTERNAL, 0, IMG_PULSE_POLAR_ACTIVEH,
 PULSE_MODE_TRAIN, &pulseId);

imgPulseStart(pulseId, sessionId);

 

No errors reported (after some trial and error), but I don't believe it's creating a pulse. I need to do this programmatically because I will need to vary the pulse rate to something the camera can support for different ROI's, although if there is a combination of using the camera file and code I would be happy to use that.

 

Any help would be greatly appreciated!

0 Kudos
Message 1 of 5
(3,564 Views)

... on further experimentation, I think that there is also something wrong with how I am setting the camera. I am now experimenting with an external trigger through the camera's direct trigger input, with a function generator.

 

When I explicitly programmatically send serial commands to go into hardware trigger mode, and get triggers from the GPIO port, it doesn't seem to work, even though I get acknowledgements from the camera. But when I edit the camera file to add a new mode called "External" and set that as the default, it works. Still, I'd like to be sure I have the pulse train commands correct.

0 Kudos
Message 2 of 5
(3,563 Views)

One more addendum!

 

I now have this working like a dream using camera file attributes, and I'd be happy to go that route. BUT, the imgSetCameraAttributeNumeric command won't work when acquisition is running, and I need to be able to change exposure time on the fly. So I at least need to be able to edit the pulse train on the fly! As before, any help is greatly appreciated.

0 Kudos
Message 3 of 5
(3,561 Views)

Hi,

 

Recent devices such as the 1433 support the following function:

 

USER_FUNC imgPulseUpdate(PULSE_ID pid, SESSION_ID sid, uInt32 delay, uInt32 width);

 

This should allow you to modify an existing pulse train on the fly.

 

However, if you want to modify camera attributes that send serial strings to the camera, unfortunately these cannot be done while the camera is acquiring due to how the driver manages states for those features. You would likely need to send strings manually to the camera using the imgSessionSerialWrite/imgSessionSerialRead merchanism to allow you to send commands to the camera without stopping the acquisition.

 

Eric

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

GREAT! Thank you Eric, starting with your tip and then some more trial and error, I've got it going now. A few things:

 

* The attribute I was trying to modify actually only involved a pulse width, but it still wanted me to stop the acquisition.

 

* The solution ended up being to code the camera mode (set by serial commands to first set the trigger source to CC1, then set the trigger mode to single) in the camera file.

 

For some reason that I'll figure out one day, sending these same codes with serial write just did not work at all. Even if I told the camera file not to send any serial codes at all, ever, sending the same two commands myself didn't seem to work (even though I got acknowledgement from the camera). I'd like to solve this because I believe that calling AcquisitionStart resends these codes (for example, when I set up for a sequence acquisition) but this is redundant and slows things down.

 

* So now I tell the camera file to send "trsrc line1\r" and "trm single\r", but with no pulse output. Then in the code, I use the commands below to set the pulse.

 

imgPulseCreate(PULSE_TIMEBASE_50MHZ, 70000, 70000, IMG_IMMEDIATE,
IMG_TRIG_POLAR_ACTIVEH,IMG_EXT_TRIG0, IMG_PULSE_POLAR_ACTIVEH,
PULSE_MODE_TRAIN, &pulseId);

imgPulseStart(pulseId, sessionId);

 

then, to change the exposure time:

imgPulseUpdate(pulseId, sessionId, delay, width);

0 Kudos
Message 5 of 5
(3,552 Views)