please dont rip this site

PIC Microcontroller Port Pins

See:

"RA4 doesn't behave right. It will pull down, but not up, even though I set it as an output pin & am writing a '1' to it."
RA4 is an open drain (same as an Open Collector basically) output pin. You need to either (a) use a different port pin, or (b) put a pull-up resistor from that pin to Vdd (+5V typically), to make the pin pull up as default.
"When I set a port pin as an input, then ground & unground it with a switch, it sometimes works & other times doesn't work."
You have a floating input. Either (a) Use a pull-up resistor from the port pin to Vcc, and use a switch to drive that port pin to GND, or (b) Use a pull-down resistor from the port pin to GND, and use a switch to drive that pin to Vcc.

10k is a good value here.

{Should I mention weak pull-ups?}

"When setting a port A pin as an analog output, any read/modify/write instruction will result in the analog voltage being set to zero"
Bob Ammerman [RAMMERMAN at PRODIGY.NET] of RAm Systems says:
Now that gets me to thinking: Here is a neat trick to get a 'push-pull' output from two PORT A pins:

1: define them as analog (ADCON1)
2: TRIS them as outputs.

Now, when you BSF either of them the other will automatically be cleared.

(Huh ? I thought PICs didn't have analog outputs?)
"It is possible to miss interrupts on some port B pins if you read or write to other pins on the same port... on some PICs, look for the "interrupt on change" warning in the datasheet for the device you are using."
Bob Ammerman [RAMMERMAN at PRODIGY.NET] of RAm Systems says:
Any time you read the port you will reset the 'current value' condition for the pins.

So, if you take an interrupt and read the port to see what changed it will reset the interrupt condition. This is good.

Where you get in trouble is if _another_ change in the input occurs just at the moment you are reading the port. In this case you can miss it.

But, if you know for certain that a second change on any of the inputs cannot occur before you get into your interrupt handler and read the status you will be ok.

see also:

Comments:

Questions:


file: /Techref/microchip/portpins.htm, 4KB, , updated: 2010/2/25 16:40, local time: 2024/10/31 16:48,
TOP NEW HELP FIND: 
3.144.17.43:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/microchip/portpins.htm"> PIC Microcontroller port pins</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?