a). You are correct that ANSEL=%00001111 will cause ANS0 thru ANS3 to become Analog. It would also be best to switch off the Comparators CMCON=7, unless you're particularly skilled and need to use them simultaneously.
I don't understand what you're trying to accomplish by setting ADCON1=7 (see Datasheet section 12 Register 12-2). The most important are bits 5 and 4 which determine your source of VRef, otherwise the ADCIN defines take care of the rest. If you're using Vdd and Vss for Vref, 10-bit mode, then I'd set ADCON1=%10000000.
b). Setting the alternate pin for PWM output is a function of the configuration word bit 12 (CCPMX). Assuming you're using PBP's Assembler (by default), then by setting...
@ DEVICE pic16F88,CCPMX_ON
or
@ DEVICE pic16F88,CCPMX_OFF
at the start of your program, you can set RB0 or RB3 accordingly. Make the appropriate config line adjustments if you're using MPASM as the assembler. See Datasheet section 15 esp Register 15-1.
It's all in the Datasheet... you gotta make friends with it if you want to be proficient - there's no substitute.
Melanie
Bookmarks