Hello,
I'm working on a system which I have three Gill Windmaster Pros running at 32Hz on a CR1000X.
I currently have all three working, but on different com port pairs (C1/2, C3/4, C5/6). I'm having issues getting them all to work on the same com port pair (C1/2).
Does anyone have some advice on how I could get this to work based on my current code?
'Structure -- Constants/Variables/Units & Data Tables -- Program 'Current Devices 'Windmaster Pro A C1/2(GI-1561-PK-020/W) 'Windmaster Pro B C3/4 'Windmaster Pro C C5/6 PipeLineMode Const FAST_SCAN_INTERVAL = 32 'Scan at 32Hz Const SERIAL_BUFF_SIZE = 48*(Ceiling (32*FAST_SCAN_INTERVAL/1000))+48+1 'Minimum serial buffer size is 48 bytes/record * (Ceiling (32 records/second * SCAN_INTERVAL / 1000)) + 48 + 1 bytes. 'WindMaster Pro A data Public windA(5) Alias windA(1) = UxA Alias windA(2) = UyA Alias windA(3) = UzA Alias windA(4) = TsA Alias windA(5) = diag_3dA Units windA = m/s Units TsA = C Units diag_3dA = unitless Dim in_bytes_strA As String * 45 Dim nmbr_bytes_rtrndA Dim gill_checksum_flgA As Boolean Dim gill_disable_flgA As Boolean 'Windmaster A Data Table DataTable (ts_dataA,TRUE,-1) DataInterval (0,FAST_SCAN_INTERVAL,mSec,0) '32Hz TableFile ("CRD:WM_ts_dataA",64,-1,0,1,Hr,UxA,0)'New table each hour Sample (5,UxA,IEEE4) EndTable 'WindMaster Pro B data Public windB(5) Alias windB(1) = UxB Alias windB(2) = UyB Alias windB(3) = UzB Alias windB(4) = TsB Alias windB(5) = diag_3dB Units windB = m/s Units TsB = C Units diag_3dB = unitless Dim in_bytes_strB As String * 45 Dim nmbr_bytes_rtrndB Dim gill_checksum_flgB As Boolean Dim gill_disable_flgB As Boolean 'Windmaster B Data Table DataTable (ts_dataB,TRUE,-1) DataInterval (0,FAST_SCAN_INTERVAL,mSec,0) '32Hz TableFile ("CRD:WM_ts_dataB",64,-1,0,1,Hr,UxB,0)'New table each hour Sample (5,UxB,IEEE4) EndTable 'WindMaster Pro C data Public windC(5) Alias windC(1) = UxC Alias windC(2) = UyC Alias windC(3) = UzC Alias windC(4) = TsC Alias windC(5) = diag_3dC Units windC = m/s Units TsC = C Units diag_3dC = unitless Dim in_bytes_strC As String * 45 Dim nmbr_bytes_rtrndC Dim gill_checksum_flgC As Boolean Dim gill_disable_flgC As Boolean 'Windmaster C Data Table DataTable (ts_dataC,TRUE,-1) DataInterval (0,FAST_SCAN_INTERVAL,mSec,0) '32Hz TableFile ("CRD:WM_ts_dataC",64,-1,0,1,Hr,UxC,0)'New table each hour Sample (5,UxC,IEEE4) EndTable ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' BeginProg Scan (FAST_SCAN_INTERVAL,mSec,200,0) 'Windmaster '38400 bps, no parity, 8 data bits, 1 start bit, 1 stop bit, no flow control 'Windmaster Pro C SerialOpen (ComC1,38400,19,0,SERIAL_BUFF_SIZE) SerialInRecord (ComC1,in_bytes_strA,&H02,0,&H0D0A,nmbr_bytes_rtrndA,01) 'Capture all the data between the WindMaster Pro start of text (&h02) and the (&h0D0A). SplitStr (UxA,in_bytes_strA,"",5,0) 'Split the string and convert to floats. gill_checksum_flgA = ( (HexToDec (Right (in_bytes_strA,2))) EQV (CheckSum (in_bytes_strA,9,Len (in_bytes_strA)-3)) ) gill_disable_flgA = (NOT (gill_checksum_flgA) OR (nmbr_bytes_rtrndA=0) OR (diag_3dA<>0)) CallTable ts_dataA 'Windmaster Pro B SerialOpen (ComC3,38400,19,0,SERIAL_BUFF_SIZE) SerialInRecord (ComC3,in_bytes_strB,&H02,0,&H0D0A,nmbr_bytes_rtrndB,01) 'Capture all the data between the WindMaster Pro start of text (&h02) and the (&h0D0A). SplitStr (UxB,in_bytes_strB,"",5,0) 'Split the string and convert to floats. gill_checksum_flgB = ( (HexToDec (Right (in_bytes_strB,2))) EQV (CheckSum (in_bytes_strB,9,Len (in_bytes_strB)-3)) ) gill_disable_flgB = (NOT (gill_checksum_flgB) OR (nmbr_bytes_rtrndB=0) OR (diag_3dB<>0)) CallTable ts_dataB 'Windmaster Pro C SerialOpen (ComC5,38400,19,0,SERIAL_BUFF_SIZE) SerialInRecord (ComC5,in_bytes_strC,&H02,0,&H0D0A,nmbr_bytes_rtrndC,01) 'Capture all the data between the WindMaster Pro start of text (&h02) and the (&h0D0A). SplitStr (UxC,in_bytes_strC,"",5,0) 'Split the string and convert to floats. gill_checksum_flgC = ( (HexToDec (Right (in_bytes_strC,2))) EQV (CheckSum (in_bytes_strC,9,Len (in_bytes_strC)-3)) ) gill_disable_flgC = (NOT (gill_checksum_flgC) OR (nmbr_bytes_rtrndC=0) OR (diag_3dC<>0)) CallTable ts_dataC NextScan EndProg
Thanks!
Looks good so far. Why are you trying to use a single com port instead? At that speed, the data is guaranteed to collide and create unusable garbage.
Hi
It might work but I don't know if much slower. If I remember correctly, the windmaster can have an address and if the 3 windmasters have 3 different addresses, using the "POLLED" mode of returning data on request, each will respond only after being interrogated with its address.
Smile
To coexist on one comport, the sensors must be in RS485 half duplex mode.
The polled mode is often prefered when on the same comport as user smile stated.
The other option is to adjust to output message format to include the sensor address. Then you change the last parameter of SerialInRecord() to 101 for independent buffers. You would also need to change the BeginWord parameter to catch the appropriate sensor address.
Be aware that you might have to drop your output rate with them all on the same port, due to bandwidth limitations at 38,400 baud.