PWM and ALGO updated.. PWM getting generated
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TFR_BAE_vr1_1working_finally_PWM_update by
Diff: main.cpp
- Revision:
- 8:24f73f54e44a
- Parent:
- 7:a46a1dee4497
- Child:
- 9:c74c43a77ae9
--- a/main.cpp Sat Jan 23 11:35:20 2016 +0000 +++ b/main.cpp Sun Mar 06 12:41:03 2016 +0000 @@ -69,7 +69,7 @@ bool pf1check = 0; bool pf2check = 0; bool if1check = 0; -bool if2check = 1; +bool if2check = 0; //*****************************************************Assigning pins******************************************************// DigitalOut gpo1(PTC0); // enable of att sens2 switch @@ -100,12 +100,11 @@ InterruptIn ir7(PIN42);//Charger IC - Fault Bar DigitalOut TRXY_SW(PIN71); //TR XY Switch -DigitalOut DRV_Z_SLP(PIN88); //Sleep pin of driver z +DigitalOut DRV_Z_EN(PIN88); //Sleep pin of driver z DigitalOut TRZ_SW(PIN40); //TR Z Switch DigitalOut CDMS_RESET(PIN7); // CDMS RESET DigitalOut BCN_SW(PIN14); //Beacon switch -DigitalOut DRV_XY_SLP(PIN82); - +DigitalOut DRV_XY_EN(PIN82); @@ -271,7 +270,13 @@ { printf("%f\t",moment[i]); } - FCTN_ACS_GENPWM_MAIN(moment) ; + + + FCTN_ACS_GENPWM_MAIN(moment) ; + + //PWM1 = 0.5; + //PWM2 = 0.5; + //PWM3 = 0.5; } else { @@ -473,9 +478,9 @@ void ir3clear() { actual_data.faultIr_status |= 0x04; - DRV_Z_SLP = 0; + DRV_Z_EN = 0; wait_us(1); - DRV_Z_SLP = 1; + DRV_Z_EN = 1; } @@ -533,9 +538,9 @@ if (pf3==0) { actual_data.faultPoll_status |=0x04 ; - DRV_XY_SLP = 0; + DRV_XY_EN = 0; wait_us(1); - DRV_XY_SLP = 1; + DRV_XY_EN = 1; } else actual_data.faultPoll_status &= 0xFB; @@ -592,7 +597,7 @@ if(schedcount%2==0) { - F_EPS(); + //F_EPS(); } if(schedcount%3==0) { @@ -718,9 +723,13 @@ ACS_ATS_ENABLE = 'e'; ACS_DATA_ACQ_ENABLE = 'e'; EPS_BATTERY_HEAT_ENABLE = 'e'; + DRV_XY_EN = 1; + DRV_Z_EN = 1; + TRZ_SW = 1; + TRXY_SW = 1; //............................// FCTN_ACS_INIT(); - FCTN_EPS_INIT(); + //FCTN_EPS_INIT(); //P_BCN_INIT(); @@ -729,7 +738,10 @@ int main() { + + pc.printf("\n\r BAE Activated. Testing Version 1.1 \n"); + actual_data.power_mode=3; /* if (BCN_FEN == 0) //dummy implementation { @@ -758,12 +770,17 @@ irpt_4m_mstr.enable_irq(); irpt_4m_mstr.rise(&FCTN_I2C_ISR); // ir1.fall(&ir1clear); //Battery Gauge - Alert Bar Signal - ir2.fall(&ir2clear); //TRXY Driver TR switch Fault + + + /*ir2.fall(&ir2clear); //TRXY Driver TR switch Fault ir3.fall(&ir3clear); //TRZ Driver Fault Bar ir4.fall(&ir4clear); //TRZ Driver TR switch Fault ir5.fall(&ir5clear); //CDMS - Switch Fault ir6.fall(&ir6clear); //Beacon- Switch OC bar ir7.fall(&ir7clear); //Charger IC - Fault Bar + + */ + RtosTimer t_sc_timer(T_SC,osTimerPeriodic); // Initiating the scheduler thread t_sc_timer.start(10000); t_start.start();