>> Ports in question are
>> RA4
>> RB6
>> RB7
---
RA4 is multiplexed with T0CKI and CMP2. You've already taken care of CMP2 with the CMCON = 7. The T0CKI input is controlled by the T0CS bit in the OPTION_REG which defaults to 1 (Timer0 input is T0CKI). You can turn this off by setting OPTION_REG.5 = 0. However This will not affect the operation of RA4 as an output, which appears to be the problem.
RA4 is an open collector type output. It requires a Pull-Up resistor on the output to be used as a normal digital output.
---
RB6 is multiplexed with T1OSO, T1CKI and PGC. T1OSO and T1CKI are controlled by T1CON bits 1 (TMR1CS) and 3 (T1OSCEN). Both of these bits default to 0, which means that the multiplexed functions are disabled. PGC is only used during programming, but if you leave a programmer connected during operation, you may have problems.
However, in your program you have ...
TRISB=%01000000
With a 1 in the bit 6 position, RB6 is set to INPUT. As we found out in your other thread, you want RB6 to be an output.
---
RB7 is multiplexed with T1OSO and PGD. Again, T1OSO is disabled by default (T1OSCEN). and the previous mention of the programmer applies here too.
It may be that you grabbed an old file for this post. But the correction from the "other" thread is incorrect in this listing.
pLcd_dat = glcd_dat
PORTB.6 = glcd_dat.4
PORTB.5 = glcd_dat.5
change to
pLcd_dat = glcd_dat
PORTB.6 = glcd_dat.6
PORTB.5 = glcd_dat.7
---
Also, like mat says, RA5 is input only, so it will have to be moved to a different pin.
HTH,
Darrel
Bookmarks