'Main Program
BeginProg
'Open COMport with RS-485 communications at 115200 baud rate
SerialOpen (ComC1,115200,16,0,50,3)
'Read 3 sensors in MEMS String every 10 seconds
Scan (10,Sec,0,0)
'Loop through addresses of connected String
For Count = 1 To 3
'Reset temporary storage for both Degrees and Temp so not to retain
'previous reading
A_Axis_Degrees(Count) = 0
B_Axis_Degrees(Count) = 0
Celsius(Count) = 0
'Flush Serial between readings
SerialFlush (ComC1)
'Write to register 0x118 to trigger string
NOTE: ModbusMaster won't send 0x118 unless "&H119" is entered
ModbusMaster (ErrorCode,ComC1,115200,Count,6,1,&H119,1,1,10,0)
'Delay after write register
Delay (1,1,Sec)
'Use Modbus command to retrieve A Axis and B Axis Degree Readings
ModbusMaster (ErrorCode,ComC1,115200,Count,3,A_Axis_Degrees(Count),&H101,1,1,10,0)
ModbusMaster (ErrorCode,ComC1,115200,Count,3,B_Axis_Degrees(Count),&H103,1,1,10,0)
'Use Modbus command to retrieve Thermistor Celsius from string
ModbusMaster (ErrorCode,ComC1,115200,Count,3,Celsius(Count),&H107,1,1,10,0)
'Delay before proceeding to next reading
Delay (1,1,Sec)
Next
'Call Table to store Data
CallTable Test
NextScan
EndProg
INCLINÓMETRO DIGITAL DIRECCIONABLE FIJO CON MEMS MODELO 6150E
PROGRAMACIÓN EN CRBASIC
|
|
21