RCP stimulator: Difference between revisions
Line 25: | Line 25: | ||
function onTick() | function onTick() | ||
--write something to be echoed back | --write something to be echoed back | ||
writeSer(6, 'echo') | writeSer(6, 'echo') | ||
--read a line from the aux serial port with a 100ms timeout | --read a line from the aux serial port with a 100ms timeout |
Revision as of 03:51, 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 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
Example Raw output stream from Stimulator
352023 ,0,0,0,0,echo 352223 ,0,0,0,0,echo 352423 ,0,0,0,0,echo 352623 ,0,0,0,0,echo 352823 ,0,0,0,0,echo 353023 ,0,0,0,0,echo 353223 ,275,0,0,0,echo 353423 ,1680,0,0,0,echo 353623 ,1680,0,0,0,echo 353823 ,1680,0,0,0,echo 354023 ,1672,0,0,0,echo 354223 ,1697,1181,0,0,echo 354423 ,1699,2666,0,0,echo 354623 ,1704,2649,0,0,echo 354823 ,1706,2656,0,0,echo 355023 ,1692,2647,0,0,echo 355223 ,1728,4554,0,0,echo 355423 ,1724,4595,0,0,echo 355623 ,1741,4588,0,0,echo 355823 ,1753,4590,1199,0,echo 356023 ,1750,4588,1323,0,echo 356223 ,1755,4588,4730,0,echo 356423 ,1750,4588,4984,0,echo 356623 ,1758,4586,4981,0,echo 356823 ,1750,4583,4959,1299,echo 357023 ,1758,4586,4964,4129,echo 357223 ,1758,4588,4947,4473,echo 357423 ,1753,4586,4957,5269,echo 357623 ,1753,4586,4957,5768,echo