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.

SDMCD16AC programming


Otemohu Jun 17, 2013 07:29 AM

Hi all,

I received a controler SDMCD16AC last week (my first one). It will be used to control eight solenoid valves.
I started with the manual and the CRBasic example to understand the functionning of the device.

But I have some difficulties. If I understand well, I have to create an array in wich values (zero or non zero) will activate the control ports of the SDMCD16AC. So I have to create an array that will change as following :
t1 : 0 0 0 0 0 0 0 0
t2 : 1 0 0 0 0 0 0 0
t3 : 0 1 0 0 0 0 0 0
t4 : 0 0 1 0 0 0 0 0
t5 : 0 0 0 1 0 0 0 0
t6 : 0 0 0 0 1 0 0 0
t7 : 0 0 0 0 0 1 0 0
t8 : 0 0 0 0 0 0 1 0
t9 : 0 0 0 0 0 0 0 1
This will activate sequentially (t1, t2, t3 ...) the eight first port of the SDMCD16AC ... I know that non-zero values are not necessarely equal to 1.

If it's OK ...how can I easily programm that ?

Thanks,
Daniel


GTProdMgr Jun 17, 2013 05:16 PM

Public ControlArray(16)
Public Blip

BeginProg

Blip = 1

Scan (1,Sec,10,0)

SDMCD16AC(ControlArray(),1,3)

ControlArray(Blip) = 0

If Blip = 16 Then Blip = 0
Blip += 1

ControlArray(Blip) = 1

NextScan

EndProg


Otemohu Jun 19, 2013 12:09 PM

Than you, it works well.

Here is the program I created to loop the eight first ports with a time period different of the scanrate. If I want, I can easily change the sequence of ports.

'CR3000 Series Datalogger
'To create a different opening program template, type in new
'instructions and select Template | Save as Default Template
'date:
'program author:


'Dimension Variables

Public i

Const NbrOfLevel = 8
Const NbrOfCalib = 2

Dim Level(NbrOfLevel) As Long
Dim Calib(NbrOfCalib) As Long
Dim LevelSeq(NbrOfLevel) As Long
Dim CalibSeq(NbrOfCalib) As Long

Dim SampleCD16 As Long

Public Site As Long
Public SeqIndex As Long
Public CalibSeqFlag As Boolean

'Program
BeginProg

'Load Level SDM_CD16AC settings
Level(1) = 2^0 'Level 1 = 00.30 m
Level(2) = 2^1 'Level 2 = 00.60 m
Level(3) = 2^2 'Level 3 = 01.19 m
Level(4) = 2^3 'Level 4 = 02.36 m
Level(5) = 2^4 'Level 5 = 04.70 m
Level(6) = 2^5 'Level 6 = 09.35 m
Level(7) = 2^6 'Level 7 = 18.60 m
Level(8) = 2^7 'Level 8 = 37.00 m
Calib(1) = 2^14 'Calib tank 1 = CO2 free air
Calib(2) = 2^15 'Calib tank 2 = CO2 500ppmv in air

'Load Level and Calib Sequences
LevelSeq(01) = 1
LevelSeq(02) = 2
LevelSeq(03) = 3
LevelSeq(04) = 4
LevelSeq(05) = 5
LevelSeq(06) = 6
LevelSeq(07) = 7
LevelSeq(08) = 8

CalibSeq(01) = 1
CalibSeq(02) = 2

SeqIndex = 0
CalibSeqFlag = False

Scan(1,Sec,0,0)
SDMCD16AC(SampleCD16,1,0)
If TimeIntoInterval(0,2,Sec) Then
If CalibSeqFlag = False Then
SeqIndex = (SeqIndex MOD NbrOfLevel) + 1
Site = LevelSeq(SeqIndex)
SampleCD16 = Level(Site)
EndIf
EndIf
NextScan
EndProg


My final objective is to control ten solenoid valves. The first eight will act as loop : 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, etc...
I would like to be able to choose easily the number of loop.

The two others solenoid valve (connected for example in port 15 and 16 of the SDMCD16AC) will be active sequentially the rest of time.

example : ten times 1-to-8 and 2 times 15-to-16.

I think I need to use TimeIntoInterval and Flag control but I don't succeed.


Otemohu Jul 2, 2013 08:53 AM

Could you please help me to create a CRBasic program for what I have to do?

I tried "Do Loop", If "TimeIntoInterval" but I don't succeed.

My final objective is to control ten solenoid valves. The first eight will act as a loop : 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, etc... during a period that I can fix at the beginning of the program.
Sometimes, I will have to choose a loop on 2 others solenoid valves (example way 15 and 16 on SDMCD16AC).

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