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.

sdm-sio1a module problem


uta May 31, 2017 12:46 PM

Hi

I use a SBE38 temperature sensor with RS232 (3 wire) communication with continous sampling (no poll).

My scan rate in a CR6 logger is 10sec

When I use the sdm-sio1a module I get wrong readings several times a day like this (comparison of string and float value of Temp1) - look at record number 6131, the string does not start where it should

TIMESTAMP RECORD Temp1float Temp1string

31.05.2017 07:02   6129    23.4713    23.4713

31.05.2017 07:02   6130    23.4703    23.4703

31.05.2017 07:03   6131    2               2 23.47

31.05.2017 07:03   6132    23.4665    23.4665

When I use the COMC1 input at the CR6 logger I do not see this problem.

Any idea what could be wrong at the sdm-sio1a?

Thanks and best regards,

Uta

part of my code:

SDMBeginPort (U5)
 
'Main Program
BeginProg
 Scan (Scaninterval,Sec,0,0)
   SW12 (1,1 )
   SW12 (2,1 )
   
  PanelTemp (PTemp,50)
  Battery (batt_volt)
  'Enter other measurement instructions
    TCDiff (Temp0,1,mV200c,U1,TypeT,PTemp,True,0,50,1.0,0)
    'SerialOpen (32,9600,64,0,168) ' 64 means 8N1 receive only, saves power
    'SerialFlush (32)
    SerialOpen (ComC1,9600,3,0,168)
    SerialFlush (ComC1)
    Delay (1,100,mSec)
    'SerialIn (Temp1string,32,100,&H0D0A,8)  'termination character CR LF
    'SerialClose (32)  'close port for power saving
    SerialIn (Temp1string,ComC1,100,&H0D0A,8)  'termination character CR LF
    'obs timeout should not be 0, this can lead to hang up
    Temp1float=Temp1string

.....


nsw Jun 5, 2017 11:00 AM

I guess that it is finding a last few characters from the previous string still in the buffer. Perhaps because of the timing of the sensor sending the string, that this arrived just after the buffer was flushed.

Look at using the SerialInRecord instead, which can have a start/end character, or end character and number of characters (if the string is ALWAYS the same length). SerialInRecord is more flexible as it has more options you can use.

If this does not work for you, you could look at using the string manipulation instructions, such as "RIGHT" or "MID", etc. on the TEMP1STRING to get a single numeric value.

 


uta Jun 6, 2017 06:41 AM

Thanks for your answer. I will look into SerialInRecord again. It is strange - I never got SerialInRecord working correctly so far. I didnt get in anything at all. Do yo have any tips how to use it for this case?

Best

Uta


nsw Jun 6, 2017 10:54 AM

What does the string from the SBE38 start with and end with? Is it always the same number of characters?

I.e., if it outputs 24.4703, all OK. But wants to output 24.4700 and sends 24.47, then the number of characters in the string change.

I guess it ends with CR+LF, as you have put in your program. Does it start with a specific character?

Knowing these things with the options in the SerialInRecord should get you going.


uta Jun 7, 2017 03:23 PM

I struggled again, even this seems to be quite simple for me.

At the end I found out that it works in pipeline mode. My CRBasic editor compiles in sequencial mode by default.

Is it correct that SerialInRecord only works in pipeline mode and is that the preferrred mode to use?

I got it going by using LF as starting and CR as ending word


nsw Jun 9, 2017 08:39 AM

SerialInRecord works in either PipeLineMode or Sequentialmode. I think it is probably a timing thing as PipeLineMode splits up all the measurement tasks and makes them happen at the same time every scan at the beginning. All processing tasks then follow after they have completed.


uta Jun 12, 2017 01:57 PM

Thanks for your help.

I found out that I have to put the SerialOpen before the Scan statement to get SerialInRecord working in sequential mode.

I had to use sequential mode due to some conditional loops in my final program.

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