about scan 7-segment display via parallel port

This is a discussion on about scan 7-segment display via parallel port within the C Programming forums, part of the General Programming Boards category; I have a question about scan 7-segment display with four 7-segement LED display, to display counting down timer with variable ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    2

    Question about scan 7-segment display via parallel port

    I have a question about scan 7-segment display with four 7-segement LED display, to display counting down timer with variable settings. And I have to show that using Turbo C program via a module of scan 7-segment connected to the parallel port of a computer. What I do not know is that is there a function of time in C that will will simulate the time that I entered? Just like the count down in a time bomb. For example, if I enter in the keyboard 05:30, it must count from 05:30 to 00:00. The left 2-digit in minutes and the right 2-digit in seconds. Please give me the function of time and how will I be able to display it?

  2. #2
    KingoftheWorld
    Guest

    Re: about scan 7-segment display via parallel port

    Originally posted by mobdawg
    I have a question about scan 7-segment display with four 7-segement LED display, to display counting down timer with variable settings. And I have to show that using Turbo C program via a module of scan 7-segment connected to the parallel port of a computer. What I do not know is that is there a function of time in C that will will simulate the time that I entered? Just like the count down in a time bomb. For example, if I enter in the keyboard 05:30, it must count from 05:30 to 00:00. The left 2-digit in minutes and the right 2-digit in seconds. Please give me the function of time and how will I be able to display it?
    What OS do you run on? Are you talking about
    countdown the clock in real-time display?

    KingoftheWorld

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    >What I do not know is that is there a function of time in C that
    >will will simulate the time that I entered?

    Not as far as I know. But you could easily write one yourself. Write a function which keeps the time. Each second decrease the number of seconds by one and each 60 seconds decrease the number of minutes by one, until 00:00 is reached. Shouldn't be very hard.

    You could use the function clock to determine when to call your timing function:

    #include <time.h>
    clock_t clock(void);

    >how will I be able to display it?

    Find out the port-number of your parallel port and find out how to use your display. Depending on how to use the display, you should write to the parallel port in order to show the time.

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    2

    scan 7-segment

    I have my code:

    __________________________________________________ __
    #include <stdio.h>
    #include <dos.h>
    int min,sec,min1,sec1,min2,sec2;
    int timer[10] = {0xFC,0x0C,0xD9,0x9D,0x2D,0xB5,0xF5,0x1C,0xFD,0xBD };
    float counter;
    main()
    {
    do {
    printf("\n\n Enter number of minutes: ");
    scanf("%d",&min);
    if(min>59||min<0){
    printf("\n Number of minutes must be from 0 - 59!");
    }
    }
    while(min>59||min<0);
    do {
    printf("\n\n Enter number seconds: ");
    scanf("%d",&sec);
    if(sec>59||sec<0) {
    printf("\n Number of seconds must be from 0 - 59!");
    }
    }while(sec>59||sec<0);
    if(sec>-1) {
    sec2=sec;
    if(sec>9) {
    sec2=sec-10;
    if(sec>19) {
    sec2=sec-20;
    if(sec>29) {
    sec2=sec-30;
    if(sec>39) {
    sec2=sec-40;
    if(sec>49) {
    sec=sec-50;
    }
    }
    }
    }
    }
    }
    sec1=(sec-sec2)/10;
    if(min>-1) {
    min2=min;
    if(min>9) {
    min2=min-10;
    if(min>19) {
    min2=min-20;
    if(min>29) {
    min2=min-30;
    if(min>39) {
    min2=min-40;
    if(min>49) {
    min2=min-50;
    }
    }
    }
    }
    }
    }
    min1=(min-min2)/10;
    for(min1=min1;min1>-1;min1--) {
    for(min2=min2;min2>-1;min2--) {
    for(sec1=sec1;sec1>-1;sec1--) {
    for(sec2=sec2;sec2>-1;sec2--) {
    clrscr();
    printf("\n\n %d%d:%d%d",min1,min2,sec1,sec2);
    for(counter=19000;counter>-1;counter--) {
    outportb(0x37A,0x0A);
    outportb(0x378,timer[sec2]);
    outportb(0x37A,0x09);
    outportb(0x378,timer[sec1]);
    outportb(0x37A,0x0F);
    outportb(0x378,timer[min2]);
    outportb(0x37A,0x03);
    outportb(0x378,timer[min1]);
    delay(4);
    }
    }
    sec2=9;
    }
    sec1=5;
    }
    min2=9;
    }
    getch();
    }
    __________________________________________________ __

    I not able to output a display static time. But all the 4 display are just blinking. Please look at my code and tell me the problem. Is there a problem on my delay?
    Last edited by mobdawg; 09-10-2002 at 08:43 PM.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    You can delete one of the double posts.... and please use code tags.

    >>I have my code
    Do you have a question about it?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parallel Port IO ops not working properly
    By microtechno in forum Linux Programming
    Replies: 16
    Last Post: 06-08-2009, 12:33 PM
  2. Parallel Port to USB controller and outb()
    By coletek in forum Linux Programming
    Replies: 1
    Last Post: 06-05-2009, 06:57 AM
  3. Replies: 3
    Last Post: 02-29-2008, 12:29 PM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. Segmentation Fault - Trying to access parallel port
    By tvsinesperanto in forum C Programming
    Replies: 3
    Last Post: 05-24-2006, 03:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21