Thank you Paul and Dave. I think the issue may be a combination of both problems.
I had not seen those posts by Melanie that you referenced, Dave. But tried to set PORTA to digital using various permutations of CMCON and ADCON1 and ANSEL--all to no avail. CMCON actually will not compile--have to use CMCON0. Suffice it to say that CMCON0 = 7 and ADCON1 = 7 seem to do nothing.
I'm too stupid to actually understand what is in the 16F916 spec sheet. It gives an assembly language example of how to set A to digital, but I cannot translate this into PicBasic code. So I'm still uncertain if I have tried this with PORTA in digital. Here's the asm code from the spec sheet.
BCF STATUS,RP0 ;Bank 0
BCF STATUS,RP1 ;
CLRF PORTA ;Init PORTA
BSF STATUS,RP0 ;Bank 1
BCF STATUS,RP1 ;
MOVLW 07h ;Set RA<2:0> to
MOVWF CMCON0 ;digital I/O
CLF ANSEL ;Make all PORTA I/O
MOVLW F0h ;Set RA<7:4> as inputs
MOVWF TRISA ;and set RA<3:0>
; as outputs
BCF STATUS,RP0 ;Bank 0
BCF STATUS,RP1 ;
Can I just insert this as ASM in the PBP code?
Your code works, Paul, as I suspected it would given that PORTA = 255 would light everything up. So read-modify-write may be the issue. However, when I put a "Pause 10" after each of the pin commands, I still get good performance only on A.4 and A.5.
I would really like to be able to manipulate the pins independently, but if that is impossible, I think I can do a work-around by writing to the entire port.
Bookmarks