modifying GPIO

Status
Not open for further replies.

Mosaic

Well-Known Member
Hi folks:
Just getting going with the Basic compiler in the latest PIC simulator and this command:

GPIO=GPIO+1 does not work in simulation (12f675, 4Mhz)

but if I use a byte dimensioned 'buffer' variable like:

buffer=buffer+1
GPIO=buffer

all is well. On using the BREAK and stepping, I can see the asm command reading from the GPIO (GPR 0x05) always reads a zero, even if the GPIO holds another value.
The strange thing is the examples given in the basic compiler manual seem to assume that GPIO=GPIO+1 will work. This has implications for Conditional logic that must read from the ports etc.


Can anyone explain what is going on?
Answer:

Ok, 12f675 needs to have it's analog comparator off to get GPIO. Also GP3 is ALWAYS an input.
These two additional cmds are necessary.
CMCON = 0x07
ANSEL = 0
 
Last edited:
So.....you don't need help then!!! When I start up oshonsoft, I always start with ALLDIGITAL. Unless of course I need the analogue part.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…