On Thu, Jan 8, 2009 at 11:15 PM, peter green wrote: > What stage exactly are you stuck at? does your code fail to compile? (if > so with what error?) does it compile but not work? It compiles, but when I put a multimeter to the pins, I'm not getting what I exepect. > It looks to me here like you are selecting HS crystal mode What should I be using? All I want is my chip to run at 4 MHz without an external crystal. >> OSCCON = (OSCCON & 0b10001111) | 0b01100000; //4 MHz > yet here it looks like you are trying to configure the speed of the > internal oscilator Yep, to run at 4 MHz. > >ADON = 0; > I don't think this has any effect on whether the chip treats pins as > analog inputs or digital inputs (that won't affect you right now because > you are only using outputs but it's something to remember for later). > > The correct way to make all pins digital on a 18F4620 or 18F2620 or > 18F4520 or 18F2520 (and possiblly other chips too but NOT the first gen > 18F452 and 18F252) is to use > > ADCON1 = 0x0F Advice taken. > Also while again it's not important in this particular case it's good > practice to use LATx rather than PORTx for output to avoid RMW issues > (writing to both is just pointless since both writes get directed to the > same place). Yep. -- solarwind -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist