On Thu, Mar 3, 2011 at 9:43 AM, Olin Lathrop wro= te: > Jim wrote: > > __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _RC_OSC & > > _LVP_OFF & _DEBUG_OFF & _CPD_OFF > > Does this really mean you are using a external RC oscillator? I didn't > look > up what _RC_OSC means, but that's what the name suggests. When nothing i= s > working, I would try with the normal internal RC oscillator to start with= .. > > Personally I don't like this style of specifying config bits. There is n= o > way to comment it and clear up ambiguities like this, and it doesn't show > what else could be possible. > I'll assume that an alternate style is shown in the MPASM manual and look i= t up. That part actually came from an assembly code template supplied by Microchip. http://ww1.microchip.com/downloads/en/DeviceDoc/code.zip > bcf STATUS, RP0 ; select bank 0 > > bcf STATUS, RP1 > > Bad programming. Read the MPASM manual, paying particular attention to t= he > BANKSEL directive. > > > bsf STATUS, RP0 ; select bank 1 > > movlw 0x06 > > movwf ADCON1 > > More bad programming. First, you are making the assumption in the code > that > ADCON1 is in bank 1. Maybe it is, but it's too easy to get such things > wrong, or copy this code for use on another PIC where this might not be > true. > That was originally copied from the PIC16F87x datasheet, pg 41. Again, I'l= l take a look at the MPASM manual, assuming it details a better way. > Second, just writing a magic value like 6 which is not really numeric but > actually a collection of fields is really irresponsible, especially since > there isn't even a comment giving a hint of what you think 6 is supposed = to > do, let alone provide any confidence that you got it right. > > > END ; directive 'end of program' > > You commented the END directive, but not what the bits in ADCON1 mean and > how 6 is the right answer!!? > Not my comment, actually. It was from the Microchip-supplied template, but good point about inadequate commenting elsewhere. It seems I have some studying up to do before I try anything else. I'll le= t you all know if I figure it out or end up with more questions. Thanks to everyone, Jim --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .