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.

SI-121 to multiplexer AM16/32


irving May 12, 2010 08:21 PM

Hi All,
I'm asking a newbie question here. I'm trying to wire 9 SI-121 infared sensors to a AM16/32A multiplexer which is connected to a CR1000. I'm currently using short-cut 2.8 in PC400 to generate such a set-up but it seems short-cut 2.8 does not have SI-121 (or IPR-P)listed as a possible selection of devices that can be connected to AM16/32A (after choosing AM16/32 I don't see any infared devices listed in the drop-down menu). Could someone please give me suggestions as how to build up a short-cut program to connect SI-121 to AM16/32A? Thank you and looking forward to hearing from you!

Xin


Sam Jun 7, 2010 05:39 AM

*This has not been tested.*
I'm thinking that if you can create a ground bus for the sensors, you could use the following program for reading 16 SI-111 sensors through a AM16/32B multiplexer in 4x16 mode. Again, I have not tested this, so do so before deploying. Please report your success/failures.

'CR1000
Public PTemp, batt_volt
Public SBTemp(16), TmV(16), TargTemp(16)
Dim Tsqr1, Tsqr2, SBTempK, m, b, TargTempK
Dim LCount

Dim mC2(16) = {69816.6,69816.6,69816.6,69816.6,
69816.6,69816.6,69816.6,69816.6,
69816.6,69816.6,69816.6,69816.6,
69816.6,69816.6,69816.6,69816.6}

Dim mC1(16) = {8.68509e+006,8.68509e+006,8.68509e+006,8.68509e+006,
8.68509e+006,8.68509e+006,8.68509e+006,8.68509e+006,
8.68509e+006,8.68509e+006,8.68509e+006,8.68509e+006,
8.68509e+006,8.68509e+006,8.68509e+006,8.68509e+006}

Dim mC0(16) = {1.51825e+009,1.51825e+009,1.51825e+009,1.51825e+009,
1.51825e+009,1.51825e+009,1.51825e+009,1.51825e+009,
1.51825e+009,1.51825e+009,1.51825e+009,1.51825e+009,
1.51825e+009,1.51825e+009,1.51825e+009,1.51825e+009}

Dim bC2(16) = {25153.4,25153.4,25153.4,25153.4,
25153.4,25153.4,25153.4,25153.4,
25153.4,25153.4,25153.4,25153.4,
25153.4,25153.4,25153.4,25153.4}

Dim bC1(16) = {-295711,-295711,-295711,-295711,
-295711,-295711,-295711,-295711,
-295711,-295711,-295711,-295711,
-295711,-295711,-295711,-295711}

Dim bC0(16) = {-3.10924e+006,-3.10924e+006,-3.10924e+006,-3.10924e+006,
-3.10924e+006,-3.10924e+006,-3.10924e+006,-3.10924e+006,
-3.10924e+006,-3.10924e+006,-3.10924e+006,-3.10924e+006,
-3.10924e+006,-3.10924e+006,-3.10924e+006,-3.10924e+006}

BeginProg
Scan(60,Sec,1,0)

Battery(BattV)

PortSet(2,1) 'Turn AM16/32 Multiplexer On
Delay(0,150,mSec)
LCount=1

SubScan(0,Sec,1)
PulsePort(1,10000) 'Switch to next AM16/32 Multiplexer channel

Therm109(SBTemp(LCount),1,1,Vx1,0,_60Hz,1,0)
VoltDiff(TmV(LCount),1,mV2_5,2,True,0,_60Hz,1,0,)
m = mC2(LCount) * SBTemp(LCount)^2 + mC1(LCount) * SBTemp(LCount) + mC0(LCount)
b = bC2(LCount) * SBTemp(LCount)^2 + bC1(LCount) * SBTemp(LCount) + bC0(LCount)
SBTempK = SBTemp(LCount) +273.15
Tsqr1 = SBTempK^4+TmV(LCount)*m+b
Tsqr2 = SQR(Tsqr1)
TargTempK = SQR(Tsqr2)
TargTemp(LCount) = TargTempK - 273.15

LCount=LCount+1
NextSubScan

PortSet(2,0)'Turn AM16/32 Multiplexer Off
Delay(0,150,mSec)

NextScan
EndProg

* Last updated by: Sam on 6/6/2010 @ 11:46 PM *


RBrad May 16, 2017 09:16 PM

Thanks for this code Sam.

But when I copied and pasted Sam's program into CRBasic, I ran into some issues:

The Battery instruction should be using the declared batt_volt, not BattV

The declared PTemp variable is not used (and the compiler gives a warning)

I don't have the equipment to test, but I believe that the third parameter of the SubScan instruction -- SubScanCount will need to be 16, not 1, to cycle through the 16 sensors.  It's not a bad idea to start with a 1 so that you can test the wiring of the multiplexer, but to use all 16 sensors, the line should be: SubScan(0,Sec,16).  Without the change, I think you will only get a single measurement.

Also, if you're a beginner, you’ll need to change the arrays so that the calibration numbers match your sensors' values and add data tables to the code in order to store values.

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