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.

RA2 as input

Status
Not open for further replies.

patroclus

New Member
Hello again
I got a new problem when using RA2 as input.
Once my program gets to a point where it must get data in RA2 pin, it stops working.

btfss porta, SLatch
goto $-1

SLatch is 0x02
It does not go out there, so I suppose RA2 is read always low ??
Even when RA2 pin gets a pulse clock, it does not go out...

Does it have anything to do with CMCON or VRCON registers??

thank you!
 
patroclus said:
Hello again
I got a new problem when using RA2 as input.
Once my program gets to a point where it must get data in RA2 pin, it stops working.

btfss porta, SLatch
goto $-1

SLatch is 0x02
It does not go out there, so I suppose RA2 is read always low ??
Even when RA2 pin gets a pulse clock, it does not go out...

Does it have anything to do with CMCON or VRCON registers??

thank you!

You don't mention what processor you're using?, but assuming it's the 16F628?, then RA2 can be set as a voltage reference OUTPUT, or as a comparator input, as well as normal I/O - have you set the CMCON and VRCON registers correctly?.
 
I did not set any of them. I thought VRCON was clear for default. Would it be enough setting CMCON to b'00000111' ??

Thank you!
 
patroclus said:
I did not set any of them. I thought VRCON was clear for default. Would it be enough setting CMCON to b'00000111' ??

That's why it doesn't work then, by default the comparators are ON, you don't normally need to alter VRCON (I never have!), but you need to set CMCON to turn the comparators OFF - see my tutorials that all do that!.
 
Status
Not open for further replies.

Latest threads

Back
Top