Пример #1
0
void initPIDChans(BYTE group){

	if(dyPid[group].inputChannel==DYPID_NON_USED || dyPid[group].outputChannel==DYPID_NON_USED)
		return;

	switch(dyPid[group].inputMode){
	case IS_COUNTER_INPUT_INT:
	case IS_COUNTER_INPUT_DIR:
	case IS_COUNTER_INPUT_HOME:
		dyPid[group].inputChannel = getCounterIntChannnel( channelToCounterGroup(dyPid[group].inputChannel));
		StartCounterInput(dyPid[group].inputChannel);
		break;
	}

	println_I("Setting Modes for PID");
	SetCoProcMode(dyPid[group].inputChannel,dyPid[group].inputMode);
	SetCoProcMode(dyPid[group].outputChannel,dyPid[group].outputMode);
	SyncModes();

	if(dyPid[group].inputMode== IS_ANALOG_IN){
		pidGroups[group].SetPoint=GetValFromAsync(dyPid[group].inputChannel);
	}else{
		pidGroups[group].SetPoint=0;
	}
}
Пример #2
0
void initPIDChans(uint8_t group){

	if(dyPid[group].inputChannel==DYPID_NON_USED || dyPid[group].outputChannel==DYPID_NON_USED){
		return;
	}

	switch(dyPid[group].inputMode){
	case IS_COUNTER_INPUT_INT:
	case IS_COUNTER_INPUT_DIR:
	case IS_COUNTER_INPUT_HOME:
		dyPid[group].inputChannel = getCounterIntChannnel( channelToCounterGroup(dyPid[group].inputChannel));
		StartCounterInput(dyPid[group].inputChannel);
		break;
	}

//	println_W("PID In chan: ");
//	p_int_W(dyPid[group].inputChannel);
//	println_W(" mode: ");
//	printMode(dyPid[group].inputMode, WARN_PRINT);
//	println_W("PID Out chan: ");
//	p_int_W(dyPid[group].outputChannel);
//	println_W(" mode: ");
	//printMode(dyPid[group].outputMode, WARN_PRINT);
	SetCoProcMode(dyPid[group].inputChannel,dyPid[group].inputMode);
	SetCoProcMode(dyPid[group].outputChannel,dyPid[group].outputMode);
	//SyncModes();

	if(dyPid[group].inputMode== IS_ANALOG_IN){
		pidGroups[group].SetPoint=GetValFromAsync(dyPid[group].inputChannel);
	}else{
		pidGroups[group].SetPoint=0;
	}
	SetPIDCalibrateionState(group, CALIBRARTION_DONE);
	getPidGroupDataTable( group)->config.Async=true;
	//getPidGroupDataTable( group)->config.Enabled=true;

}