Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to route Quadrature Encoder signal to CC1 using PCIe 1429 + IO extension card

Hi there,

 

i am currently trying to interface the Basler L304kc to the NI PCIe 1429 + Cameralink IO extension board

 

I want to operate the camera in Ex-SYNC level controlled mode. I would like to route external Quadrature Encoder signals (connected to the IO extension board) to the CC1 cameralink control of the camera

 

Currently, I cannot find this option either in MAX or the Camera File Generator.The L304kc camera file only provides pre-defined pulses, or MAX only offers "External","ISO","RSTI" options for the CC1 sources.

 

Is it possible to route the encoder signal from the IO extension board directly to the CC1 of the camera? Or is there a work-around?

 

Thanks!

Derek Chan

Application Engineer

Basler Asia Pte Ltd

0 Kudos
Message 1 of 34
(3,341 Views)

Hi again,

 

btw I have tried the example code "HL Trigger By Encoder" but it is still limited by the camera file : the camera file/MAX does not allow me to select "Quadrature Encoder" as an input to CC1

 

Thanks!

Derek.

0 Kudos
Message 2 of 34
(3,333 Views)

Hi Derek:

 

I know it's been quite a while since you posted but I thought I'd offer some suggestions for anyone else who might find this.  I wrote a KnowledgeBase article on some troubleshooting steps but it hasn't been pushed live so I'm copying the contents here for now.

 

There are three main steps for troubleshooting this issue: make sure the encoder signal is wired correctly, the camera is setup for triggering, and the framegrabber is setup to trigger a pulse on the camera control lines when a pulse on the encoder signal is captured.

Step 1: Check the wiring of the encoder to the Camera Link I/O Extension Board

Wire the encoder to the Camera Link I/O Extension Board as described in the User Guide. You can test the wiring by running the following VI snippet for your framegrabber. While this VI is running, spin the shaft connected to the encoder and verify that the position indicator updates appropriately. You should be able to turn the encoder shaft one revolution and see the position change by the number of counts per revolution listed by your encoder specifications.



Step 2: Ensure the camera is configured for triggering

Cameras generally need to be put into a triggered mode by setting a camera attribute.You can set this property through Measurement & Automation Explorer or through a camera configuration tool.

Step 3: Setup pulse generation on the framegrabber

To send a trigger to the camera on an encoder value change, the pulse generation section of the camera file needs to configured. Open your camera file in Camera File Generator and select Settings»Pulse Generation to bring up the configuration window. Select the appropriate camera control line and selectEdit to define a pulse equation.

If this section is not configured you may be able to properly read encoder signals but will not actually send triggers to the camera.

It sounds like it's step 3 that's not configured correctly in your case.  As the section says, the encoder signal is not actually passed through but causes the PG section of the camera file to be fired.  If you want a trigger pulse sent to the camera on CC1 you just need to make sure a single pulse is defined in the PG section.

 

Hopefully this helps but let me know if you're still having trouble with it.

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 3 of 34
(3,225 Views)

Hey,

 

I just found this thread and I think I have a similar problem. I would like to trigger a linescan camera using an encoder. So whenever the encoder count changes a trigger pulse is generated on CC1.

 

Can you tell me more about step 3 - how to write the equetion. Is there an example/tutorial I could use?

 

Matej

0 Kudos
Message 4 of 34
(3,154 Views)

Hi Everybody,

 

this seems to be a common problem. I use a PCIe-1430 with PCIe extension board. The RS422 signal works (i can read back the position). I can also run the line scan camera (Basler sprint 4096) by strobing an external signal to the SMB connector on the PCIe-1430. Therefore the SMB signal seems to be routed to CC1 and maybe other CC lines or even directly connected (unfortunately there is no information about that in the manual).

 

Now the question is how to route the scaled encoder signal to CCn (CC1 for the basler sprint series)?

 

With MAX one can define the action for CC1 to CC4. Basler defines CC1 as Exync. So I assume one needs to set CC1 as external, connected to say external trigger line x (0). What command does now route the scaled encoder signal to CC1 (i.e. external line 0)?

 

There is a CVI example ("Trigger Each Line From Encoder") but it also does not work, no matter how I change the lines or commands in order to actively drive line 0.

 

I also recognised that there are no serial commands defined in the camera file for the basler sprint. Do I have to change the camera with CC+ from basler in exactly the same mode than set with MAX or is there a kind of sync?

 

Thanks for any help in advance...

 

 

0 Kudos
Message 5 of 34
(3,109 Views)

Update...

 

 

it seems to work if one drives an external trigger line by the SCALED_ENCODER and then uses this external trigger line to drive the line scan camera.

 

In CVI it looks..

 

imgSessionTriggerDrive2(SessionID, IMG_SIGNAL_EXTERNAL, 0, IMG_TRIG_POLAR_ACTIVEH, IMG_TRIG_DRIVE_SCALED_ENCODER);

 

imgSessionLineTrigSource2(SessionID, IMG_SIGNAL_EXTERNAL, 0, IMG_TRIG_POLAR_ACTIVEH, 0);

 

anyway, guys from NI, it would be nice to get a deeper explanation....

0 Kudos
Message 6 of 34
(3,103 Views)

It's been several months since I've dealt with this topic as I'm no longer in the Vision and Motion support group but I'll give this a shot.  If you can successfully read encoder pulses through the IMAQ property node and you can trigger the camera using an external trigger, I believe the only thing you need to do is modify the pattern section of your camera file as described in step 3 of my previous post.

 

From my recollection, you can't route the scaled encoder line anywhere in particular but a pulse on that line will fire off a pattern on the CC lines as described in your camera file.  By default the pattern generation (PG) section of your camera file (at least for the Basler Sprint) looks like the following:

 

Pattern {
Action (PG) {
Line (0) {

Start (Low)
}
Line (1) {
Start (Low)
}
Line (2) {
Start (Low)
}
Line (3) {
Start (Low)
}
Clock (0x78)
RepeatSource (Fixed, 10)
}
}

 

Therefore, whenever you receive a pulse on the scaled encoder line, your board fires off a pattern as described here, nothing.  You need to use the Camera File Generator tool and go to Settings>>Pulse Generation and edit the settings for the appropriate CC line.  When you're done with this, you should have something like the following in your camera file, now with the line in red.

 

Pattern {
Action (PG) {
Line (0) {

Start (Low)

50000, 50000
}
Line (1) {
Start (Low)
}
Line (2) {
Start (Low)
}
Line (3) {
Start (Low)
}
Clock (0x78)
}
}

 

This line in red defines what kind of pulse is output whenever the PG section is fired (from a pulse on your scaled encoder signal in this case).  This example describes a pulse that is low for 1 ms and high for 1 ms.  We know this because the signal starts low as described so we know that comes first and then each number defines the number of clock ticks for the low and then high states.  The 1430 has a 50 MHz clock (I believe) and 50,000 ticks corresponds to 1 ms.  

 

You can also forgo using the Camera File Generator and just make this change in your camera file directly.  Let us know how this works out.

Alex Person
NI-RIO Product Support Engineer
National Instruments
Message 7 of 34
(3,101 Views)

Hi Alex,

 

good to see there is somebody out there...

 

this is getting more and more confusing...

I am now able to grab the image all the time. What I need to do is to reset the encoder reading to zero by

 

imgEncoderResetPosition(SessionID);

 

With the zero the image grabbing immediatly starts. It works even without driving a certain line. I try a couple of other variants tomorrow. I also try to use the

 

rval imgPulseCreate2(uInt32 timebase, uInt32 delay, uInt32 width, IMG_SIGNAL_TYPE signalType, uInt32 signalIdentifier, uInt32 signalPolarity, IMG_SIGNAL_TYPE outputType, uInt32 outputNumber, uInt32 outputPolarity, uInt32 pulseMode, PULSE_ID* plsID);

 

instead of modifing the camera file in order to better understand what is going on.

 

Still, there is a real lack in the documentation that should be clarified, i.e. wiring of the SMB connector. Also, the GetArributes function tells me that there are 9 external trigger lines available on the PCIe1430 but there is no statement about the last line.

 

From what I understood from your camera file settings, there seems to be the following princible:

 

CL frame grabber ---------- Camera Link (CC1 - CC4 ) ----------------- Camera

 

external sigs are routed                                                                    rec. ExSync on CC line

to an interal  (virtual) trigger.

The behaviour of this

virtual trigger is defined

in the camera file. In your

ex. it produces a pulse

that is send in real on

CC1 to the camera.

 

Is this somehow the principle? How does the resetting of the encoder reading fit in?

 

Kind regards, Holger

 

0 Kudos
Message 8 of 34
(2,979 Views)

What is line 4 for in camera files as shown below:

 

Action (PG) {
                                       Line (0) {
                                          Start (Low)
                                          10, 10
                                       }
                                    }
                                    Action (PG) {
                                       Line (4) {
                                          Start (High)
                                          10, (Line Period) - 10
                                       }
                                    }

I get Line(0) is CC0.  How is Line (4) controlling the line rate?

0 Kudos
Message 9 of 34
(2,972 Views)

Hi Alex,

 

I posted the following (similar) text to the support center but I think it is of common interest:

 

A) CL-card with ext. board. One can use the ISO, ext. and RS422 encoder inputs and also output cannels ISO and external.

There is also a SMB connector corresponding to the ext. channel 0.

 

B) with MAX one can define what kind of signals should be routed to CC1 to CC4. As I learned from

this side one cannot use MAX or the Camera File generator but has to do this manually in order to use RS422 encoder triggering!!!

 

C) on the other side there exists function to route and control signals explicitely, for example
* imgSessionLineTrigSource2 -> what is this good for then? All your manuals are saying that this is done in MAX or the camera file by defining what signal drives the correspondung CC ine?? On the other side there is an example in CVI that does not work ("Trigger Each Line From Encoder") (at least it does not work with the PCIe1430).

 

D) Can one implement the CC routing from MAX or the camera file manually with the following functions
* imgSessionLineTrigSource2
* imgPulseCreate2
* imgSessionTriggerDrive2

or does MAX use hidden functions ore mechanism to control the CL Cards?

 

E) I can use one single line to setup scaled encoder triggering
* imgSessionLineTrigSource2(iLS_ZK1_SessionID, IMG_SIGNAL_SCALED_ENCODER, 0, IMG_TRIG_POLAR_ACTIVEH, 0);

but this only starts to work if I reset the encoder position to zero by sending this to the CL card, i.e.
* imgEncoderResetPosition(SessionID);

AND only in positive counting direction!

 If I just run though the zero position without a position reset I do not get ExSync on CC1????

 

Is the information where to route the Scaled encoder to coming from the camera file? Why cannot I simply and explicitely route the scaled encoder

signal to a certain CC line? Why using all those different approaches?

 

F) now if in addition to E) i use

* imgSessionTriggerDrive2(iLS_ZK1_SessionID, IMG_SIGNAL_EXTERNAL, 0, IMG_TRIG_POLAR_ACTIVEH, IMG_TRIG_DRIVE_SCALED_ENCODER);

to drive ext. 0 (SMB connector) I can see exactly this behavior on the scope. No signal until I reset the encoder counter. Then I get signals as long as the image sequence is running. After the recording the signal disappears.

 

kind regards, Holger h.baur(at)ivisso.com

 

 

0 Kudos
Message 10 of 34
(2,963 Views)