PDA

View Full Version : Clocking data with TxD during programming? (hardcore)



frdfsnlght
October 13th, 2002, 12:55 PM
:-? Looking at the various schematics for the UIRT in its various forms, I see that the TxD pin of the serial port is tied to RB6 on the PIC, which is used during ICSP for clocking the data in. How does this work?

My understanding is that the PIC wants 6 bits of instruction and 14 bits of data (plus 2 stop bits) during a LOAD DATA command (as an example) during ICSP. Additionally, it wants a 1us delay between the command and the data. How is this accomplished using the transmit line on the PC? I thought frames of bits were output in NRZ format which would make the 6/14 bit timing impossible, as well as unframable.

Admittedly, I haven't done any serial port programming on a PC in a looong time. Can you send single bits over the line? That would allow this to work. Maybe it would be easier if someone could supply me with the source to one of the various programmers.

frdfsnlght
October 13th, 2002, 12:55 PM
OK, maybe I can answer my own question, but I'd like confirmation from someone, please.

I did a little research on RS232 signaling to refresh my memory, which, apparently, needed it. From what I gather, you can use Txd for clocking and generate a single "pulse" by transmitting all-ones data, with no parity. That will generate a start bit by sending the TxD line high (the clock pulse). Then sending 0xFF (assuming 8 bit data) will drive the TxD line low. The stop bit also drives the line low and the "normal" state of TxD is low. So that's a clock pulse suitable for clocking in the data bit presented on the DTE line. Rinse and repeat, and you can program a PIC in-circuit.

Is my understanding of this correct? Is there anything I've overlooked or over-simplified?

The reason I'm asking this is that I need to write a PIC programmer into my application and, of course, I need to figure out how it's done.