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.

RA5 on PIC 16F627

Status
Not open for further replies.

northsea

New Member
Hi all,

I am creating my first application using a PIC. I have used all of the pins on the 16F627 and so need to use RA5. However I can't get it to act as an input. I have used the following lines to configure the comparators:

MOVLW B'00000111'
MOVWF CMCON

and I have added the following to the __CONFIG line:

_MCLRE_OFF

I have tried the same bit of circuit on a different input line and it works so I know it is not he external circuitry.

I have tied the RA5 pin to +5V using a 330K resistor and then use a switch to ground (as I have done with the other working inputs).

The program appears to read the pin as a zero and when I press the switch resets the micro.

Any ideas would be greatly appreciated.
 
Depending on the programmer you're using you may put the 16F627 in a non reflashable mode from using MCLR as an input. Make sure your programmer supports VPP before VDD.

330K is very high for a pullup, try 33K
 
northsea said:
The program appears to read the pin as a zero and when I press the switch resets the micro.

Any ideas would be greatly appreciated.

Fairly obviously, as pressing the switch generates a reset, MCLR is still being used as a reset pin - and not not an I/O pin - so you're not setting the fuses correctly.
 
Thanks for your responses.

I ammended the __CONFIG line to _MCLRE_OFF. Are there any other fuses I should be setting?

I am using a Velleman programmer and then removing the chip to test it in my own circuit.
 
No it doesn't show the fuse settings when you load the HEX file. It's just a simple thing that came with the Velleman kit. I am just using notepad to write the assembler.
 
Hello again,

After a few attempts I realised that the programmer wasn't updating the config word. 0x3F41 works fine now. Thanks a lot for all your help.
 
northsea said:
Hello again,

After a few attempts I realised that the programmer wasn't updating the config word. 0x3F41 works fine now. Thanks a lot for all your help.

How can that be?

The two config statements produce exactly the same hex file. Can someone explain this????

Mike.
 
The programming software may mask off bits it considers in confilict with its capabilities.
MPLAB enable/disables the DEBUG_ON bit by itself when needed.
 
Pommie said:
How can that be?

The two config statements produce exactly the same hex file. Can someone explain this????

Mike.

Yes, the config lines are the same. It wasn't the config line that was the problem - it just appeared that the Velleman programmer wasn't updating the PIC after I made changes even thought the "update config word" box was ticked. I loaded the HEX file again and it worked.

Thanks for your interest.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top