void InitPinModes(void){
	BYTE i;
	BYTE mode=0;
	for (i=0;i<24;i++){

		//ClearPinState(i);
		SetPinTris(i,INPUT);
		SetDIO(i,0);
		SetPWM(i,EEReadValue(i));
		SetServoPos(i,EEReadValue(i),0);
		//getBcsIoDataTable()[i].PIN.previousChannelMode=NO_CHANGE;
		mode=EEReadMode(i);
		if((mode < 2)||(mode >=IO_MODE_MAX)){
			EEWriteMode(i,IS_DI);
			mode = EEReadMode(i);
		}
		getBcsIoDataTable()[i].PIN.currentChannelMode = mode;
		setMode(i,EEReadMode(i));
	}
	startup = FALSE;
	//printModes();
}
uint8_t GetChannelMode(uint8_t pin) {
    return EEReadMode(pin);
}