RCP stimulator: Difference between revisions

Line 15: Line 15:
* Channel 3 value (0-10000)
* Channel 3 value (0-10000)
* Channel 4 value (0-10000)
* Channel 4 value (0-10000)
* Value echoed back from received data


===Example Lua script to read serial data===
===Example Lua script to read serial data===

Revision as of 03:50, 6 January 2019


RS232 serial output

The stimulator will output the current Analog channel data on the serial port, which can be read by the Aux Serial input of RaceCapture/Pro.

Baud Rate

Baud rate is 115200, 8N1

Format

The output format is CSV with the following columns:

  • Timestamp in milliseconds
  • Channel 1 value (0-10000)
  • Channel 2 value (0-10000)
  • Channel 3 value (0-10000)
  • Channel 4 value (0-10000)
  • Value echoed back from received data

Example Lua script to read serial data

--initialize Aux serial port to 115200, 8, N, 1
initSer(6, 115200, 8, 0, 1)

setTickRate(10)

function onTick()
  --write something to be echoed back on last line
  writeSer(6, 'echo')
  --read a line from the aux serial port with a 100ms timeout
  value = readSer(6, 1000)
  if value ~= nil and value ~= '' then
    print('read value: ' ..value)
  end
end

Stimulator serial data script.png

Example Raw output stream from Stimulator

38817 ,0,0,0,0
39017 ,0,0,0,0
39217 ,0,0,0,0
39417 ,0,0,0,0
39617 ,0,0,0,0
39817 ,0,0,0,0
40017 ,0,0,0,0
40217 ,0,0,0,0
40417 ,0,0,0,0
40617 ,0,0,0,0
40817 ,0,0,0,0
41017 ,302,0,0,0
41217 ,1110,0,0,0
41417 ,1940,0,0,0
41617 ,1943,0,0,0
41817 ,1943,0,0,0
42017 ,1940,0,0,0
42217 ,1942,717,0,0
42417 ,1935,1321,0,0
42617 ,1935,1363,0,0
42817 ,1938,1363,0,0
43017 ,1940,1363,0,0
43217 ,1937,1362,795,0
43417 ,1938,1360,1478,0
43617 ,1939,1362,1473,0
43817 ,1938,1360,1477,0
44017 ,1937,1358,1477,0
44217 ,1938,1360,1476,513
44417 ,1934,1359,1477,1482
44617 ,1938,1360,1474,1489