Advertisement
blossomed

Roboteq CAN-channel data reading and microbasic script

Jan 25th, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. SetConfig(_CBR, 3) ' set baud to 250k
  2. SetConfig(_CHB, 100) ' set hearbeat to 100ms
  3. SetConfig(_CNOD, 0x27) ' set roboteq node source address to 0x27
  4.  
  5. ' -- Tried using both RawCAN and MiniJ1939 (I had CAN connected and was able to read extended ID inclinometer sensor data, roboteq heartbeat and 4 other messages and send standard IDs with Vector CANalyzer)
  6. 'SetConfig(_CEN, 5) ' set mode to MiniJ1939 (ability to read extended IDs) and enable CAN
  7. 'SetConfig(_CEN, 3) ' set mode to RawCAN (read standard IDs, use _CF and _CAN) and enable CAN
  8.  
  9. loop:
  10.  
  11. If (GetValue(_CF, 1) > 0) Then
  12. print("Byte 1: ", GetValue(_CAN, 3), "\n")
  13. print("Byte 2: ", GetValue(_CAN, 4), "\n")
  14. receivedCAN = TRUE
  15. End If
  16.  
  17. ' -- Activate LED light if we managed to read CAN (light does not activate)
  18. If (receivedCAN) Then
  19. SetCommand(_DSET, 2)
  20. Else
  21. SetCommand(_DRES, 2)
  22. End If
  23.  
  24. wait(CONST_CYCLE_TIME)
  25. goto loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement