PDA

View Full Version : PIC18F1220 RA4 using PULSIN ?



Del Tapparo
- 28th June 2009, 03:08
Is there any good reason that I can't get the RA4 input to work with PULSIN? I am using a PIC18F1220 with a 20MHZ resonator. PULSIN works fine on any PORTB pin, but won't fly on RA4. RA4 works as a simple digital input; slow on/off transitions; but when looking at the output from a R/C receiver (digital proportional signals), it counts zero pulses. Like I said, all the hardware/software works fine on port B.

I went through two days of hell trying to configure this thing, but apparently that is now working (CONFIG statement in the P18F1220.INC file, which gives warning errors). I have experience using this same code and logic on three other PICs. I am just trying to convert it over to this one.

Any help would be appreciated. And yes I have searched and searched and read all of the config links, PIC data sheets, etc. Thanks in advance.

sinoteq
- 28th June 2009, 03:39
Hi
This problem have been up before in the forum. http://www.picbasic.co.uk/forum/showthread.php?t=11236 I bet the reason that RA4 does not work is because the Schmitt trigger buffer on that pin. The easy explanation is that your R/C receiver is a 3V device and you run your PIC on 5V. You can solve this in many different ways depending on what you feel like doing. The easiest is a pull up resistor on the RA4 input to boost the voltage. This will however feed a higher voltage into the R/C receiver and that might be a problem. Or you change the voltage to 3V.

Where in the datasheet is this? Under DC Characteristics datasheet page 250 under 22.3

By the way I think the datasheet for PORTA has a big misstake in it.

Del Tapparo
- 28th June 2009, 17:03
Yes indeed! That is my problem. RA4 is a Schmitt trigger input and my Rx puts out 3V pulses with the PIC running at 5V. Thank you very much for saving me a bunch more time and headache.

Unfortunately, a pull-up won't fix it, so time for a hardware design change.

Charles Linquis
- 28th June 2009, 18:18
When I have to do level shifting I find that a 74HCTxx gate does a good job. Power it from 5V.

sinoteq
- 29th June 2009, 14:58
What do you have on RA1? If it is empty make a solder bridge and you have your hardware change.

Del Tapparo
- 30th June 2009, 00:10
Problem was resolved by reassigning I/O. Good tips though. Thanks to all. I learned something (always a good thing).