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.

Interfacing VN-100 RS232 Sensor with CR800


PR Feb 21, 2012 11:07 PM

Hello,
I am trying to talk with the VN-100 by connecting
RX , Tx of the sensor to the Rx & Tx of datalogger.
I have set up baud rate of CR800 to 115200 & using below program,

Public Dest1 As String * 30

BeginProg
Scan (1,Sec,0,0)
SerialOpen (ComRS232,115200,0,5,1000)
SerialFlush (ComRS232)
SerialOut (ComRS232,"$VNRRG,5*46","",0,0) '$VNRRG,5*46 is a command that I need to give to the sensor in order to get value at the respective register of sensor.

SerialIn (Dest1,ComRS232,200,"",30)
SerialClose (ComRS232)
Next Scan
EndProg

I am getting nothing in the Dest1.

Thanks in advance!


Sam Feb 22, 2012 02:32 AM

cI would be curious to hear your results when using some of the following code snippets. With your code, I would think that even if you were receiving data, Dest1 would be overwritten the next second with nothing, making it hard for you to tell if you are getting something back.

Also I would be interested in hearing if you see the traffic expected when connecting to the loggers terminal (CR1000> prompt) to watch serial traffic using the "W" command.

--------------------------
Open Terminal
Hit enter until you get the CR1000 prompt
Select COMRS232
Accept default timeout
Accept default character display
--------------------------

Public Dest1 As String * 30
BeginProg
Scan (10,Sec,0,0)
SerialOpen (ComRS232,115200,0,5,1000)
SerialOut (ComRS232,"$VNRRG,5*46","",0,0)
SerialIn (Dest1,ComRS232,500,"",30)
SerialClose (ComRS232)
Next Scan
EndProg

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

Public Dest1 As String * 30
BeginProg
Scan (1,Sec,0,0)
SerialOpen (ComRS232,115200,0,5,1000)
SerialOut (ComRS232,"$VNRRG,5*46","",0,0)
If SerialInChk(ComRS232) Then
SerialIn (Dest1,ComRS232,500,"",30)
EndIf
SerialClose (ComRS232)
Next Scan
EndProg

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

Public Dest1 As String * 200
Const SerPort = ComRS232
BeginProg
SerialOpen (SerPort,115200,3,5,1000)
Scan (1,Sec,0,0)
SerialOut (SerPort,"$VNRRG,5*46","",0,0)
Delay (1,500,mSec)
If SerialInChk (SerPort) Then
SerialInBlock (SerPort,Dest1,200)
EndIf
Next Scan
EndProg


PR Feb 22, 2012 09:22 PM

Thank you for your reply.
I am still not getting anything in Dest1 for all code snippets that u gave.
I set check variable in the SerialInChk loop, check remains 0.

Public Dest1 As String * 200
Public Check
Const SerPort = Com1
BeginProg
SerialOpen (SerPort,115200,3,5,1000)
Scan (1,Sec,0,0)
SerialOut (SerPort,"$VNRRG,5*46","",0,0) Delay (1,500,mSec) If SerialInChk (SerPort) Then Check = 1 SerialInBlock (SerPort,Dest1,200) EndIf Next Scan EndProg


Thanks & Regards,
PR


Sam Feb 23, 2012 02:24 AM

And have you tried to watch the traffic?
An easy way to do that is to connect to the logger with a terminal (to a port other than COM1 in the last example you posted), hit enter a few times, enter W at the CR1000> prompt, select 9 for Com1, enter a timeout, and accept ASCII mode display.


PR Feb 24, 2012 10:33 PM

Yes I monitored the traffic this time with updated program

Public RawString As String * 500
Public NBytesReturned
Public SerialOutString As String * 13

BeginProg
SerialOpen (Com1,115200,16,0,100)
SerialOpen (Com2,115200,16,0,10000)
SerialOutString = "$VNRRG" & "," & "05*76" & CHR(10)
Scan (1,Sec,0,0)
SerialOutBlock (Com1,SerialOutString,13)
Delay (0,8,mSec)
SerialInRecord)Com2,RawString,36,0,42,NBytesReturned,01)
NextScan
EndProg

I can see the string gets transmitted by using "W" command but I did not see anything received on com2 when I use w Command.

Thank you for the help you did. It would be great if you guide me further more.


PR Feb 24, 2012 10:34 PM

Please do not mind the typo near SerialInRecord.

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