CAN Bus logger: Difference between revisions

No edit summary
Line 7: Line 7:


* Close the RaceCapture app
* Close the RaceCapture app
* Connect to the RaceCapture device using HyperTermianl, RealTerm or Minicom using the COM port assigned by the operating system.
* Connect to the RaceCapture device using HyperTerminal, RealTerm or Minicom using the COM port assigned by the operating system.
* Press <Enter> to see a list of commands
* Press <Enter> to see a list of commands
* View the log by issuing the command 'viewLog' at the serial console.
* View the log by issuing the command 'viewLog' at the serial console.

Revision as of 22:28, 13 March 2015

The following script will output all CAN bus messages received on CAN channel 1 to the RaceCapture/Pro log window.

After writing the script, you can observe the output in the log monitor window in the RaceCapture app.

Using a Terminal Program

However, to gather large amounts of data, we recommend connecting directly to RaceCapture/Pro's serial console using a terminal program like Hyperterminal, RealTerm, minicom or similar.

  • Close the RaceCapture app
  • Connect to the RaceCapture device using HyperTerminal, RealTerm or Minicom using the COM port assigned by the operating system.
  • Press <Enter> to see a list of commands
  • View the log by issuing the command 'viewLog' at the serial console.
  • You will see a dump of the CAN bus data to the screen.


--500K baud. set your baud rate here.
initCAN(0, 500000) 

setTickRate(30)  --onTick() will be called at 30Hz.

--this function drains all pending CAN messages
--and outputs messages to the log
function outputCAN()
	repeat 
		id, ext, data = rxCAN(0, 100)
		if id ~= nil then
			print(id ..', ')
			for i = 1,#data do
				print(data[i] ..', ')
			end
			println('')
		end
	until id == nil
end
 
function onTick()
	outputCAN()
end