/******************************************************************************** * MAHE, 24.05.2002, 16H30, created from functions formerly located in cruise3.c ********************************************************************************/ #include "ports.h" /******************************************************************************************** * Init of PortA is not needed yet, but analog channels on port A are set up in initAD. ********************************************************************************************/ void initPortA(void) { } /******************************************************************************************** * Init of PortB ********************************************************************************************/ void initPortB(void) { /******************* * Outputs: clear TRISB bits * RB1 LED * RB0 LED *******************/ TRISB&=0xFC; // 0xFC -> 1111 1100 /******************* * clear port * register PORTB *******************/ PORTB=0; } /******************************************************************************************** * Init of PortC ********************************************************************************************/ void initPortC(void) { /********************************** * Note that RC1/CCP2 and RC2/CCP1 * are outputs, too. But these are * set in function initPWM() **********************************/ /******************* * Outputs: clear TRISC bits * RC5 EN0 * (RC1 CCP2,PWM0) and (RC2,CCP1,PWM1) * are taken care of in initPWM *******************/ TRISC&=0xDF; /* 1101 1111 */ /******************* * clear port * register PORTC *******************/ PORTC=0; } /******************************************************************************************** * Init of PortD ********************************************************************************************/ void initPortD(void) { /******************* * Inputs: set TRISD bits * RD6 button * RD5 button * RD4 switch *******************/ TRISD|=0x70; /* 0111 0000 */ /******************* * Outputs: clear TRISD bits * RD7 LED for switch * RD3 EN1 * RD2 IN12 * RD1 IN02 *******************/ TRISD&=0x71; /* 0111 0001 */ /********************** * clear port register * PORTC **********************/ PORTD=0; }