250 likes | 427 Views
Electronic Automotive Motor Control System. Software Description. Viking 32. Kernel Selection and Task Design. Kernel – Micro C/OSII. Micro C/OSII was selected for its flexibility and OS services Queues Memory Partitions Mutual exclusions. Task/ISR Description. Task/ISR Specs.
E N D
Electronic Automotive Motor Control System Software Description Viking 32
Kernel Selection and Task Design • Kernel – Micro C/OSII • Micro C/OSII was selected for its flexibility and OS services • Queues • Memory Partitions • Mutual exclusions
Modules and Descriptions • EAMCS – Main program. Integrates all modules listed below into motor control system. • AtoD – Initialization and analog to digital conversions. • CAN – Initialization, Transmission, and Reception of data over the Controller Area Network. • eamcs_display – Formats and updates data for the User Interface. • BasicIO – Initializes the SCI port, formats, transmits, and receives ASCII data • ECT – Handles input captures and RPM calculations. • PWM – Initialization, sets pulse width modulation
EAMCS.c • TASKS: • StartTask • Can0BusTask • Can0RxTask • InputTask • CalcDataTask • UITask Code Reuse: BasicIO Module Modifications: Baud = 19200 Port = SCI1
AtoD.c Public Functions: void AtoDInitSingle(void) INT16U AtoDReadSingle(INT8U port) Code Reuse: None
CAN.c Public Functions: INT8U Can0Enable(void); void Can0Timing(void); void Can0Filter(INT8U id_ac_mode, INT8U *filter1, INT8U *filter2) void Can0Mask(INT8U *mask1, INT8U *mask2) INT8U Can0Rx(CAN_DATA *rx_data) INT8U Can0Tx(CAN_DATA *tx_data) void Can0IdFormat(INT8U *can_id) Code Reuse: None
eamcs_display.c Public Functions void DispConditions(void) void DispAccelVolt(INT16U acc_volt) void DispBrakeVolt(INT16U brake_volt) void DispShiftPos(INT8U s_pos) void DispGearPos(INT16U g_pos) void DispMotorRpm(INT16U m_rpm_val) void DispAxleRpm(INT16U a_rpm_val) void DispFaultBit(INT8U fault_bit) void DispEnableBit(INT8U enable_bit) void DispReqGearPos(INT8U req_gear_pos) void DispCanMotorRpmRx(INT16U m_rpm_val) void DispCanTorqueRx(INT8U torque_val) void DispCanBusVoltRx(INT8U bus_volt_val) void DispCanBusCurrentRx(INT8U bus_cur_val) void DispCanInverterTempRx(INT8U temp_val) void DispCanRotorTempRx(INT8U rotor_val) void DispCanStatorTempRx(INT8U stator_val) void DispCanWatchDogRx(INT8U comm_err, INT8U wtch_dg_err) void DispCanReqSpeedTx(INT16U speed) void DispCanReqTorqueTx(INT8U torque) void DispCanPowerReqTx(INT8U power) void DispCanMaxBusCurTx(INT8U max_current) void DispCanMaxBusVoltTx(INT8U max_volt) void DispCanControlBitTx(INT8U control_bit) void DispCls(void) Code Reuse: BasicIO Module Modifications: Baud = 19200 Port = SCI1
ECT.c Public Functions extern void EctRpmTaskInit(void) INT8U EctGetRPM0(INT16U *period) INT8U EctGetRPM1(INT16U *period) Tasks EctRpmTask ISRs ISR EctInCap0ISR(void) ISR EctInCap1ISR(void) ISR EctOverFlowISR(void) OS_EVENT *RpmMutex Code Reuse: None
PWM.c Public Functions void PwmInit100kHz(INT8U port, INT8U duty_cycle) void PwmDutyCycle(INT8U duty_cycle) INT8U PwmGetDutyCycle(void) Code Reuse: None
Intertask Communications Partitioned Memory Flow 50ms SensorDataQ InputTask UiSensorDataQ 50ms Continuous UiCanRxQueue CalcDataTask UITask 10ms UiCanTxQueue CanRxDataQ CanRxTask Heap Memory Partition Sensor Data CAN RX Data CAN TX Data
Intertask Communications Partitioned Memory Flow 50ms SensorDataQ InputTask UiSensorDataQ OSQPost() OSQAccept() OSQAccept() OSQPost() 50ms Continuous UiCanRxQueue CalcDataTask UITask OSQPost() OSQAccept() 10ms OSQAccept() UiCanTxQueue CanRxDataQ OSQPost() CanRxTask OSQPost() OSQAccept() OSMemPut() OSMemPut() OSMemGet() Heap Memory Partition Sensor Data CAN RX Data CAN TX Data
Intertask Communications CAN Module Can0Rx() Can0BusStatus() Can0BusOffReq() Can0TxRxReq() Can0SleepReq() Can0Enable() Can0Filter() Can0Mask() Can0IdFormat() CAN0 Controller RXCAN BUFFERS RXCAN0 TXCAN0 Can0Timing() 250kbps Can0Tx() TXCAN BUFFERS Can0BusTask
Intertask Communications A to D Module PK0_L Shifter Port SHIFTER_PORT_INIT() PK1_L 0.5µs AtoDInitSingle() PK2_L AN00 AN0-2 ATDDR0 AtoDReadSingle() SHIFTER_POSITION() PK3_L (~(SHIFTER_PORT | 0xc0)) AN01 ATDDR1 PK4_L ATDDR2 AN02 PK5_L ECT Module OverFlowCnt0 PeriodCnt0 PT00 EctInCap0ISR RpmTask EctOverFlowISR Rpm0 EctInCap1ISR PT01 10ms Rpm1 PeriodCnt1 OverFlowCnt1 InputTask EctRpmTaskInit() EctGetRPM0() EctGetRPM1() GEAR_SEL_FAULT() PORT A PA2_L
Intertask Communications CAN Module Can0Rx() Can0Enable() Can0Filter() Can0Mask() Can0IdFormat() CAN0 Controller RXCAN BUFFERS RXCAN0 TXCAN0 Can0Timing() 250kbps Can0Tx() TXCAN BUFFERS Can0RxTask CanRxDataQ CalcDataTask PK0_L PWM Module PwmDutyCycle() Duty Cycle PwmGetDutyCycle() GEAR_SEL_ENABLE() PWM 8B8C PWM0 PwmInit100kHz() PORT A PA3_L
Intertask Communications eamcs_display Module DispConditions() DispAccelVolt() DispBrakeVolt() DispShiftPos() DispGearPos() DispMotorRpm() DispAxleRpm() DispFaultBit() DispEnableBit() DispReqGearPos() DispCanMotorRpmRx() DispCanTorqueRx() DispCanBusVoltRx() DispCanBusCurrentRx() DispCanInverterTempRx() DispCanRotorTempRx() DispCanStatorTempRx() DispCanWatchDogRx() DispCanReqSpeedTx() DispCanReqTorqueTx() DispCanPowerReqTx() DispCanMaxBusCurTx() DispCanMaxBusVoltTx() DispCanControlBitTx() DispCls() UiSensorDataQ Continuous UiCanRxQueue BasicIO Module UITask TXD1 RXD1 UiCanTxQueue