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.

Switching Power Supply for Sensors


JBecker Jun 17, 2009 02:46 PM

Dear All,

Since we are running our program in Pipeline- Mode instead of Sequential Mode switching the power supply for our Thermo/hygro/barometer -sensors is not working properly:
Datalogger is CR1000, Program is running in Pipeline Mode and we cannot run in Sequential mode.

SlowSequence
Scan(5,Sec,4,0)
PortSet(9,1)' Switch ON power SW12
Delay(0,600,mSec) ' short delay before measurement
VoltSe(u_analog_sensors_std,3,mV5000,9,1,0,_50Hz,0.001,-0)

PortSet(9,0) ' Switch OFF Power supply for sensors

What makes trouble is the delay before the measurement - the SW12 is switched high for approx. 20ms what is to short for our sensors to heat up. Different delay options (delay(1,600,msec)) seem to have no influence on the obseverved behavior...).

What could we do to switch the SW12 for more than 500msec high before the measurement is executed??

We would be very pleased if someone could give a hint...

Thank you in advance,

Johannes


ncunha Jun 17, 2009 06:17 PM

PURPOSE: Delay enough time for sensor to warmup properly


SlowSequence

Const timerID = 1 'To identify timer resource
Const DelaymSecs = 1250 ' Delay 1.250 secs

Public elapsedtime As Float ' time elapsed
Public u_analog_sensors_std(3) As Float

Public SubScanCounter As Long
Public MainScanCounter As Long


Scan(5,Sec,4,0)

' If Flag(1) Then 'Uncomment this line IF you want to control exactly when code runs...(obviously you need to turn flag(1) high to run)
Flag(1) = false
MainScanCounter = 0 ' verification purpose only (can be deleted)
SubScanCounter = 0 ' verification purpose only (can be deleted)

elapsedTime = 0 'reset variable
Timer(timerID,mSec,2) ' Reset / start timer

PortSet(9,1) ' Switch ON power SW12

'IMPORTANT : SubScans within the slow sequence MUST have interval set to zero, this means
' (1) Code in subscans will run as fast as it can... NOT controlled by any Interval
' (2) the ONLY way to exit the subscan is when Count is reached.
' (3) ... Change the SubScan Count number to have the appropriate amount of time waiting for sensor to warmup
' (4) ... monitor the variable 'elapsedTime' which will indicate exactly the amount of time spent within the subscan (in mSecs)

SubScan (0,mSec, 200)
elapsedTime = Timer(timerID,mSec,4) ' Read time Elapsed

'ISSUE: Line below can not be used to exit SubScan.... if uncommented will Exit Main Scan and NOT turn off sW12
'If elapsedTime >= DelaymSecs Then ExitScan ' This line currently does NOT work

SubScanCounter = SubScanCounter +1 ' Counter to Verify number of iterations within subscan
NextSubScan

'Delay(0,600,mSec) ' short delay before measurement

VoltSe(u_analog_sensors_std(),3,mv5000,9,1,0,_50Hz,0.001,-0)
PortSet(9,0) ' Switch OFF Power supply for sensors


MainScanCounter = MainScanCounter + 1 ' Counter to Verify code execution got here...
Timer(timerID,mSec,1) ' Stop timer / Free resource

' EndIf
NextScan


JBecker Jun 18, 2009 10:08 AM

Thank you very much! Interessting solution, I havent considered to solve this problem using SubScans...

This is working with OS16 but not with OS15, because support for SubScans in SlowSequnences was add in OS16...

This would be no problem in general, but we have some stations which aren't easy to access or far away and we aren't able to update the operating system at all these stations, but we need to improve the program...

Would there be another solution which would work also with OS15?

Thank you again in advance,

Johannes


Sam Jun 24, 2009 07:37 PM

Johannes,

Try using delay option 1 "delay processing". This might accomplish what you're trying to do.

PipeLineMode
Public PTemp, batt_volt
Public u_analog_sensors_std(3)
Public StartPwrUp 'can delete
Public ReadSens 'can delete
Public PortStat
'Main Program
BeginProg
Scan (1,Sec,4,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
NextScan
SlowSequence
Scan (5,Sec,4,0)
ReadSens = false 'can delete
PortStat = TRUE
PortSet (9,PortStat)
StartPwrUp = true 'can delete
Delay (1,600,mSec)
ReadSens = true 'can delete
VoltSe (u_analog_sensors_std,3,mV5000,9,1,0,_50Hz,0.001,-0)
PortStat = FALSE
PortSet(9,PortStat)
StartPwrUp = false 'can delete
NextScan
EndProg

* Last updated by: Sam on 6/24/2009 @ 2:21 PM *

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