using a PC serial port to control old logic ICs and shift registers - Page 1
Forum section: electronics / beginners

author: dentaku
author_rank: Frequent Contributor
timestamp: July 20, 2014, 01:42:21 am
content: I was looking at a 40 pin MM5451N LED Display Driver I got from an old General Instruments/Electrohome satellite receiver and from the datasheet I see it's basically just a 35bit shift register that can sink current from the cathodes of common anode 7 segment displays.I've never used a serial-in parallel-out shift register before (or any shift-register) but I see how it works.http://pdf1.alldatasheet.com/datasheet-pdf/view/9256/NSC/MM5451N.htmlThis got me thinking,Is it practical to use the serial port of a computer to send data to shift registers like that, or even old 4000 series stuff like BCD to 7seg ICs?I see that the RS232 ports on most PCs swing from -13V to +13 V and use negative voltages to represent 1 and positive for 0.https://www.sparkfun.com/tutorials/215So... Can't you just use an optocoupler, like MIDI has always used and a transistor inverter circuit to convert the output of a serial port to something useable with 4xxx or 74xx ICs?This is of course ignoring the task of setting up software to do this, I'm just interested if it's possible hardware-wise.like this

author: Prime73
author_rank: Regular Contributor
timestamp: July 20, 2014, 02:09:39 am
content: take a look at RS232 to TTL converter. here is an example:http://project.irone.org/simple-rs232-to-ttl-level-converter.html

author: David Hess
author_rank: Super Contributor
timestamp: July 20, 2014, 05:08:44 am
content: A discrete RS-232 to logic level translator is trivial. With a bit of resistor and diode signal conditioning, you can even just use a logic gate input. They will not perform as well as a real level translator but are certainly useable.The hard part will be shifting the serial data without a synchronous clock unless you just want to bit-bang the flow control signals.

author: fcb
author_rank: Super Contributor
timestamp: July 20, 2014, 09:12:50 am
content: I built a UART out of 4000 series something like 20years ago - it was painful.If you have a serial port (and not USB), and your not bothered about speed (and you know a little something about programming), then you can use the CTS/DTR lines to create a clock & data.

author: rob77
author_rank: Super Contributor
timestamp: July 20, 2014, 09:27:20 am
content: 1. good old MAX232 - it's still available.2. resistors + zenershave a look at DASA serial programmers for AVR - those are doing exactly what you want - converting the RS232 levels to logic level with zeners and resistors.

author: dentaku
author_rank: Frequent Contributor
timestamp: July 20, 2014, 06:44:55 pm
content: Quote from: David Hess on July 20, 2014, 05:08:44 amYup, I guess it's a bit more involved with things that need a clock. I also wasn't looking to transmit any data back to the computer, just send serial data out.The MM5451N LED Display Driver is interesting though"Using a format of a leading ‘‘1’’ followed by the 35 data bits allows data transfer without an additional load signal The 35 data bits are latched after the 36th bit is complete"But his would still require an appropriate clock. I guess I could shift in the data by hand using pushbuttons just to see if it still works. I've seen people do that on Youtube tutorials.I'd be happy just to get an LED to blink firstStill... would my optocoupler and transistor idea work?

author: Andreas
author_rank: Super Contributor
timestamp: July 20, 2014, 06:53:27 pm
content: Quote from: dentaku on July 20, 2014, 06:44:55 pmYou should spend a 1N4148 diode either in series or parallel in reverse to the photocoupler diode.The reverse voltage for the photocoupler is usually limited to max around 5V.With best regardsAndreas

author: dentaku
author_rank: Frequent Contributor
timestamp: July 20, 2014, 07:07:42 pm
content: Quote from: Andreas on July 20, 2014, 06:53:27 pmI was wondering what happens when the negative voltage signals are connected to the optocoupler.So you mean like this...

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 20, 2014, 07:14:16 pm
content: If your pc has a parallel port then you may want to consider using it instead of the serial port. Parallel ports use 5V TTL logic levels so they are easier to use than RS-232 when it comes to interfacing with digital ICs.

author: Andreas
author_rank: Super Contributor
timestamp: July 20, 2014, 07:21:20 pm
content: Quote from: dentaku on July 20, 2014, 07:07:42 pmThat should work

author: dentaku
author_rank: Frequent Contributor
timestamp: July 20, 2014, 08:00:02 pm
content: Quote from: TerminalJack505 on July 20, 2014, 07:14:16 pmThe thing about Parallel ports is that I can't find how I would output data from them in a simple way.Everything I've read suggest that the parallel port isn't easy to use on modern OSes after Win98.Is there some kind of application that's designed for people who want to mess with sending to LPT ports just for experiments like this?

author: rob77
author_rank: Super Contributor
timestamp: July 20, 2014, 08:06:34 pm
content: Quote from: dentaku on July 20, 2014, 08:00:02 pmunder Linux it's not a problem to bitbang the printer port.

author: TerminalJack505
author_rank: Super Contributor
timestamp: July 20, 2014, 08:46:27 pm
content: Quote from: dentaku on July 20, 2014, 08:00:02 pmYep. I forgot about that. There are 3rd-party drivers/libraries for Windows to make parallel port programing easier but I've never played around with them.

author: David Hess
author_rank: Super Contributor
timestamp: July 20, 2014, 08:54:01 pm
content: Quote from: dentaku on July 20, 2014, 06:44:55 pmA UART which automatically detected the baud rate and just updated its parallel output synchronously with the stop bit would be ideal but I know of no such device. It would be easy to to implement with a PIC or similar microcontroller.QuoteAn optocoupler is even a good idea since the galvanic isolation will make it more robust. Just beware of reverse breakdown in the LED and transistor.

author: kolonelkadat
author_rank: Regular Contributor
timestamp: July 21, 2014, 01:33:32 am
content: Quote from: dentaku on July 20, 2014, 08:00:02 pmon windows just #include conio.h and use the _outp() functionhttp://msdn.microsoft.com/en-us/library/733szwah.aspxlpt1 should be 0x378eta: you wont be able to get this to run in a gui, but command line should still work. Id test it, but I dont have a parallel port to play with.

author: IanB
author_rank: Super Contributor
timestamp: July 21, 2014, 02:07:24 am
content: Quote from: kolonelkadat on July 21, 2014, 01:33:32 amThis is not going to work on any variant of Windows from XP onwards, command line or not. It's not the GUI that is the obstacle, but the user mode privileges of any program you run on a modern operating system.You could find a time machine and go back to Win98, but the better solution is to use a device driver and access library, for example:http://logix4u.net/parallel-port/16-inpout32dll-for-windows-982000ntxpHowever, if you want to do accurate bit timing, this is probably not going to be sufficient. The best approach to accurate signal timing on external hardware is to use an intermediate controller such as a microcontroller board. You send high level instructions to the micro using serial comms or USB and let the micro generate the output bitstream or signals using its own clock for timing.

author: dentaku
author_rank: Frequent Contributor
timestamp: July 21, 2014, 10:51:40 am
content: Quote from: IanB on July 21, 2014, 02:07:24 amAfter looking into it some more it turns out that the parallel Port is more interesting to me than Serial. I'm just looking for something as simple as blinking an LED first to see if I worksI have two old unused laptops that have parallel ports.I got LPT_pattern to work a few times using the circuit on this page to trick the port into working but now it seems to do nothing.http://tomeko.net/other/lpt_winxp/lpt_winxp.php?lang=enOh well it was just an experiment.I know this is all just stuff you get a cheap Arduino to do but I was just wondering if it was possible to do with those old ports that nobody uses anymore.

author: lapm
author_rank: Frequent Contributor
timestamp: July 21, 2014, 11:55:53 am
content: Anything is bossible, its just matter of cost in time, skills and hardware needed that you have to pay for it...

author: geek
author_rank: Unknown
timestamp: July 30, 2014, 07:42:25 am
content: I used parallel port with windows XP, not very hard at all (found some working examples online). If you are interested I can find you a link.

author: dentaku
author_rank: Frequent Contributor
timestamp: July 30, 2014, 11:21:10 am
content: Quote from: geek on July 30, 2014, 07:42:25 amShure. I've got old computers running XP with parallel ports that aren't be used for anything anyway.

author: Paul Price
author_rank: Super Contributor
timestamp: July 30, 2014, 12:37:34 pm
content: Use PORTTALK22 and you get complete Parallel Port Input´Output control from Win XP.Attached.I also use the powerful, but super-legacy full-screen DOS "IDE", with the DOS Prompt compilable programming language QBX(QBASIC 4) to create quite complex programs that make use of the PC parallel port to communicate I/O easily with MCUs or any other hardware devices.PORTTALK22 also enables Microsoft Visual C and Visual Basic access to the Parallel Port.With PORTTALK22 and QBX QBASIC no fancy QBX code or amu other Windows configuration is necessary, you simply use simple commands like:OUT &H378, byte 'where byte is a 8-bit valuebyte=Inp(&H378) 'Hardware Port Address of LPT1: 8-bits of I/0 immediately available.(Assumes parallel port LPT1 is the port available on your PC).You can forget about all the other control lines like *ACK, *Busy, *Strobe etc. or if you want, else use them to your advantage by modifying or examining their bits in their respective input and control registers &H379, &H37A.

author: dentaku
author_rank: Frequent Contributor
timestamp: July 30, 2014, 04:33:05 pm
content: Wow, Qbasic.I've never used it before but I seem to remember it.

author: Paul Price
author_rank: Super Contributor
timestamp: July 30, 2014, 05:15:07 pm
content: If you have 6 MBytes of harddisk space to spare, you can download it easily.http://www.qbasic.net/en/qbasic-downloads/compiler/qbasic-compiler.htmUse this link to download Genuine Microsoft QBasic: QBX 4.5 or 7.1 for free, no registration, no problems.

author: geek
author_rank: Unknown
timestamp: August 03, 2014, 03:57:53 am
content: I used one of these under Win XP , don't remember which onehttp://logix4u.net/parallel-porthttp://www.hytherion.com/beattidp/comput/pport.htmAnd don't forget to set DisableWarmPoll key in registry, if you don't want Windows to write random values to the port periodically

author: westfw
author_rank: Super Contributor
timestamp: August 03, 2014, 06:38:26 am
content: QuoteUm. No. You can shift the voltage levels easily enough, but shift registers require a clock signal to shift the data in from their data input, and a PC's "async" serial port does not provide such a clock. Deriving such a clock from the bit pattern on the serial port is complex enough that the easiest way to do it these days probably involves a small microcontroller. (That'd be a nice little project, too. 6 or 8 pin microcontroller, one input (async serial, clamped from rs232 voltages, autobauded async serial, two outputs: clock and data.)

author: rob77
author_rank: Super Contributor
timestamp: August 03, 2014, 09:11:40 am
content: Quote from: westfw on August 03, 2014, 06:38:26 amlet me slightly disagreebasically i agree with what you wrote, but i disagree with the statement it's complex... have look at the DASA programmers for AVR. the ISP programming interface is data and clock - and it's driven easily by the PC's serial port. you can't achieve high transfer speeds and low jitter on the clock, but it's pretty usable up to some speeds.for higher speeds the micro is the way to go - as you suggested.

author: David Hess
author_rank: Super Contributor
timestamp: August 03, 2014, 01:21:45 pm
content: The DASA interface just bit-bangs the RS-232 port without using the asynchronous transmitter or receiver. 4 lines are used for one synchronous clock output, one data output, one data input, and one reset output.Used this way, the RS-232 port is not going to be any faster than bit-banging a parallel port.

author: rob77
author_rank: Super Contributor
timestamp: August 03, 2014, 02:05:57 pm
content: Quote from: David Hess on August 03, 2014, 01:21:45 pmyes exactly, no-one says ot will be fastbut my post was a reaction to theQuote.