PDA

View Full Version : SerIn with Parallel Port output



bodgetts
- 6th November 2011, 23:41
Hi,

I have a master board with a 16f877 PIC that communicates with a slave board via the serout/serin commands. The slave board also has a 16f877 and basically just sits there waiting for a signal:

serin portd.1,T300,["BAC"],mydata

It waits for 'BAC' and then does something with the data that follows. This system works really well between my master/slave boards, and 300bps is more than enough for my purposes.

I would like to replace the master board with my PC parallel port for another project. Can I wire a data pin from my parallel port to the serin port (d.1) on my slave board? How would I simulate the correct bit rate, etc? Can I just bit-bang my data at 1/300th of a second per bit? I can't use any other pins on the slave pic, and can't use a serial port on the pc. Has anybody done this before? Any issues that I need to watch out for?

Thanks

HenrikOlsson
- 7th November 2011, 06:10
If you can get that type of control over the LPT-port you could definitely bit-bang it but wouldn't it be easier to use the serialport on the PC in conjunction with a MAX232 to bring the voltage of the line to the correct level? Depending on your actual need you may even be able to skip the MAX232, have a look at the SERIN/SEROUT sections of the manual, it'll tell you the details. Make sure you have the correct polarity (Inverted vs True) depending on if you use the MAX232 or not.

/Henrik.

mister_e
- 7th November 2011, 19:30
In 2011, I would definitely not use the parallel port for a serial comm... OR at least use the whole set of pins with handshake... OR generate a synchronous comm (SPI, I2C) with the parallel port.

if your on a dos level that's cool, but in Windows, it's a bit hard, not impossible, to predict/generate the exact timing of any hardware like the Printer port. Hence why there's dedicated serial ports... For educational purpose it's cool though...