Thread: Speed of Loops.

  1. #1
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002

    Speed of Loops.

    while (receive[x]!='\0')
         int Byte=Read_Input();
         if ((Byte!=0) && (y==0)
         if ((Byte!=0) && (y==1))
         if (y==2)
    This code is used to retrieve a character from the paralel port...the Read_Input function checks the parallel port by using inportb() to see if anything has been sent yet....the if statements check to see if the port has found anything...when it does...2 other functions are ran to get the bits bak into an array.........anyways the point is...sending a character over the parallel port, you have to split bits up into 2 sections because there are only 5 input pins.......but if I send them back to back (the sending side of the software), the receiving side won't have time to put each of them together before the next one hits...I was wondering if I could use a simple small delay on the sending side to where the receiving loop would get each one at a different time...but I need to know how fast a loop like above runs so I will know how much of a delay to put on the sending side..I thought about using just a second delay each....BUT that would cause the program 2 second just to send one character.....and that sucks balls............Can I use a much smaller delay (and how small) and still be assured that they will get there not running into each other? Or any other ideas...? Maybe I'm overlooking something...I don't know.......

  2. #2
    Set up a clock routine (using a callback), and then send each piece of info every 110 miliseconds. You can adjust as necessary.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I am very new . . . :(
    By Eternalglory47 in forum C++ Programming
    Replies: 6
    Last Post: 09-05-2008, 11:29 AM
  2. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 12:40 AM
  3. Replies: 6
    Last Post: 01-08-2006, 02:49 PM
  4. increased net speed
    By PING in forum A Brief History of
    Replies: 20
    Last Post: 03-29-2005, 07:05 AM
  5. Best way to show speed?
    By CompiledMonkey in forum C Programming
    Replies: 6
    Last Post: 11-17-2002, 04:42 PM