This library can parse CAN data sent by MITSUBA Inverter.

Dependents:   CANLogger_MITSUBA

Committer:
kelloo
Date:
Thu Jun 16 05:54:26 2016 +0000
Revision:
0:bd23027c06bd
Child:
1:ec529582beed
CAN Logger_MITSUBA Inverter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kelloo 0:bd23027c06bd 1 /**
kelloo 0:bd23027c06bd 2 * define LogFrame Address.
kelloo 0:bd23027c06bd 3 */
kelloo 0:bd23027c06bd 4 #define FRAME0 0x01
kelloo 0:bd23027c06bd 5 #define FRAME1 0x02
kelloo 0:bd23027c06bd 6
kelloo 0:bd23027c06bd 7 #include "mbed.h"
kelloo 0:bd23027c06bd 8
kelloo 0:bd23027c06bd 9 /**
kelloo 0:bd23027c06bd 10 * MITSUBA class
kelloo 0:bd23027c06bd 11 */
kelloo 0:bd23027c06bd 12 class MITSUBA {
kelloo 0:bd23027c06bd 13 public:
kelloo 0:bd23027c06bd 14 /**
kelloo 0:bd23027c06bd 15 * variables parsed from CAN data
kelloo 0:bd23027c06bd 16 */
kelloo 0:bd23027c06bd 17 double batteryVoltage; // 0.5V / LSB
kelloo 0:bd23027c06bd 18 double batteryCurrent; // 1A / LSB
kelloo 0:bd23027c06bd 19 double motorCurrentPeak; // 1A / LSB
kelloo 0:bd23027c06bd 20 double FETtemp; // 5deg / LSB
kelloo 0:bd23027c06bd 21 double rpmMotor; // 1rpm / LSB
kelloo 0:bd23027c06bd 22 double duty; // 0.5% / LSB
kelloo 0:bd23027c06bd 23 double angle; // 0.5deg / LSB
kelloo 0:bd23027c06bd 24 double accelPosition; // 0.5% / LSB
kelloo 0:bd23027c06bd 25 double regenePosition; // 0.5% / LSB
kelloo 0:bd23027c06bd 26
kelloo 0:bd23027c06bd 27 /**
kelloo 0:bd23027c06bd 28 * MITSUBA constructor.
kelloo 0:bd23027c06bd 29 @param _can instance of CAN
kelloo 0:bd23027c06bd 30 @param freq CAN frequency
kelloo 0:bd23027c06bd 31 */
kelloo 0:bd23027c06bd 32 MITSUBA(CAN &_can, int freq);
kelloo 0:bd23027c06bd 33 /**
kelloo 0:bd23027c06bd 34 * Fetch and Parse datas sent by the MITSUBA Inverter.
kelloo 0:bd23027c06bd 35 @param val LogFrame Address
kelloo 0:bd23027c06bd 36 */
kelloo 0:bd23027c06bd 37 void GetCanData(unsigned char val);
kelloo 0:bd23027c06bd 38
kelloo 0:bd23027c06bd 39 private:
kelloo 0:bd23027c06bd 40 CAN &can;
kelloo 0:bd23027c06bd 41 int canfreq;
kelloo 0:bd23027c06bd 42 void ParseFrame0(unsigned char *data);
kelloo 0:bd23027c06bd 43 void ParseFrame1(unsigned char *data);
kelloo 0:bd23027c06bd 44 };