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.

Continuously send data from RS232


Katchinskiy May 31, 2011 06:47 PM

Hello,

We have a CR1000 data logger and I need to send the signal that comes out of the RS232 port using wireless device (XBee) to single Board computer running ARM Linux.
I need to make the CR1000 somehow send the information continuously (about every second) so that I can read the data and sent it using the wireless device.
Right now, we are not able to send data to the CR1000 using this setup. So I was wondering if there is a way I can make it send data by applying a high/low voltage to one of the pins for example.
I also want to be able to see the packages sent using a hyper terminal.

Thank you for you help.


IslandMan May 31, 2011 07:25 PM

Suggest you do a search of the forum next time as there are numerous examples.

http://www.campbellsci.com/forum/messages.cfm?threadid=A63C24A3-D768-16A5-DD017975D65B6940


Katchinskiy May 31, 2011 07:29 PM

This solution doesn`t help me.
Because my situation is that I don`t see any signal coming from the COM port.
I try opening a hyper terminal and see if I receive any packages.. and nothing.
Nir.


Sam Jun 2, 2011 12:06 AM

This program should be a good start


Public PTemp, batt_volt
Public RecWritten As Boolean
Const StrLen = 1023
Dim GRData As String * StrLen 'record data - large Public strings can make CONNECT monitoring slow
Const ComPort = COM1
Const ComBaud = 115200

ReadOnly RecWritten

DataTable (Test,1,-1)
DataInterval (0,15,Sec,10)
Sample (1,batt_volt,FP2)
Sample (1,PTemp,FP2)
EndTable

BeginProg

SerialOpen (ComPort,ComBaud,0,0,StrLen)

Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
CallTable(Test)

RecWritten = Test.Output(1,1)
If RecWritten
GetRecord (GRData,Test,1)
'Uncomment for optional string massaging
'"YYYY-MM-DD HH:MM:SS", RECNUM, DATA, DATA, DATA,CR
'GRData = Left (GRData,InStr (2,GRData,"""",2)) & "," & Test.Record(1,1) & Mid (GRData,InStr (2,GRData,"""",2) + 1,1000) & CHR(13)
SerialOut (ComPort,GRData,"",0,0) 'send data out
EndIf

NextScan
EndProg


Katchinskiy Jun 2, 2011 03:58 PM

Thank you very much for your response Sam and IslandMan.
Now I understand what I have to do... Sorry about my earlier response.

So I tried to modify my program:
--------------------------------------------------
'CR1000


'Declare Variables and Units
Public Batt_Volt
Public WindI
Public CollFlow
Public RefTemp
Public Thermocou(21)
Public WindSpdHi
Public WindSpdAvgHi
Public WindDirHi
Public TurbineCurrent
Public CabinLoad
Public Avg10mnt(31)
Public Avg10msg As String * 1023
Public BattVout As String
Public RecWritten As Boolean


Units Batt_Volt=Volts
Units WindI=mV
Units CollFlow=Counts
Units RefTemp=Deg C
Units Thermocou=Deg C
Units WindSpdHi=kilometers/hour
Units WindSpdAvgHi=kilometers/hour
Units WindDirHi=Degrees
Units TurbineCurrent=A
Units CabinLoad=A

'Define Data Tables
DataTable(Table1,True,-1)
DataInterval(0,15,Sec,10)
Average(1,RefTemp,FP2,False)
FieldNames("RefTemp")
Average(1,Thermocou(1),FP2,False)
FieldNames("CollCold")
Average(1,Thermocou(2),FP2,False)
FieldNames("CollHot")
Average(1,Thermocou(3),FP2,False)
FieldNames("TankT")
Average(1,Thermocou(4),FP2,False)
FieldNames("HeatXout")
Average(1,Thermocou(5),FP2,False)
FieldNames("HeatXin")
Average(1,Thermocou(6),FP2,False)
FieldNames("GTankIsul")
Average(1,Thermocou(7),FP2,False)
FieldNames("EFloorT")
Average(1,Thermocou(8),FP2,False)
FieldNames("GroundT")
Average(1,Batt_Volt,FP2,False)
FieldNames("LogBatt")
Sample(1,Batt_Volt,FP2)
FieldNames("Blank")
Average(1,WindI,FP2,False)
FieldNames("WindI")
Average(1,CollFlow,FP2,False)
FieldNames("CollFlow")
Average(1,Thermocou(9),FP2,False)
FieldNames("GTankBot")
Average(1,Thermocou(10),FP2,False)
FieldNames("GTankTop")

Average(1,Thermocou(11),FP2,False)
FieldNames("EastRoomTemp")
Average(1,Thermocou(12),FP2,False)
FieldNames("WestRoomTemp")
Average(1,Thermocou(13),FP2,False)
FieldNames("NWall26In")
Average(1,Thermocou(14),FP2,False)
FieldNames("NWall26Out")
Average(1,Thermocou(15),FP2,False)
FieldNames("NWall224In")
Average(1,Thermocou(16),FP2,False)
FieldNames("NWall224Out")
Average(1,Thermocou(17),FP2,False)
FieldNames("PVPanelT")
Average(1,Thermocou(18),FP2,False)
FieldNames("HeatEXOut")
Average(1,Thermocou(19),FP2,False)
FieldNames("HeatEXIn")
Average(1,Thermocou(20),FP2,False)
FieldNames("FloorReturnT")
Average(1,Thermocou(21),FP2,False)
FieldNames("PropaneFlame")

Maximum(1,WindSpdHi,FP2,False,False)
FieldNames("WindSpdHi")
Average(1,WindSpdHi,FP2,False)
FieldNames("WindSpdAvgHi")
Sample(1,WindDirHi,FP2)
FieldNames("WindDirHi")
Average(1,TurbineCurrent,FP2,False)
FieldNames("TurbineCurrent")
Average(1,CabinLoad,FP2,False)
FieldNames ("CabinLoad")

EndTable

'Main Program
BeginProg
SerialOpen (COM1,9600,0,0,1023)
Scan(5,Sec,1,0)
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery(Batt_Volt)
'AM25T Multiplexer
'Reference Temperature measurement RefTemp on the AM25T Multiplexer:
AM25T(RefTemp,0,mV2_5C,1,8,TypeT,RefTemp,7,8,1,True,0,250,1,0)
'Type T (copper-constantan) Thermocouple measurements Thermocou(1) on the AM25T Multiplexer:
AM25T(Thermocou(1),21,mV2_5C,1,8,TypeT,RefTemp,7,8,0,True,0,_60Hz,1,0)
'Generic Differential Voltage measurements WindI:
VoltDiff(WindI,1,mV2500,3,True,0,_60Hz,.1042,-130.4)
'Pulse measurement CollFlow:
PulseCount(CollFlow,1,1,1,1,.0273,0.0)

PulseCount(WindSpdHi,1,2,1,1,0.3528,0)
BrHalf(WindDirHi,1,mV2500,7,2,1,2500,True,0,_60Hz,355,180)
If WindDirHi>=535 Then WindDirHi=0
If WindDirHi>360 Then WindDirHi=WindDirHi-360
VoltSe(TurbineCurrent,1,mV5000,8,True,0,_60Hz,0.0502,-125.1)
VoltSe(CabinLoad,1,mv5000,6,True,0,_60Hz,0.01,0)


'Call Data Tables and Store Data

CallTable(Table1)
RecWritten = Table1.Output(1,1)
'Check to see if the D_10mnt table has been written
If RecWritten
'Get the records from the data table
GetRecord (Avg10mnt,Table1,1)
'Format the data into strings
BattVout = FormatFloat (Avg10mnt(1),"%4.1f")
'Compile the individual data into a message string
Avg10msg = BattVout + "," + CHR(13) + CHR(10)
'send the message out the serial port
SerialOut (COM1,Avg10msg,"",0,100)
EndIf
NextScan
EndProg


--------------------------------------------

And as a test to send on serial BattVout.
When I open Putty to see if I get any data out, nothing is happening.

Any ideas?

Thank you.


Sam Jun 2, 2011 08:28 PM

Are you plugged into COM1? COM1 is the C1/C2 pair on the datalogger wiring panel.

I loaded your program onto a CR1000, connected by PC to COM1 and receive the following every 15 seconds.

ASCII:
NAN,[CRLF]

HEX:
20 4E 41 2C 0D 0A

The logger is attempting to output " RefTemp,CRLF"


Katchinskiy Jun 2, 2011 08:44 PM

Hi Sam,

Thanks for your response.
I solved this problem by changing it to ComRS232

And I am also able to send the signal using my XBee device now :) So It's all working fine.

Thanks.

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