Want to drive 2-digit LED from PC

Discussion in 'The Projects Forum' started by WayneTho, May 30, 2009.

  1. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    I am looking for a simple way to drive a 2-digit 7-segment LED display from a PC. I have thought about parallel as interfacing would be pretty elementary, but I'm using Windows XP and I understand there are issues with controlling an LPT port from Windows XP without special routines. What I would like is a way to "TYPE" a number to a port and have it blank the display and then display the number I sent to it.

    Which would be the easiest in XP: serial, USB or parallel? I can figure out everything from the BCD to 7-segment decoder, logic circuits to make it work the way I want, and the 7-segment display. I just don't know how to interface them with a USB or serial port. The printer port wouldn't be hard but there's the software limitation again.

    Anyone have any thoughts as to how I can do this?
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
  3. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Hi Wayne. The Serial Port is by far the easiest to deal with but then I'm a bit biased in that regard. What are your software options? I mean are you a programmer that can access the port through a program that you will write? VB6.0 and VBNET access the Serial Port through an .OCX called MSComm.

    If you're not a programmer then Hyperterminal may be the way to go.

    http://www.seetron.com/ht_tip1.htm

    If you use Hyperterminal, or your own program, there are two basic ways you can send numeric data to the port.

    (1) You can send it as Byte data that's specified as Hex values that will be converted to Binary data at the receive end.

    (2) Use the PC's internal Modem and send the numeric data as DTMF (Dial Touch Tones) using AT Commands. The receive end (your circuit) will need a DTMF Decoder to interpret the DTMF codes.

    When you decide which direction you want to go with this let me know. I would be happy to write a program for you that would be easier and provide a cleaner interface than Hyperterminal. It would be a simple .EXE with no installation required. I just need to know if it will use DTMF or Binary.
     
  4. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Wayne, I forgot to mention that the cool thing about using DTMF is your circuit doesn't have to be directly connected to your Serial Port. It can be thousands of miles away and accessed through the Telephone lines.
     
  5. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    Well it's been a good many years since I did any programming other than BASIC, and then it was 6502 line assembly (without macro assembler). I've never really done any low-level language programs on Intel based PCs. I was hoping to be able to open a port and just type or copy data to it from a DOS VDM batchfile. I am trying to duplicate a "CREDIT DISPLAY" similar to what NeoGeo arcade machines have, for an arcade machine project I'm working on. I am going to extract the current credit value from a text file, probably by parsing it in Turbo BASIC (only language I know well enough to accomplish this), and then hope to copy it to the port.

    Obviously, I will have to convert the ASCII code to an appropriate code that would be interpreted correctly by the hardware that drives the display.
     
  6. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    DTMF might be problematic since this is inside an arcade machine and the sound card would be supplying sound to the game cabinet. The only way I could get DTMF to work (in my mind) would be to get a USB sound card and jack into the DTMF decoder so the tones wouldn't be heard by the gamer. It does sound like an interesting idea. I could probably even attach the device directly to the usb device (or even build it around the USB device).

    Hmmm, I think you might be on to something. I would have the challenge of converting a number into a two digit DTMF signal. What sort of outputs does a DTMF decoder chip have, BCD? If so, the BCD could drive the BCD to 7-segment decoder directly.
     
  7. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
  8. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    A few logic gates added between the BCD output and the 7-segment decoder can change any output to anything else though. The 8870 apparently uses a "1010" (10) to display a "0" on the display, so a few gates will re-arrange what is displayed when.
     
  9. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    In theory, I might be able to completely fore go the soundcard and DTMF tone generating program and just get a cheap modem, configured where it doesn't care if it hears a dialtone. Shouldn't I be able to sent number strings to the modem in an ATDT string and it will play the numbers back? If this will work, I simply have to get an RJ-11 plug and wire it into the DTMF decoder to display the numbers. I envision single digit numbers only lighting the righthand display and two digit numbers both the ten's and one's display.
     
  10. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Your sound card has nothing to do with DTMF. Touch Tones are generated by the modem and they haven't made a home PC without an internal modem in over a decade. The modem doesn't have to see a dial tone to generate DTMF. The Tel end of the modem only needs to see a resistive DC loop. When accessing the internal modem you're still accessing a serial port except it's internal and it interfaces to a RJ11 jack instead of a DB9. The RS232 end of the internal modem is the input side of the internal modem. BTW, the tones don't have to be audible. They only need to be present at the RJ11 jack to do with as you please.

    If you don't have an internal modem then I think you should go with direct connection to the serial port with Byte data. I only mentioned it because it's usually easily available.
     
    Last edited: May 30, 2009
  11. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    Actually the modem may be the easiest way but there are DTMF programs that will generate the proper tones via a soundcard. That was the first thing I thought of (write a program to generate two tones together from a 3x4 array). Doing it via serial, I will need to figure out what type of IC to use to get the serial data and convert it to BCD. I'm really good with simple logic gates and the likes, but I'm lost when it comes to knowing what the circuit to interface with the serial port should consist of.

    Here's a little background on myself, so you will know my level of expertise. I am 48 years old and I have been using computers since I was 18. My first computer was an Atari 400 which by the time I retired it, was seriously modified. I ran a bulletin board from that Atari and had to cobble together a ring-detect using a reed switch stuck into my old bell type telephone. I used the same Atari as a controller for a homemade telephone answering machine, with a digitized outbound message and a tape recorder for incoming. I built my own multi-OS switch board for my next computer (Atari 800XL) and used a line assembler to modify and write assembly code programs and routines. I aquired the motherboard for an ATR-8000 (CPM terminal & interface for Atari) and built a case for it. I used it off and on for a couple of years. I had a Percom SSSD floppy for the Atari and eventually replaced the floppy with a DSQD model in the same case. Replaced the controller in the Percom with the higher end version that allowed slave drives, when I found one at a local surplus store. A friend had a Tandy 1000EX and wanted a floppy drive add-on, but the cable was a proprietary 30 pin card socket. I got the specs from Tandy, and made a cable for his newly acquired 3.5" floppy drive. In '87 I got my first Intel PC and never got too deep into programming it, aside from the Turbo BASIC programming mentioned previously, and batchfile and 4DOS btm files. I have been building my own PCs since 1989. I have built numerous circuits from schematics (including a 256k memory controller for the Atari 800XL), and have designed some small circuits of my own. I also worked at Texas Instruments from 1979 thru 1996 and for the last 5+ years I was a MIL-STD-2000 certified Electronics Assembler (that's not to say I actually understood how everything worked).

    My biggest problem, I believe, is that I have attention deficit disorder and it's sometimes I just don't know where to start on a project. The logic is easy, the other stuff I have no clue...
     
    Last edited: May 31, 2009
  12. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    The more I think about this the more I think that going the DTMF rout will be low grade for your requirements. So start thinking serial data again. The MAX232 chip is a good start, as it's the chip that your serial port should interface to. For one thing, it converts the bipolar voltages of the serial port to TTL levels & visa versa. The serial port will be outputting HEX so you need a chip to read it. Am I correct that the 7 seg displays can be driven by a chip that inputs BCD?

    The members of this group have tremendous combined knowledge. I'm sure that someone will suggest the latest and greatest of available chips or chip to do the job. I haven't kept pace with the newer breed of some chips. I'm kinda still in a TTL world. One of our members signature says.. "You don't have to know everything. You just need to know how to find it!" Or something like that. :)
     
  13. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    Indirectly the 7-seg display can accept BCD. There is a BCD to 7-Seg Decoder (74LS47 and 74LS49) that will read BCD and there are also CMOS versions as well. I'm using an online logic trainer to play with circuits and gates and I'm getting refamiliarized in using them. I challenged myself with a problem that a student posted here a year ago - where he needed to input a 5 instead of 3 from a BCD to 7-seg configuration. I did it by decoding a "3" (0011) from the BCD and using it to control two XOR gates attached to bits 2 and 3, which effectively turns 0011 into 0101. I have even made my own working rudimentary BCD to 7-segment decoder using gates and an array configuration. Of course this is all in the virtual world.
     
  14. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Yeah, I'm aware that there's a CMOS version of about every TTL chip ever made.
     
  15. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Wayne, are you familiar with the PICAX chip line? They are a line of microcontrollers that are very inexpensive, easy to program and the Code Editor/Compiler is free!

    The PICAX series of chips can interpret serial data inputted as Hex or ASCII, which makes it easy to program them and talk to them through VB. A single 8 pin 08M chip is capable of reading serial ASCII input and outputting BCD to a BDC LED driver. Two of these chips will handle (2) 7seg displays. The PICAX 18A (18 pin dip) has 8 outputs, so it can handle (2) 7 seg displays.

    http://www.rev-ed.co.uk/picaxe/
     
  16. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    I'm looking into progably getting two 4026 CMOS "decade counter to 7-seg display" chips, cascade them together and drive them with a single pulsed line, probably from a PICAXE 08. I'm only concerned that pulsing 99 times (maximum value that a 2-digit decimal display can show) may cause the update to be visible. The PICAXE manual I downloaded from their website says it occurs so fast that the value appears to be instantly displayed. Basically the PICAXE will have to reset the first 4026 and then sent pulses to equal the number to be displayed. If it changes, the steps will all be repeated.

    I would rather have it redisplay the actual value from the log file each time it changes rather than simply decrementing or incrementing by one or more, since this would be much less complicated from a programming standpoint on my arcade machine.

    Also, any PICAXE chip prior to the 28 (I think) RC timing loop rather than a crystal, so it may be susceptible to heat inside the arcade cabinet. If this turns out to be the case, I may have to buy a higher-end chip with crystal frequency control. I don't know how much heat would be required to affect the timing of the chip enough to lose sync with the comport.
     
  17. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    That's odd. I don't know of any of the Picaxe chips that use RC as a time base. All the models that I've used or seen use ceramic resonators or crystals.
     
  18. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    I have no idea where I read it now. I was trying to go back through the different sites I've been on and search for timing, and crystal, etc, but to no avail. When I went back out and searched the mfg. website however I found that the lower versions have internal 4Mhz resonators and the higher versions require a 4Mhz external ceramic resonator. So... it goes to show you, you can't always trust everything you read on the Internet... :)
     
  19. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Wayne, you gotta be kidding! You're going to waste a microcontroller just to generate a series of pulses? When you transcend from pure electronics to microcontroller electronics you have to change your mindset. What you did before by adding components and changing component values are done by simply editing your code. One 08M can input serial data and output it as BCD. It doesn't do it automatically though, as you must write the code. I can change a few lines of code a hell of a lot faster than I can change component values.
     
  20. WayneTho

    Thread Starter Member

    May 29, 2009
    12
    0
    If I do that I'll have to multiplex the two digits, but I'm only looking at the simplest ideas first. I imagine there is considerably more code involved in multiplexing the displays. I understand I will need to alternately activate the common cathode on one display and then the other while outputting that digit's BCD equivalent. The 18 would be easier from that respect because no multiplexing would be required. I could output one BCD byte instead of two multiplexed BCD words.

    It's been awhile since I thought in 8-bit and 4-bit terms, so I hope I'm using the term "WORD" correctly.
     
Loading...