The voltage swing of the EM-406 Tx output is incompatible with the Schmitt trigger input of the PIC Rx input. You need a buffer to boost the signal level between the GPS and the PIC.
The problem is that the Tx output from the GPS module swings from 0V to 2.85V, and the Rx input of the PIC requires a minimum of 4V to trigger reliably. I’ve tried the resistor “pullup” trick" on the GSP output, and it doesn’t work in this application, so you’ll need to use a buffer to boost the signal. Two NPN small-signal transistors and a couple of resistors are all you’ll need to do the job, although the Sparkfun level converter will work well also!
John
PS I’m not in a position to post a schematic right now, but if you need one I’ll do it tomorrow!
Lower the operating voltage of the PIC itself to 3.8v. That’ll put the voltage from the GPS barely into the .75Vdd range of the ST input on the PIC. Drop the voltage a tad lower to get it more into range. You’ll be below the spec’d lower operating voltage for the 16F877 (who uses the 16F877 anymore?), but it’ll likely work at 3.8volts (or less) if you run the PIC slow enough.
Or…somewhat simple-r yet…
Move the GPS TX input over to a TTL input pin (Port A or B) and use a software “bit-banged” serial routine instead of the hardware UART.
I disagree with both your “OR…a simpler fix…” solutions. First, it’s a bad idea to be operating a device outside of the range specified by the manufacturer. Those specifications are published for a reason, and to be sure, not all of them are hard and fast under all conditions, but you’re
certainly operating in an area where odd things can happen if you operate outside the specified range. It’s just a bad engineering practice to design that into a project. Second, Microchip added a hardware UART to a lot of PICs for a reason. The serial interrupt capability, and two byte input buffer of the hardware UART make this feature highly desirable for a GPS data input. I hardly think 5 discrete components is worth the aggravation of giving this feature up, not to mention the hassle of the software “bit-banged” approach!
Is this supposed to be some sort of a “one-upman-ship” thing with you? First, I tell the OP that he’s going to need a buffer between his GPS and his PIC. You concur and suggest trying a pull-up, or a Sparkfun level translator. I then check back in to give the OP a simple circuit that I’ve actually been using with a EM-406 and a PIC 16F689, and then you pop back in with some (IMHO) questionable advise that’s even “simpler”… I fail to see how your last post does anything to help the OP??
No…no…no…just a couple quick tricks/tries to verify that the thing is just plain ol’ working and have something to play with.
If the guy has a few parts hanging around, or a few things to try without having to wait around for the next UPS or FedEx shipment to arrive, AND won’t blow anything up in the process, AND can get back to where they started from, then why not?
Sure it’s a bad idea to operate out of spec’s…if I was trying to talk him into running the thing just outside of the upper range on 6 volts rather than just outside of the lower range on 3 volts.
3 out of 4 16F877"A" I’ve got in my box work fine down to 3volts @ 10Mhz (don’t have any “LF”), the 4th takes 3.4v @ 10Mhz.
Hassle of the software ‘bit-banged’ approach? Ok…whatever. 99% of the newb don’t know the different between a UART and a bit-banged serial port anyways. Look at that code. You think the overhead incurred by a ‘bit-bang’ routine is going to matter with all those delays?
5 discrete components (or 1 logic-level converter BOB)…well…if the guy ain’t got 'em in his “box-o-parts”, then those 5 discrete components aren’t going to help out in the first place now are they?
Jeeze dude…get off it. It’s about the hobby, not saving lives. Methinks I’m glad I pissed in your Wheaties this morning.
Ummm, the OP could launch his own constellation of GPS satellites too, and make his own receivers also, right? On the other hand, my assumption was that he was merely looking for a simple solution to a simple problem. I think I gave him that, while your primary objective seems to have been flexing your intellectual muscle…
In any event, don’t flatter yourself, internet forum skirmishes don’t interest me! Your phraseology, BTW, is quite illuminating. At least, now I know who I’m dealing with! So, next time you venture up from the basement, please say ‘hi’ to your mom :-)!
A) Unless you changed your checksum in your code, it’s still wrong. And I don’t know if this is the case or not, if the EM406A maintains settings between power ups and you haven’t done some sort of hard reset, the you will probably end up trying a lot of possible combinations of the format of the serial data because you don’t know WHAT the EM406A is expecting due to the fact that you weren’t using the correct checksum in the first place. In fact, and again, I don’t know if this is the case or not, if the checksum is wrong, the EM406A would likely ignore that command.
B) If the PC terminal is wrong and your LCD is wrong, maybe your hookup is wrong…in that you’re trying to receive TTL-RS232 when you are actually receiving inverted TTL-RS232.