Esempio n. 1
0
void ckps_init_ports(void)
{
 PORTD|= _BV(PD6); // pullup for ICP1 (подтяжка для ICP1)

 //after ignition is on, igniters must not be in the accumulation mode,
 //therefore set low level on their inputs
 //(после включения зажигания коммутаторы не должны быть в режиме накопления,
 //поэтому устанавливаем на их входах низкий уровень)
 IOCFG_INIT(IOP_IGN_OUT1, IGN_OUTPUTS_INIT_VAL);        //init 1-st (can be remapped)
 IOCFG_INIT(IOP_IGN_OUT2, IGN_OUTPUTS_INIT_VAL);        //init 2-nd (can be remapped)
 IOCFG_INIT(IOP_IGN_OUT3, IGN_OUTPUTS_INIT_VAL);        //init 3-rd (can be remapped)
 IOCFG_INIT(IOP_IGN_OUT4, IGN_OUTPUTS_INIT_VAL);        //init 4-th (can be remapped)
 IOCFG_INIT(IOP_ADD_IO1, IGN_OUTPUTS_INIT_VAL);         //init 5-th (can be remapped)
 IOCFG_INIT(IOP_ADD_IO2, IGN_OUTPUTS_INIT_VAL);         //init 6-th (can be remapped)
 IOCFG_INIT(IOP_IGN_OUT7, IGN_OUTPUTS_INIT_VAL);        //init 7-th (for maniacs)
 IOCFG_INIT(IOP_IGN_OUT8, IGN_OUTPUTS_INIT_VAL);        //init 8-th (for maniacs)

 //init I/O for Hall output if it is enabled
#ifdef HALL_OUTPUT
 IOCFG_INIT(IOP_HALL_OUT, 1);
#endif

 //init I/O for stroboscope
#ifdef STROBOSCOPE
 IOCFG_INIT(IOP_STROBE, 0);
#endif
}
Esempio n. 2
0
void bc_indication_mode(struct ecudata_t *d)
{
 uint8_t i = 5;
 if (!IOCFG_CHECK(IOP_BC_INPUT))
  return; //normal program execution

 //Check 5 times
 do
 {
  if (IOCFG_GET(IOP_BC_INPUT))
   return; //normal program execution
 }while(--i);

 //We are entered to the blink codes indication mode
 _DISABLE_INTERRUPT();
 ce_set_state(CE_STATE_OFF);

 vent_turnoff(d);                //turn off ventilator
 starter_set_blocking_state(1);  //block starter
 IOCFG_INIT(IOP_FL_PUMP, 0);     //turn off fuel pump
 IOCFG_INIT(IOP_IE, 0);          //turn off IE valve solenoid
 IOCFG_INIT(IOP_FE, 0);          //turn off power valve solenoid

 wdt_reset_timer();

 //delay 2 sec.
 delay_hom(20);

 //main loop
 for(;;)
 {
  uint16_t errors = 0;
  disp_start();

  delay_hom(7);

  //read errors
  eeprom_read(&errors, EEPROM_ECUERRORS_START, sizeof(uint16_t));

  for(i = 0; i < 16; ++i)
  {
   if (0 == PGM_GET_BYTE(&blink_codes[i]))
    continue;
   if (errors & (1 << i))
   {
    disp_code(PGM_GET_BYTE(&blink_codes[i]));
    delay_hom(20);
   }
  }

  delay_hom(20);
  wdt_reset_timer();
 }
}
Esempio n. 3
0
void intkheat_control(struct ecudata_t *d)
{
 if (!d->param.tmp_use)
 {
  IOCFG_INIT(IOP_INTK_HEAT, 0);
  return;
 }

 switch(ih.state)
 {
  case 0: //turn on heating and start timer
   IOCFG_SET(IOP_INTK_HEAT, (d->sens.temperat < TEMPERATURE_MAGNITUDE(HEATING_T_OFF)));   // control heating
   ih.strt_t1 = s_timer_gtc();
   ih.state = 1;
   break;

  case 1: //wait 10 minutes and turn off heating or it will be turned off immediatelly if crankshaft begin to revolve
   if (((s_timer_gtc() - ih.strt_t1) >= HEATING_TIME) || ckps_is_cog_changed())
   {
    IOCFG_SET(IOP_INTK_HEAT, 0);                                                          // turn off heating
    ih.state = 2;
   }
   break;

  case 2: //control heating if engine is running, otherwise turn it off
   if (d->st_block)
   { //engine is running
    IOCFG_SET(IOP_INTK_HEAT, (d->sens.temperat < TEMPERATURE_MAGNITUDE(HEATING_T_OFF)));  // control heating
   }
   else
    IOCFG_SET(IOP_INTK_HEAT, 0);
   break;
 }
}
Esempio n. 4
0
void stpmot_init_ports(void)
{
 IOCFG_INIT(IOP_SM_DIR, SM_DIR_CW);
 IOCFG_INIT(IOP_SM_STP, 0); //high level at the output
}
Esempio n. 5
0
void ce_init_ports(void)
{
 IOCFG_INIT(IOP_CE, CE_STATE_ON); //CE is ON (for checking)
}
Esempio n. 6
0
void pwrrelay_init_ports(void)
{
    IOCFG_INIT(IOP_PWRRELAY, 1); //power relay is turned on (реле включено)
    IOCFG_INIT(IOP_IGN, 1);      //init IGN input
}
Esempio n. 7
0
void intkheat_init_ports(void)
{
 IOCFG_INIT(IOP_INTK_HEAT, 0);  //<-- heating is off
}