forked from bruceme/PHEVCU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPHEVCU.BAS
33 lines (33 loc) · 1.14 KB
/
PHEVCU.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
100 PRINT "PHEVCU program - Display messages PHEVCU will filter"
100 PRINT "under GPLv3 license by Plug-In Hybrid Electric Control Unit Project, PHEVCU (c) 2012"
110 PRINT " "
120 REM declare variables for message reception
130 DIM rxId : DIM rxType : DIM rxLen : DIM rxData(8) : DIM rxOk
140 REM set CAN baudrate to 500 kbps and connect to the CAN bus
150 CANOPEN 500000
160 REM start the program loop
170 DO
180 REM quit program when user pressed 'q'
190 IF INKEY$ = "q" THEN EXIT
200 REM check if a message was received
210 CANRCV rxId, rxType, rxLen, rxData(0), rxOk
220 IF rxOk = 1 THEN
230 REM process message data
240 id$ = HEX$(rxId)
245 IF (id$ <> 840) THEN LOOP
250 IF rxType = 0 THEN type$ = "STD" ELSE type$ = "EXT"
260 len$ = STR$(rxLen)
270 d0$ = HEX$(rxData(0))+SPACE$(1)
280 d1$ = HEX$(rxData(1))+SPACE$(1)
290 d2$ = HEX$(rxData(2))+SPACE$(1)
300 d3$ = HEX$(rxData(3))+SPACE$(1)
310 d4$ = HEX$(rxData(4))+SPACE$(1)
320 d5$ = HEX$(rxData(5))+SPACE$(1)
330 d6$ = HEX$(rxData(6))+SPACE$(1)
340 d7$ = HEX$(rxData(7))+SPACE$(1)
350 REM display the message
360 PRINT id$,type$,len$,d0$;d1$;d2$;d3$;d4$;d5$;d6$;d7$
370 ENDIF
380 LOOP
390 CANCLOSE
400 END