I am using a 16F688, with internal clock enabled and only 2 port connections: to LED1 and LED2 on PortC.
This trivial program shows a problem I have found with the Port addressing:
CMCON0=%0000111 'Comparators off
OSCCON.3=1 'Use internal clock
TRISC=0 'PortC is all output
LED1 Var PortC.3
LED2 Var PortC.5
Timer Var WORD
Timer=0
Loop: Pause 20 'Delay makes LED flash at about 1Hz
Timer=Timer+1
IF Timer.4=1 then
LED1=1
LED2=1
ENDIF
IF Timer.4=0 then
LED1=0
LED2=0
ENDIF
GOTO Loop
END
Using this program only LED2 will flash. However, if the statements LED2=1 and LED2=0 are removed, then LED1 will flash. It is not possible to make both flash together!
Any ideas? I am completely mystified.
Bookmarks