THANK YOU! I should have looked there. I was relying on the (wrong) initialization code on page 95. Harold > > ----- Original Message ----- > From: "Harold Hallikainen" > To: > Sent: Tuesday, February 15, 2005 5:18 PM > Subject: [PIC] Port A digital input on 18F2610? > > >> OK, I give up! Anyone see what I'm doing wrong to get porta to be a >> digital inputs? Here's my C18 initialization code: >> >> ADCON1=0x07; // Configure A/D for digital inputs > > Looks to me like ADCON1 should be initialized to 0x0F to make all pins > digital. Page 212 > >> CMCON=0x07; // Configure Comparators for digital input >> TRISAbits.TRISA7=0; // output to drive D12 >> >> >> On reset, TRISA is reset to 0xff. The ICD2 debugger does show TRISA as >> 0x7f, as expected. >> >> The SFR window shows ADCON1 is 0x07, as expected. >> >> The SFR window shows CMCON as RR (I think that's reserved). The > datasheet >> shows CMCON bits 5-0 as r/w and bits 6 and 7 as read only. So, why > does >> MPLAB call it reserved? I'm running MPLAB 7.00. >> >> Finally, I can see that the port a pins for bits 0-6 on the chip are > high >> (using a scope). The SFR windows says PORTA has a value of 11010000 . > So, >> it's reading bits 0-3 and 5 as low when the pins are really high. I >> SUSPECT something's wrong with initialization of the A/D and > comparator, >> but I pulled the code right out of the PORTA pages in the datasheet >> (converting from asm to C). >> >> So... Any ideas??? >> >> THANKS! >> >> Harold > -- FCC Rules Updated Daily at http://www.hallikainen.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist