PDA

View Full Version : Its not always the code that is wrong !!!!



keithdoxey
- 18th April 2006, 09:53
Hi All,

Just thought I would post a reminder of something to check!

Last night I had typed a new thread pleading for help with getting RA4 to be a digital out on a 16F88.

The pin is designated RA4/AN4/TOCKI/C2OUT

I had included ANSEL=0 to get rid of AN4

I had included CMCON=7 to disable the comparators

My TRISA bits were set correctly and I was sure that the registers for TMR0 were OK but no matter what I tried I couldnt get RA4 to function as a digital out.

Following Melanie's Law I read the datasheet time and time again and the only bit that I wasnt sure about was 13.5 which says....

"The comparator outputs may also be directly output to the RA3 and RA4 I/O pins. When enabled, multiplexors in the output path of the RA3 and RA4 pins will switch and the output of each pin will be the unsynchronized output of the comparator."

... but I couldnt see anything that explicity enabled the multiplexors.

I tried using RA3 as a digital output and that worked so I was pretty sure that my code was OK but it just wouldnt work :(

I was just about to hit the "Submit New Thread" button when I decided to try another 16F88. SUCCESS :)

I had spent the best part of two evenings trying to get a circuit working without checking that the chip was OK. I dont know how I had killed it but it had definately gone to that great breadboard in the sky.

Sometimes you just get so focused on the code you are writing that you assume that is where the problem lies but it can be a lot more basic than that!!!

DOH !!!!

picnaut
- 19th April 2006, 22:56
Hi,

I'll bet hardly anyone in this forum does this when working at their bench (including me), but you should really use a ground strap when working with PICs. This is especially important in the manufacturing stage. Static discharges are scary because they can weaken a trace inside a chip without actually breaking it. Everything appears to run fine until the trace, which was "almost" destroyed during that initial static discharge, decides to suddenly break.

Believe me, it happens, and customers "love" it.
You think it's a pain when you're developing a product on the bench? Wait until you have several units in the field and the tech support calls start coming in.

Stay grounded!

:)

Regards,

Melanie
- 19th April 2006, 23:42
... and all along I thought we chained our assembly workers to the bench in order to reduce unnescessary coffee and toilet breaks...