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.

SW12


christophe Jan 9, 2014 10:38 AM

Hi
I would like to modify my prog to:

declare sw12 as public and then see state in public table
save the state of sw12 in table
and the last thing, when the condition is on ,sw12 is on for only 10 seconds...and turn off

Is it possible ?

Thanks

'Declare Variables and Units
Public BattV
Public PTemp_C
Public Temp_C(2)
Public T


Units BattV=Volts
Units PTemp_C=Deg C
Units Temp_C=Deg C
Units T=Deg C

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,15,Min,10)
Average(1,Temp_C(1),FP2,False)
Average(1,Temp_C(2),FP2,False)
Average(1,T,FP2,False)
Average(1,SW12,FP2,False)
EndTable


'Main Program
BeginProg
'Main Scan
Scan(2,Sec,1,0)
'Default Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,_60Hz)
'Type T (copper-constantan) Thermocouple measurements 'Temp_C()'
TCDiff(Temp_C(),2,mV2_5C,1,TypeT,PTemp_C,True,0,_60Hz,1,0)
'User Entered Calculation
T=(Temp_C(1)+ Temp_C(2))/2
If T > 26 Then SW12(1)
If T <= 26 Then SW12(0)
'Call Data Tables and Store Data
CallTable(Table1)

NextScan
EndProg


Dana Jan 9, 2014 04:46 PM

The state of the SW12V is a boolean value reported in the Status Table of the datalogger. It is called SW12Volts. You can use the data table access syntax to put the value into a variable:

Public PortSW12

'variable=tablename.fieldname
PortSW12 = Status.SW12Volts

Check the CRBasic help for a complete discussion on the data table access syntax.

You can use an IFTime statement (also known as TimeIntoInterval) to run code based on time. There is also information about it in the help.

Dana


christophe Jan 10, 2014 10:52 AM

thanks ,
but TimeIntoInterval works with real time ,
i would like to switch on for only 10 seconds a flag...and turn off.....

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