Connect with us

seven segment display

Discussion in 'Electronic Basics' started by [email protected], Sep 22, 2006.

Scroll to continue with content
  1. Guest

    Hello,

    I am attempting to find a (multiplexing)seven segment display
    driver capable of driving at least 5 7seg drivers. I have found many
    but it seems they all have a synchronized serial input like SPI, but
    most of them are I2C. I would imagine this is to make designing with a
    uC easier, but what if I want to hook it up to my computers RS232
    serial port? Do they make chips that talk Asynchronous RS232? If they
    dont, is it feasible to make some sort of RS232 to I2C interface? I
    have attempted coding an imaginary I2C port using my parallel port and
    switching two pins trying to simulate the Data and Clock lines of an
    I2C port, but my little driver doesnt seem to like it. Has anyone run
    into this issue before?

    Thank you for your help,
    Rich
     
  2. In the days of MSDOS Philips had a simple circuit and a program to play I2C
    master using the parallel port of a PC. I build one, I worked with it.
    Should still be somewhere on the net although I did not find it lately on
    the Philps site. Maybe it's even somewhere in my attic.

    Chips that talk asynchronous RS232 are called UARTs. Still some stand alone
    chips maybe available somewhere, most UARTs are found in microcontrollers
    these days. Microcontrollers with I2C build in are also very common.

    I ever build a RS232-I2C converter using a PIC16F73. You can't use it as it
    was meant to be a slave device and you need a master. These days newer PICs
    are around with both I2C master/slave and a UART on board. The PIC16F873 for
    instance. Should be relatively easy to build the converter you want with it.

    petrus bitbyter
     
  3. Guest

    Petrus,

    Thank you for the reply. Another method I tried was to "bit-bang"
    my parallel port with this C++ code:

    #include <iostream.h>
    #include <stdlib.h>
    #include <dos.h>
    #include <conio.h>
    #include <stdio.h>
    #include <ctime>
    #include <windows.h>
    #include <math.h>


    void start();
    void stop();
    void command(int i);
    void senddata(int i);
    void ack();
    void address();

    int main()
    {
    int w,x,y,z,t;

    {
    t=1436;
    z=t/1000;
    y=(t-z*1000)/100;
    x=(t-y*100-z*1000)/10;
    w=t%10;




    start();
    address();
    command(2);
    stop();

    start();
    address();
    command(3);
    stop();

    start();
    address();
    command(5);
    senddata(w);
    stop();

    start();
    address();
    command(6);
    senddata(x);
    stop();

    start();
    address();
    command(7);
    senddata(y);
    stop();

    start();
    address();
    command(8);
    senddata(z);
    stop();



    }
    system("PAUSE");
    return 0;
    }


    void ack()
    {
    int ack=0;
    _outp(0x378,0); //SCL OFF SDA OFF ACKNOWLEDGE BIT (SET BY
    MAX6958)
    _outp(0x378,2); //SCL ON SDA OFF ACKNOWLEDGE BIT (SET BY
    MAX6958)
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,2); //SCL ON SDA OFF ACKNOWLEDGE BIT (SET BY
    MAX6958)
    _outp(0x378,2); //SCL ON SDA OFF
    sleep(10);
    while(ack!=2)
    {
    ack=_inp(0x378);

    }

    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    }
    void start()
    {

    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,2); //SCL ON SDA OFF START BIT
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF

    }

    void stop()
    {
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,3); //SCL ON SDA ON STOP BIT
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON STOP BIT
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    }

    void low()
    {
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,2); //SCL ON SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    _outp(0x378,0); //SCL OFF SDA OFF
    }

    void high()
    {
    _outp(0x378,1); //SCL OFF SDA ON
    _outp(0x378,1); //SCL OFF SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,3); //SCL ON SDA ON
    _outp(0x378,1); //SCL OFF SDA ON
    _outp(0x378,1); //SCL OFF SDA ON
    _outp(0x378,1); //SCL OFF SDA ON
    _outp(0x378,1); //SCL OFF SDA ON
    }

    void address()
    {
    low(); high(); high(); high(); low(); low(); high(); low(); ack();
    //A0 R/W
    }

    void senddata(int i)
    {
    if(i==0)
    {
    low(); low(); low(); low(); low(); low(); low(); low(); ack();
    }
    else if(i==1)
    {
    low(); low(); low(); low(); low(); low(); low(); high(); ack();
    }
    else if(i==2)
    {
    low(); low(); low(); low(); low(); low(); high(); low(); ack();
    }
    else if(i==3)
    {
    low(); low(); low(); low(); low(); low(); high(); high(); ack();
    }
    else if(i==4)
    {
    low(); low(); low(); low(); low(); high(); low(); low(); ack();
    }
    else if(i==5)
    {
    low(); low(); low(); low(); low(); high(); low(); high(); ack();
    }
    else if(i==6)
    {
    low(); low(); low(); low(); low(); high(); high(); low(); ack();
    }
    else if(i==7)
    {
    low(); low(); low(); low(); low(); high(); high(); high();
    ack();
    }
    else if(i==8)
    {
    low(); low(); low(); low(); high(); low(); low(); low(); ack();
    }
    else if(i==9)
    {
    low(); low(); low(); low(); high(); low(); low(); high(); ack();
    }

    }

    void command(int i)
    {
    if(i==1)
    {
    low(); low(); low(); low(); low(); low(); low(); high();
    ack(); //DECODE MODE
    low(); low(); low(); low(); high(); high(); high(); high();
    ack();
    }
    else if(i==2)
    {
    low(); low(); low(); low(); low(); low(); high(); low();
    ack();
    low(); low(); low(); high(); low(); low(); low(); high();
    ack(); //INTENSITY (CURRENTLY 32/64)
    }
    else if(i==3)
    {
    low(); low(); low(); low(); low(); low(); high(); high();
    ack();
    low(); low(); low(); low(); low(); low(); high(); high();
    ack(); //SCAN LIMIT (SELECT NUMBER OF DIGITS)
    }
    else if(i==4)
    {
    low(); low(); low(); low(); low(); high(); high(); high();
    ack(); //DISPLAY TEST
    }
    else if(i==5)
    {
    low(); low(); high(); low(); low(); low(); low(); low();
    ack(); //DIGIT 0 LS
    }
    else if(i==6)
    {
    low(); low(); high(); low(); low(); low(); low(); high();
    ack(); //DIGIT 1
    }
    else if(i==7)
    {
    low(); low(); high(); low(); low(); low(); high(); low();
    ack(); //DIGIT 2
    }
    else if(i==8)
    {
    low(); low(); high(); low(); low(); low(); high(); high();
    ack(); //DIGIT 4 MS
    }
    else
    {
    low(); low(); low(); low(); low(); low(); low(); low();
    ack();
    }

    }

    I am trying to interface with the MAXIM-IC MAX6958 chip. When I look at
    the waveforms my code creates on an O-Scope, it appears to be correct
    based of this data sheet. Perhaps I am missing a very simple I2C
    concept.
     
  4. Do you have enough information about I2C? The whole protocol is relatively
    critical. More info on links below.
    http://www.i2c-bus.org/fileadmin/ftp/i2c_bus_specification_1995.pdf
    http://www.nxp.com/acrobat_download/applicationnotes/AN10216_1.pdf
    Did some digging in the attic but did not found the program mentioned.

    petrus bitbyter
     
  5. john jardine

    john jardine Guest

    RS232 would be a nightmare. LPT is the way to go, either as straightforward
    clocked serial bits or the more convoluted i2c.

    You need to build a small adapter to run i2c lines.
    http://www.armory.com/~rstevew/Public/LPT/Lpt_i2c.gif
    Works fine. There's also ready made prog's out there, to allow easy use of
    the i2c commands.
    The one I use is only about 40 lines long, (but in Basic).
    john
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-