PIC + rs232 Woes
May 7, 2006 1:21 AM
Subscribe
My JDM PIC programmer and the serial routines I've got stuffed in the little chip were working just fine....
Until I put it down for a couple of weeks. Now the serial input from the PIC is garbled ASCII nonsense and the JDM refuses to re-program the chip. No settings were changed in IC-prog and the only thing I've installed is a usb mouse (There was one of the same brand installed before). I get -12 volts on the TX/RX pins of the rs-232 cable and an old serial mouse seems to work fine on the port(for an old serial mouse). The port settings are all the same (9600N8-1) and I've reebooted, fiddled, checked/reset the BIOS in vain. I did once have a problem similar to this, but don't remember how I fixed it (not quite the same, IIRC). I've tried winpic with the same results. I have a modem on COM3, but this hasn't been an issue before. Serial is being driven by a MAX232 with charge pump caps. I've been writing a C# program that talks to it, and it also worked previously. What gives?
posted by IronLizard to technology (5 comments total)
You have two problems? A malfunctioning PIC programmer from JDM Microdevices and a PIC that you programmed, right?
If correct, the easiest thing to do is find another computer to test with the JDM box first, since you'll need it to program your PIC and test it out anyway. You do NOT need your C compiler for that. If you can get it to work on another PC with a clean install, then you can keep worrying the problem on your normal PC. If you can't, then it's time to send it back to JDM for repair. (To test it, you can used the same object files (the .s19 or .hex) that you created for the PIC program you mention is no longer working. )
On the target program, once you get a programmer working, write the simplest comm test program possible... a long delay and a single character out... such as a "!" or some such. That will let you resolve baud rate and framing issues, if there are any. If you are using a PIC with an internal RC clock, or an otherwise inaccurate or unstable time base, you'll get framing errors and gobbledygook (engineering term) due to oscillator drift (thermal). Try lower baud rates with higher divisors to find a baud rate that works. Look at the waveform of the serial character on a scope, if you have one or can borrow one. Compare it to the expected pattern. If the pattern is good, then it's a framing problem and you need to tweak your divisors a little or get a more stable oscillator.
Is the PIC target your design? Which PIC, btw?
I'm not a big fan of PICs, generally. I usually program the damn things in assembly language, and there is too much crap to take care of due to their paging structure. Ick. RISC... ick!
I personally prefer the 8051 variants and the Freescale 9S08 chips. Lots of good peripherals and cheap development tools, plus programming models that are just better, IMO.
posted by FauxScot at 5:13 AM on May 7, 2006