|
-
March 6th, 2001, 10:06 AM
#1
Reading 3 inputs
I have a program that reads and writes data to and from a parallel port. I want to read three inputs (say inputA, inputB, inputC). But I don’t know which one I will be reading first. I can read one input using the following code.
Read inputA
Do While not inputA
Read inputA
'there is more code here
Loop
How can I read 3 inputs randomly? I am thinking of using 3 Timer controls but I don’t know how. Here is an example how the function should read.
Read InputA, Read InputB, Read InputC,
Read InputB, Read InputB, Read InputA,
Read InputC, Read InputB, Read InputA,
Read InputA, Read InputA, Read InputA,
-
March 7th, 2001, 07:14 AM
#2
Re: Reading 3 inputs
Use Multiple threads so that one thread keeps on checking one port. You will be using C++ to read from the ports anyway, aren't you.
-
March 7th, 2001, 08:05 AM
#3
Re: Reading 3 inputs
Just wondering if you can use the random number generator:
function ReadPort()
int nSelect = int((3-1+1)*rnd()-1)
select case nSelect
case 1:
Read InputA
case 2:
Read InputB
case 3:
Read InputC
end select
end function
Hope this helps 
-Cool Bizs
Good Luck,
-Cool Bizs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|