Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Using Multiple Control Ports as Triggers


litterClean Jul 8, 2013 05:54 PM

Hi,

I am fairly new to CRBasic and I think that this should be fairly easy but I don't know how to go about doing it. I am trying to use control port 1 and control port 2 to trigger two different measurements. So, in other words, the datalogger does nothing until it receives a high signal from either control port 1 or 2. Once it receives the high signal it will run through the proper measurements which depend of the control port.

So far I have successfully use WaitDigTrig to to read control port 1 and trigger its code, however I would like the program to look at both port 1 and port 2. How would I go about doing this?

Thanks!


Grant Jul 8, 2013 10:18 PM

You could try something like

Public Control1, Control2
Public DiffMeasurement1,DiffMeasurement2

DataTable (Measurements,1,-1)
DataInterval (0,1,Sec,10)
Sample (1,DiffMeasurement1,FP2)
Sample (1,DiffMeasurement2,FP2)
EndTable

BeginProg
Scan (1,Sec,3,0)

PortGet (Control1,1)'Get state of Control Port 1
PortGet (Control2,2)'Get state of Control Port 2

If Control1>0 Then'If Control Port 1 is high
VoltDiff (DiffMeasurement1,1,mV5000,1,False,0,250,1,0)
EndIf

If Control2>0 Then' If Control Port 2 is high
VoltDiff (DiffMeasurement2,1,mV5000,2,False,0,250,1,0)
EndIf

CallTable Measurements
NextScan
EndProg

Cheers

Grant


Dana Jul 9, 2013 06:39 PM

I haven't tested this, but I think if you set up two SlowSequence scans, one for WaitDigTrig control port 1 and the other for control port 2, it will do what you want. Just make sure that when the program compiles, it compiles in Pipeline Mode (rather than sequential).

Dana W.

Log in or register to post/reply in the forum.