Author Topic: using a PC serial port to control old logic ICs and shift registers  (Read 11335 times)

0 Members and 1 Guest are viewing this topic.

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
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.html

This 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/215

So... 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
 

Offline Prime73

  • Regular Contributor
  • *
  • Posts: 174
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #1 on: July 20, 2014, 02:09:39 am »
take a look at RS232 to TTL converter. here is an example: http://project.irone.org/simple-rs232-to-ttl-level-converter.html
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #2 on: July 20, 2014, 05:08:44 am »
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.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #3 on: July 20, 2014, 09:12:50 am »
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.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #4 on: July 20, 2014, 09:27:20 am »
1. good old MAX232 - it's still available.
2. resistors + zeners

have 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.
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #5 on: July 20, 2014, 06:44:55 pm »
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.

Yup, 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 first :)

Still... would my optocoupler and transistor idea work?
 

Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3244
  • Country: de
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #6 on: July 20, 2014, 06:53:27 pm »
Still... would my optocoupler and transistor idea work?
You 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 regards

Andreas
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #7 on: July 20, 2014, 07:07:42 pm »
Still... would my optocoupler and transistor idea work?
You 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 regards

Andreas

I was wondering what happens when the negative voltage signals are connected to the optocoupler.
So you mean like this...
 
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #8 on: July 20, 2014, 07:14:16 pm »
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.
 

Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3244
  • Country: de
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #9 on: July 20, 2014, 07:21:20 pm »

I was wondering what happens when the negative voltage signals are connected to the optocoupler.
So you mean like this...

That should work
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #10 on: July 20, 2014, 08:00:02 pm »
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.

The 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?
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #11 on: July 20, 2014, 08:06:34 pm »
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.

The 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?

under Linux it's not a problem to bitbang the printer port.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #12 on: July 20, 2014, 08:46:27 pm »
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.

The 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?

Yep.  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.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #13 on: July 20, 2014, 08:54:01 pm »
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.

Yup, 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 first :)

A 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.

Quote
Still... would my optocoupler and transistor idea work?

An 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.
 

Offline kolonelkadat

  • Regular Contributor
  • *
  • Posts: 202
  • Country: us
  • Obviously, windows are central to Windows.
    • Force Project X
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #14 on: July 21, 2014, 01:33:32 am »
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.

The 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?

on windows just #include conio.h and use the _outp() function
http://msdn.microsoft.com/en-us/library/733szwah.aspx

lpt1 should be 0x378
eta: 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.
« Last Edit: July 21, 2014, 01:35:22 am by kolonelkadat »
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11882
  • Country: us
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #15 on: July 21, 2014, 02:07:24 am »
on windows just #include conio.h and use the _outp() function
http://msdn.microsoft.com/en-us/library/733szwah.aspx

lpt1 should be 0x378
eta: 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.

This 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-982000ntxp

However, 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.
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #16 on: July 21, 2014, 10:51:40 am »
on windows just #include conio.h and use the _outp() function
http://msdn.microsoft.com/en-us/library/733szwah.aspx

lpt1 should be 0x378
eta: 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.

This 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-982000ntxp

However, 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.

After 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 works :) I 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=en
Oh 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.
 

Offline lapm

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: fi
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #17 on: July 21, 2014, 11:55:53 am »
Anything is bossible, its just matter of cost in time, skills and hardware needed that you have to pay for it...  :)
Electronics, Linux, Programming, Science... im interested all of it...
 

Offline geek

  • Supporter
  • ****
  • Posts: 21
  • Country: au
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #18 on: July 30, 2014, 07:42:25 am »
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.
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #19 on: July 30, 2014, 11:21:10 am »
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.

Shure. I've got old computers running XP with parallel ports that aren't be used for anything anyway.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #20 on: July 30, 2014, 12:37:34 pm »
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 value

 byte=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.
« Last Edit: July 30, 2014, 05:24:39 pm by Paul Price »
 

Offline dentakuTopic starter

  • Frequent Contributor
  • **
  • Posts: 881
  • Country: ca
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #21 on: July 30, 2014, 04:33:05 pm »
Wow, Qbasic.
I've never used it before but I seem to remember it.
« Last Edit: July 30, 2014, 04:37:08 pm by dentaku »
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #22 on: July 30, 2014, 05:15:07 pm »
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.htm

Use this link to download Genuine Microsoft QBasic:   QBX 4.5 or 7.1   for free, no registration, no problems.
« Last Edit: July 30, 2014, 05:20:22 pm by Paul Price »
 

Offline geek

  • Supporter
  • ****
  • Posts: 21
  • Country: au
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #23 on: August 03, 2014, 03:57:53 am »
I used one of these under Win XP , don't remember which one

http://logix4u.net/parallel-port
http://www.hytherion.com/beattidp/comput/pport.htm

And don't forget to set DisableWarmPoll key in registry, if you don't want Windows to write random values to the port periodically
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #24 on: August 03, 2014, 06:38:26 am »
Quote
Is it practical to use the serial port of a computer to send data to shift registers like that
Um.  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.)
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #25 on: August 03, 2014, 09:11:40 am »
Quote
Is it practical to use the serial port of a computer to send data to shift registers like that
Um.  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.)

let me slightly disagree ;) basically 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.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #26 on: August 03, 2014, 01:21:45 pm »
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.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: using a PC serial port to control old logic ICs and shift registers
« Reply #27 on: August 03, 2014, 02:05:57 pm »
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.

yes exactly, no-one says ot will be fast ;) but my post was a reaction to the
Quote
"and a PC's "async" serial port does not provide such a clock."
.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf