I need to use a 16f676 instead of a 16f630. The 676 has "AD" and the 630 dose not! So I need to turn of the AD converter (Ansel = 0 in basic) .
The code is in "asm". I'm Brain Dead when it comes to "ASM" programming!
Here is a link to the code that I wish to Port. https://www.sparkfun.com/tutorial/TestHex/LCD/serlcd-v1.asm
Can I just remove the comments in the " boot_up " routine?
( ; //ANSEL = 0b.0000.0000; //Disable ADC on all pins - Only on the 16F676 )
Note: The ANSEL (9Fh) and CMCON (19h)
registers must be initialized to configure an
analog channel as a digital input. Pins
configured as analog inputs will read ‘0’.
The ANSEL register is defined for the
PIC16F676.
Thanks casab911.
I have read the "data sheet" over and over!!!
IF I paste your code to the asm file , I see a duplicate " movwf CMCON " .
Should I remove part of the "boot_up" routine and paste your code there?
Also Do I need to include the "ANSEL" address to the top of the code?
nonono
if yuo look at the code posted at sparkfun...., you will see there is already a code to make the pins digital .
Code:
; //Setup Ports
; //ANSEL = 0b.0000.0000; //Disable ADC on all pins - Only on the 16F676
; CMCON = 0b.0000.0111; //Turn off comparator on RA port
MOVLW .7
MOVWF CMCON
It should work like that !
The 05 hex in Microchips example if equall of decimal 7 in spakfun's code.