'changes ' v. 2015-09-25 - fix scramble of screen when iso ' v. 2014-09-05 - add economy bar displaying wh/km from 0 to 600 Wh/km ' v. 2013-08-09 - bug fixing scrolling of rows, spacing, overlapping of values ' v. 2013-08-04 - bug fixing error/warning reports ' v. 2013-08-03 - add Pad function to fill a string with spaces until end of screen ' v. 2013-08-02 - move failed cells number to general warnings function Dim sndvolts: Dim sndcurrent Dim rqpower ' power percent Dim ok Dim baseId Dim isAutoScreen Dim screen Dim page Dim lastdod Dim lastdodtime Dim numberOfCalcs Dim showWE Dim curIndex Dim curPrintedIndex Dim showTick Dim lastPrintTimer Dim ecoNow: Dim ecoAvgTrip: Dim ecoCountTrip: Dim ecoAvgAll: Dim ecoCountAll '23 RCM Dim _rcm_event_notification Dim _rcm_fuel_cut_off '210 ABS Dim _desired_torque_cmd Dim _torque_type Dim _ebd_available Dim _abs_available Dim _pcm_tyre_unes_in_calc Dim _ebd_failed Dim _abs_enabled_by_user Dim _abs_event Dim _abs_failed Dim _brake1_counter '263 PCU Dim _pcu_voltage Dim _vehicle_speed Dim _pcu_ambient_temp Dim _mains_voltage Dim _mains_current '264 Dim _shiftermessage$ '267 PCU Dim _traction_enabled Dim _brake_active Dim _pcu_emergency Dim _gear_drive Dim _gear_economy Dim _gear_reverse Dim _gear_parking Dim _hand_brake_active Dim _regenerative_enabled Dim _battery_under_charge Dim _ignition_key Dim _reset_alarm Dim _trigger_monitor Dim _eeprom_save_failed Dim _eeprom_wrong_data Dim _motor_not_fluxed Dim _power_fault Dim _temperature_inverter Dim _temperature_motor Dim _motor_thermic_protection Dim _test_connection_not_finished Dim _external_alarm Dim _overspeed Dim _under_voltage_power_circuit Dim _over_voltage_power_circuit Dim _internal_alarm Dim _precharge_error Dim _wrong_connection_phase_uvw Dim _wrong_motor_setting Dim _powertrain_ready Dim _speed_below_p50 Dim _parking_system_activated Dim _parking_system_deactivated Dim _cooling_fan_activated Dim _500hz_for_power_steering Dim _reverse_light_signal Dim _stop_light_signal '300 Init string Dim _sw_version Dim _sw_revision Dim _sw_id1 Dim _sw_id2 Dim _sw_id3 Dim _hw_version Dim _init_successfull '301 BMI Dim _dccurrent Dim _dcvoltage Dim _dod Dim _temperature Dim _dcpower '302 BMI Dim _err_general Dim _iso_error Dim _volts_min_discharge Dim _amps_max_discharge '303 BMI Dim _max_charge_current Dim _max_charge_voltage Dim _vehicle_charge_enabled Dim _regen_brake_enabled Dim _discharge_enabled Dim _fast_charge_enabled Dim _dc_dc_enabled Dim _ac Dim _number_released_batteries Dim _reduced_number_of_batteries Dim _emergency Dim _crash Dim _fan_status Dim _soc_greater_102 Dim _iso_test_flag Dim _waiting_temp_err '304 BMI Dim _sys_voltage_max_generator Dim _sys_high_est_err_cat Dim _sys_eoc Dim _reach_eoc_please Dim _waiting_ok_temp_charge Dim _too_many_failed_cells Dim _ac_heater_relay_status Dim _ac_heater_switch_status Dim _t1 Dim _t2 '305 BMI Dim _charger_pwm_cmd Dim _sys_bmi_state Dim _sys_int_iso_error Dim _sys_ext_iso_error Dim _battery_charge_en Dim _ocv_meas_in_progress Dim _no_charge_current Dim _charge_overvoltage Dim _charge_overcurrent Dim _battery_type Dim _number_of_failed_cells Dim _sys_bmi_temp_error Dim _sys_zebra_temp_error Dim _sys_thermal_iso_error Dim _waiting_ok_temp_discharge '310 PCU Dim _request_data Dim _broadcast_mode Dim _change_mode_request Dim _charger_status Dim _tim_status 'traction inverter module Dim _dcdc_status Dim _pcu_fault '311 PCU Dim _battery_charge_request Dim _vehicle_charge_request Dim _fast_charge_request Dim _max_available_AC '460 RCM Dim _rcm_rm_seatbelt_status Dim _rcm_rr_seatbelt_status Dim _rcm_rl_seatbelt_status Dim _rcm_pass_seatbelt_status Dim _rcm_driver_seatbelt_status Dim _rcm_seatbelt_status_valid Dim _rcm_ril_request_status Dim _rcm_seatbelt_indicator Dim _rcm_seatbelt_chime Dim _rcm_airbag_warning_chime '4B0 ABS Dim _front_left_wheel_speed Dim _front_right_wheel_speed Dim _rear_left_wheel_speed Dim _rear_right_wheel_speed Sub charconfig CAN CONFIG ok : CAN SETSPEED 500000, ok CAN ADDTXCHNL 0,1,ok ' sending commands &H2FF CAN ADDRXCHNL 1, &h301, 0, 1, ok ' bmi 1 - 301 CAN ADDRXCHNL 2, &h302, 0, 1, ok ' bmi 2 - 302 CAN ADDRXCHNL 3, &h303, 0, 1, ok ' bmi 3 - 303 CAN ADDRXCHNL 4, &h263, 0, 1, ok ' pcu general CAN ADDRXCHNL 5, &h304, 0, 1, ok ' bmi 4 - 304 CAN ADDRXCHNL 6, &h305, 0, 1, ok ' bmi 5 - 305 CAN ADDRXCHNL 7, &h311, 0, 1, ok ' pcu max charge current - 311 CAN ADDRXCHNL 8, &h264, 0, 1, ok ' gear shifter position CAN ADDRXCHNL 9, &h310, 0, 1, ok ' pcu status CAN ADDRXCHNL 10, &h300, 0, 1, ok ' init string CAN ADDRXCHNL 11, &h267, 0, 1, ok ' pcu transmission CAN ADDRXCHNL 12, &h23, 0, 1, ok ' rcm event CAN ADDRXCHNL 13, &h460, 0, 1, ok ' rcm status CAN ADDRXCHNL 14, &h210, 0, 1, ok ' abs brake 1 CAN ADDRXCHNL 15, &h4B0, 0, 1, ok ' abs brake 2 CAN ENABLE ok : Cls : Font 1 : CAN PRINTCONFIG Pause 1000 : Cls End Sub Sub fileconfig End Sub Sub IfPrint( flag, message$) If (flag) Then Print "* ";message$ EndIf End Sub Sub IfPrintDec( code, message$) If (code <> 0) Then Print "* ";message$; " "; code EndIf End Sub Sub updateScreen Font 1 Locate 0,0 If (page=6) Then PrintDrivePage ElseIf (page=7) Then PrintChargePage ElseIf (page=8) Then PrintDiagnosticsPage Else PrintStandByPage EndIf End Sub Sub PrintDiagnosticsPage Local voffset voffset = 12 Font 1 Print @(000,(00+voffset)) "BMI" Print " Software ver."; _sw_version; " rev."; _sw_revision; " Id.";_sw_id1; _sw_id2; _sw_id3 Print " Hardware ver."; _hw_version; " Init Successfull"; _init_successfull Print " Batteries Avail."; _number_released_batteries; " "; Batteries$(_reduced_number_of_batteries) Print _number_of_failed_cells; " Failed Cells "; Failed_cells$(_too_many_failed_cells) Print " Emergency"; _emergency; " Crash";_crash; " Battery Type"; _battery_type Print " General Err."; _err_general; " Thermal Iso. Err."; _sys_thermal_iso_error Print " Iso Test"; _iso_test_flag; ; " Iso. Err."; _iso_error Print " Int. Iso. Err."; _sys_int_iso_error; " Ext. Iso. Err."; _sys_ext_iso_error Print " BMI Temp. Err."; _sys_bmi_temp_error; " Wait Temp. Err."; _waiting_temp_err Print " Temperature 1"; _t1; "C"; " Temperature 2"; _t2; "C" Print " AC present"; _ac Print " Heater relay"; _ac_heater_relay_status; " Heater switch"; _ac_heater_switch_status Print " Battery Cooling Fan"; _fan_status; " SOC > 102"; _soc_greater_102 Print " " Print _dccurrent; "A"; _dcvoltage; "V"; _dod; "%"; _temperature; "C"; _dcpower; "kW " Print " Discharge limits "; _volts_min_discharge; "V"; _amps_max_discharge; "A " Print " Wait Temp. Discharge"; _waiting_ok_temp_discharge Print " Discharge En."; _discharge_enabled Print " DC-DC En."; _dc_dc_enabled"; Vehicle Charge En."; _vehicle_charge_enabled Print " " Print " Error-category "; BMIerrcat$(_sys_high_est_err_cat) Print " BMI-status "; BMIstate$(_sys_bmi_state) Print " Batt. Temp. Err. "; ZebraTempErr$(_sys_zebra_temp_error) Print " " Print " Charge limits "; _max_charge_voltage; "V"; _max_charge_current; "A " Print " Max Generator Limit"; _sys_voltage_max_generator; "V" Print " Regen. Brake En."; _regen_brake_enabled Print " Fast Charge En."; _fast_charge_enabled Print " Batt. charge En."; _battery_charge_en; " Charger PWM "_charger_pwm_cmd; "%" Print " Wait Temp. Charge"; _waiting_ok_temp_charge Print " No Charge Curr."; _no_charge_current; " Reach EOC"; _reach_eoc_please Print " Charge Over Voltage"; _charge_overvoltage Print " Charge Over Curr."; _charge_overcurrent Print " OCV Messurement"; _ocv_meas_in_progress; " End Off Charge"; _sys_eoc 'Print "Traction Inverter" 'Print _traction_enabled; _brake_active; _pcu_emergency; 'Print _gear_drive; _gear_economy; _gear_reverse; _gear_parking; _hand_brake_active Print @(240,(00+voffset)) "PCU" Print @(240,(12+voffset)) " Req. Data"; _request_data; " Broadcast Mode"; _broadcast_mode Print @(240,(24+voffset)) " Change Mode Req."; change_mode_request; " PCU communication" Print @(240,(36+voffset)) " Charger Status"; _charger_status; " TIM Status"; _tim_status Print @(240,(48+voffset)) " DC-DC Status"; _dcdc_status; " PCU Fault"; _pcu_fault Print @(240,(60+voffset)) _pcu_voltage; "V "; _vehicle_speed; "Km/t. "; _pcu_ambient_temp; "C " Print @(240,(72+voffset)) " Mains"_mains_voltage; "V";_mains_current; "A "; "Max. avail. Curr."; _max_available_AC; "A " Print @(240,(84+voffset)) " Batt. Charge Req."; _battery_charge_request; Print @(240,(96+voffset)) " Vehicle Charge Req."; _vehicle_charge_request Print @(240,(108+voffset)) " Fast Charge Req."; _fast_charge_request Print @(240,(120+voffset)) "RCM" Print @(240,(132+voffset)) " Airbag ";_rcm_event_notification; " Fuel cut off"; _rcm_fuel_cut_off Print @(240,(144+voffset)) _rcm_rm_seatbelt_status; _rcm_rr_seatbelt_status; _rcm_rl_seatbelt_status; Print _rcm_pass_seatbelt_status; _rcm_driver_seatbelt_status; _rcm_seatbelt_status_valid; " Seatbelt Status" Print @(240,(156+voffset)) " Seatbelt Indicator"; _rcm_seatbelt_indicator; " Seatbelt Chime"; _rcm_seatbelt_chime; Print @(240,(168+voffset)) " Airbag warning"; _rcm_airbag_warning_chime Print @(240,(180+voffset)) " RIL req. Status "; RILRequest$(_rcm_ril_request_status) Print @(240,(192+voffset)) "ABS Brake 1" Print @(240,(204+voffset)) " Torque Type "; ABStorquetype$(_torque_type); _desired_torque_cmd; "Nm" Print @(240,(216+voffset)) " EBD available"; _ebd_available; " ABS available"; _abs_available Print @(240,(228+voffset)) _pcm_tyre_unes_in_calc; _ebd_failed; _abs_enabled_by_user; _abs_event; _abs_failed Print @(240,(240+voffset)) _brake1_counter; " Counter " Print @(240,(252+voffset)) "ABS Brake 2" Print @(240,(264+voffset)) " Front Left Wheel Speed "; _front_left_wheel_speed; " Km./t." Print @(240,(276+voffset)) " Front Right Wheel Speed"; _front_right_wheel_speed; " Km./t." Print @(240,(288+voffset)) " Rear Left Wheel Speed "; _rear_left_wheel_speed; " Km./t." Print @(240,(300+voffset)) " Rear Right Wheel Speed "; _rear_right_wheel_speed; " Km./t." End Sub Sub SetTestValues _sw_version = 3 _sw_revision = 11 _sw_id1 = 14 _sw_id2 = 77 _sw_id3 = 68 _hw_version = 2 _init_successfull = 1 _dccurrent = 120.2 _dcvoltage = 370.2 _dcpower = 23.34 _temperature = 275.45 _too_many_failed_cells = 0 _vehicle_speed = 34.21 _soc_greater_102 = 1 _iso_test_flag = 0 _waiting_temp_err = 1 _ocv_meas_in_progress = 1 _no_charge_current = 0 _charge_overvoltage = 0 _charge_overcurrent = 1 _sys_bmi_temp_error = 1 _sys_zebra_temp_error = 3 _sys_thermal_iso_error = 0 _waiting_ok_temp_discharge = 1 _number_of_failed_cells = 5 End Sub Sub PrintVersion Font 1 Print "2013-08-09" End Sub Function Pad$( message$) Local meslen Local padding$ meslen = Len(message$) If (meslen < 40) Then padding$ = Space$(40-meslen) Else padding$ = "" EndIf Pad$ = message$ + padding$ End Function Function IfPrint4( index, nextIndex, flag, message$) If (flag <> 0) And (curIndex = index) And (curPrintedIndex < curIndex) Then Font 1 Print Pad$("* "+message$+" *") IfPrint4 = 1 ' true curPrintedIndex = index Else IfPrint4 = 0 ' false EndIf curIndex = nextIndex End Function Function IfPrintDec4( index, nextIndex, code, message$) If (code <> 0) And (curIndex = index) And (curPrintedIndex < curIndex) Then Font 1 Print Pad$("* "+message$+": "+Str$(code)+" *") IfPrintDec4 = 1 ' true curPrintedIndex = index Else IfPrintDec4 = 0 ' false EndIf curIndex = nextIndex End Function Function BMIerrcat$(highest_err_cat) If (highest_err_cat = 0) Then BMIerrcat$ = "No error " If (highest_err_cat = 1) Then BMIerrcat$ = "Statistic " If (highest_err_cat = 2) Then BMIerrcat$ = "Notice " If (highest_err_cat = 3) Then BMIerrcat$ = "Delayed switch off" If (highest_err_cat = 4) Then BMIerrcat$ = "Switch off " End Function Function BMIstate$(statenumber) If (statenumber = 0) Then BMIstate$ = "Park " If (statenumber = 1) Then BMIstate$ = "Discharge " If (statenumber = 2) Then BMIstate$ = "Ready to charge " If (statenumber = 3) Then BMIstate$ = "Charging in progress " If (statenumber = 4) Then BMIstate$ = "OCV mess. in progress " If (statenumber = 5) Then BMIstate$ = "Charge complete " If (statenumber = 6) Then BMIstate$ = "Batt. temp. low, heating " If (statenumber = 7) Then BMIstate$ = "Batt. temp. high, cooling" If (statenumber = 8) Then BMIstate$ = "Power up " If (statenumber = 9) Then BMIstate$ = "TBD 9 " If (statenumber = 10) Then BMIstate$ = "TBD 10 " If (statenumber = 11) Then BMIstate$ = "TBD 11 " If (statenumber = 12) Then BMIstate$ = "TBD 12 " If (statenumber = 13) Then BMIstate$ = "TBD 13 " If (statenumber = 14) Then BMIstate$ = "TBD 14 " If ((statenumber = 15)And(_sys_high_est_err_cat = 3)) Then BMIstate$ = "Fault, delayed switch off" If ((statenumber = 15)And(_sys_high_est_err_cat = 4)) Then BMIstate$ = "Fault, switch off " End Function Function Failed_cells$(cells_failed) If (cells_failed = 0) Then Failed_cells$ = "=<10% failed cells" If (cells_failed = 1) Then Failed_cells$ = ">10% failed cells " End Function Function Batteries$(released_batteries) If (released_batteries = 0) Then Batteries$ = "All Batt. Avail " If (released_batteries = 1) Then Batteries$ = "Nr. Batt. reduced" End Function Function ZebraTempErr$(temp_error) If (temp_error = 0) Then ZebraTempErr$ = "OK " If (temp_error = 1) Then ZebraTempErr$ = "Power Limit Temp " If (temp_error = 3) Then ZebraTempErr$ = "Full Power Limit Temp" End Function Function ABStorquetype$(torque_type) If (torque_type =0) Then ABStorquetype$ = "Powertrain Torque" If (torque_type =1) Then ABStorquetype$ = "Engine Torque " End Function Function RILRequest$(ril_status) If (ril_status = 0) Then RILRequest$ = "RIL Request off " If (ril_status = 2) Then RILRequest$ = "RIL Request Plant Mode" If (ril_status = 3) Then RILRequest$ = "RIL Request on " End Function Function getSChar(lo) Local result result = lo If (result > &H80) Then result = result - &HFF getSChar = result End Function Function getS12(hi, lo) Local result result = (hi * 256) + lo If (result > &H8000) Then result = result - &HFFFF getS12 = result End Function Function getU16(hi, lo) getU16 = (hi*256) + lo End Function Function getLSB(myval) getLSB = myval And &H00FF End Function Function getMSB(myval) getMSB = myval \ &B100000000 End Function Sub getcandata() Local rxData(8) : Local rxOk CAN RX 1,rxData(0),rxOk : ' H301 - bmi 1 If (rxOk=1) Then _dccurrent = getS12(rxData(0),rxData(1))/10 _dcvoltage = getU16(rxData(2),rxData(3))/10 _dod = getU16(rxData(4),rxData(5))/10 _temperature = getU16(rxData(6),rxData(7))/10 _dcpower = (_dcvoltage*_dccurrent)/1000 EndIf CAN RX 2,rxData(0),rxOk : ' H302 - bmi 2 If (rxOk=1) Then _err_general= ((rxData(0) And &H01) = &H01) _iso_error=((rxData(2) And &H01) = &H01) _volts_min_discharge=getU16(rxData(4),rxData(5))/10 _amps_max_discharge=getU16(rxData(6),rxData(7))/10 EndIf CAN RX 3,rxData(0),rxOk : ' H303 - bmi 3 If (rxOk=1) Then _max_charge_voltage=getU16(rxData(0),rxData(1))/10 _max_charge_current=getU16(rxData(2),rxData(3))/10 _vehicle_charge_enabled = ((rxData(4) And &H01) = &H01) _regen_brake_enabled = ((rxData(4) And &H02) = &H02) _discharge_enabled = ((rxData(4) And &H04) = &H04) _fast_charge_enabled = ((rxData(4) And &H08) = &H08) _dc_dc_enabled = ((rxData(4) And &H10) = &H10) _ac = ((rxData(4) And &H20) = &H20) _number_released_batteries = rxData(5) _reduced_number_of_batteries = ((rxData(6) And &H01) = &H01) _emergency = ((rxData(6) And &H08) = &H08) _crash = ((rxData(6) And &H10) = &H10) _fan_status = ((rxData(6) And &H20) = &H20) _soc_greater_102 = ((rxData(6) And &H40) = &H40) _iso_test_flag = ((rxData(6) And &H80) = &H80) _waiting_temp_err = ((rxData(7) And &H01) = &H01) EndIf CAN RX 4,rxData(0),rxOk : ' H263 - pcu general If (rxOk=1) Then _pcu_voltage = rxData(3) / 10 _vehicle_speed = rxData(5) / 2 _pcu_ambient_temp = getSChar(rxData(2)) / 2 _mains_voltage = rxData(1) ' mains voltage _mains_current = rxData(0) * 2 / 10 ' mains current EndIf CAN RX 5,rxData(0),rxOk : ' H304 - bmi general If (rxOk=1) Then _sys_voltage_max_generator=getU16(rxData(0),rxData(1))/10 _sys_high_est_err_cat=rxData(2) _sys_eoc=((rxData(3) And &H01)=&H01) _reach_eoc_please=((rxData(3) And &H02)=&H02) _waiting_ok_temp_charge=((rxData(3) And &H04)=&H04) _too_many_failed_cells=((rxData(3) And &H08)=&H08) _ac_heater_relay_status=((rxData(3) And &H10)=&H10) _ac_heater_switch_status=((rxData(3) And &H20)=&H20) _t1=getU16(rxData(4),rxData(5))/10 _t2=getU16(rxData(6),rxData(7))/10 EndIf CAN RX 6,rxData(0),rxOk : ' H305 - general If (rxOk=1) Then _charger_pwm_cmd=getU16(rxData(0),rxData(1))/10 _sys_bmi_state=(rxData(2) And &H0F) * 1 ' todo - add mask of F _sys_int_iso_error=((rxData(2) And &H10)=&H10) _sys_ext_iso_error=((rxData(2) And &H20)=&H20) _battery_charge_en=((rxData(3) And &H01)=&H01) _ocv_meas_in_progress=((rxData(3) And &H02)=&H02) _no_charge_current=((rxData(3) And &H04)=&H04) _charge_overvoltage=((rxData(3) And &H08)=&H08) _charge_overcurrent=((rxData(3) And &H10)=&H10) _battery_type=(rxData(3) And &HE0) * 0.03125 ' todo - mask with 224 _number_of_failed_cells = getU16(rxData(4),rxData(5)) _sys_bmi_temp_error = (rxData(6) And &H06) / 2' todo - mask with 6 _sys_zebra_temp_error = (rxData(6) And &H18) / 8 ' todo - mask with 24 _sys_thermal_iso_error = ((rxData(6) And &H20) = &H20) _waiting_ok_temp_discharge = ((rxData(6) And &H40) = &H40) EndIf CAN RX 7,rxData(0),rxOk : ' H311 - PCU If (rxOk=1) Then _fast_charge_request = ((rxData(0) And &H01) = &H01) _vehicle_charge_request = ((rxData(0) And &H02) = &H02) _battery_charge_request = ((rxData(0) And &H04) = &H04) _max_available_AC = rxData(1) * 0.2 EndIf CAN RX 8,rxData(0),rxOk : ' H264 - gear shifter If (rxOk=1) Then _shiftermessage$ = Hex$(rxData(0)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(1)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(2)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(3)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(4)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(5)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(6)) _shiftermessage$ = _shiftermessage$ + Hex$(rxData(7)) EndIf CAN RX 9,rxData(0),rxOk : ' H310 - PCU If (rxOk=1) Then _change_mode_request = ((rxData(0) And &H01) = &H01) _broadcast_mode = ((rxData(0) And &H02) = &H02) _request_data = ((rxData(0) And &H04) = &H04) _pcu_fault = ((rxData(2) And &H01) = &H01) _dcdc_status = ((rxData(2) And &H02) = &H02) _tim_status = ((rxData(2) And &H04) = &H04) _charger_status = ((rxData(2) And &H08) = &H08) EndIf CAN RX 10,rxData(0),rxOk : ' H300 - BMI If (rxOk=1) Then _sw_version = rxData(0) _sw_revision = rxData(1) _sw_id1 = rxData(2) _sw_id2 = rxData(3) _sw_id3 = rxData(4) _hw_version = rxData(5) _init_successfull = rxData(6) EndIf CAN RX 11,rxData(0),rxOk : ' H267 Traction Inverter If (rxOk=1) Then _traction_enabled = ((rxData(0) And &H80) = &H80) _brake_active = ((rxData(0) And &H40) = &H40) _pcu_emergency = ((rxData(0) And &H20) = &H20) _gear_drive = ((rxData(0) And &H10) = &H10) _gear_economy = ((rxData(0) And &H08) = &H08) _gear_reverse = ((rxData(0) And &H04) = &H04) _gear_parking = ((rxData(0) And &H02) = &H02) _hand_brake_active = ((rxData(0) And &H01) = &H01) EndIf CAN RX 12,rxData(0),rxOk : ' H23 RCM If (rxOk=1) Then _rcm_event_notification = ((rxData(0) And &H80) = &H80) _rcm_fuel_cut_off = ((rxData(0) And &H60) / 32) EndIf CAN RX 13,rxData(0),rxOk : ' H460 RCM If (rxOk=1) Then _rcm_rm_seatbelt_status = ((rxData(0) And &H02) = &H02) _rcm_rr_seatbelt_status = ((rxData(0) And &H01) = &H01) _rcm_rl_seatbelt_status = ((rxData(1) And &H80) = &H80) _rcm_pass_seatbelt_status = ((rxData(1) And &H40) = &H40) _rcm_driver_seatbelt_status = ((rxData(1) And &H20) = &H20) _rcm_seatbelt_status_valid = ((rxData(1) And &H10) = &H10) _rcm_ril_request_status = ((rxData(4) And &HC0) / 64) _rcm_seatbelt_indicator = ((rxData(4) And &H02) = &H02) _rcm_seatbelt_chime = ((rxData(4) And &H01) = &H01) _rcm_airbag_warning_chime = ((rxData(7) And &H80) = &H80) EndIf CAN RX 14,rxData(0),rxOk : ' H210 ABS Brake 1 If (rxOk=1) Then _desired_torque_cmd = (getU16(rxData(0),rxData(1)) + 512) _torque_type = ((rxData(2) And &H80) = &H80) _ebd_available = ((rxData(2) And &H20) = &H20) _abs_available = ((rxData(2) And &H10) = &H10) _pcm_tyre_unes_in_calc = ((rxData(3) And &H80) = &H80) _ebd_failed = ((rxData(3) And &H40) = &H40) _abs_enabled_by_user = ((rxData(3) And &H20) = &H20) _abs_event = ((rxData(3) And &H10) = &H10) _abs_failed = ((rxData(3) And &H08) = &H08) _brake1_counter = rxData(6) EndIf CAN RX 15,rxData(0),rxOk : ' H4B0 ABS Brake 2 If (rxOk=1) Then _front_left_wheel_speed = (getU16(rxData(0),rxData(1)) * 44 / 48 * 0.01) - (44 / 48 * (-100)) _front_right_wheel_speed = (getU16(rxData(2),rxData(3)) * 44 / 48 * 0.01) - (44 / 48 * (-100)) _rear_left_wheel_speed = (getU16(rxData(4),rxData(5)) * 44 / 48 * 0.01) - (44 / 48 * (-100)) _rear_right_wheel_speed = (getU16(rxData(6),rxData(7)) * 44 / 48 * 0.01) - (44 / 48 * (-100)) EndIf End Sub Sub sendcandata() Local txData(8) : Local txOk txData(0) = &H03 : txData(1) = &H0B ' software version and revision txData(2) = &H0E ' Id 1 txData(3) = &H4D ' Id 2 txData(4) = &H44 ' Id 3 txData(5) = &H02 ' hardware version txData(6) = &H01 ' init succesfull CAN TX 0,&H300,0,8,txData(0),txOk If txOk = 0 Then Print "Could not send command" End Sub 'MAIN starts here charconfig() isAutoScreen=0 page=8 ecoNow=0 ecoAvgTrip=0 ecoCountTrip=0 ecoAvgAll=0 ecoCountAll=0 lastdod = -1 numberOfCalcs = 0 showTick = 2000 Timer = 0 swe = 1 curIndex = 1 curPrintedIndex = 1 lastPrintTimer = Timer 'DrawAxes 'SetTestValues Do K$= Inkey$ If K$="q" Or (K$="Q") Then CAN FREE : Cls : Font 1 : Print "CAN PORT CLOSED" : End EndIf getcandata() : updateScreen() Loop