Hi, > void main(void) > { > // make all pins of port A as outputs > TRISA = 0; > // Configure LCD_PORT if in use > TRISB = 0; > // Configure LCD control pins > TRISD = 0xF7; > > // Put all PORTA outputs to high > PORTA = 0xff; > > }
You might fall out of main here, causing a RETURN on an empty call stack, which in turn might lead to a RESET and PORTA = 0. Try adding a while (1) { /* halt */ } after your PORTA = 0xff; Any watchdog enabled by default? Also make sure to configure your PORTA for digital I/O---it is multiplexed with Timer0 (RA4 = T0CKI), Oscillator input (RA6), ADC (RA5 and RA3:0). Consult Section 10.1 of the 18f2455-family datasheet for more details, basically setup you device using ADCON1 = 0x0f; // configure PORTA<5,3:0> for digital I/O CMCON = 0x07; // configure PORTA<3:0> for digital I/O TRISA = 0x00; LATA = 0xff; Hope that helps, Raphael ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user