Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top