Home > Software engineering >  VB with external I/O card
VB with external I/O card

Time:12-17

Excuse me, ladies and gentlemen:
VB is running on event driven mechanism, such as after the click execute a function, want to ask is there any way to make this function
Under the condition of without affecting its operation has been performed? Is to make the program execution in each scan cycle, as like in DOS
The BASIC programming, also is the same effect and PLC.
I now have a piece of I/O card, always inspect the status of external the abrupt stop switch, has been found that the abrupt stop switch is pressed, that is,
I/O card data read back to 0, should immediately blockade output, I have thought of using the timer triggering event, but this is too slow,
I want to read right away to the I/O card level change,

Excuse me what method?

CodePudding user response:

Use multithreading,

CodePudding user response:

Don't you "peripheral equipment", notify the ability?
Should not so!

Peripherals you want to read information, it should be a communication mechanism,
So, should be "stop switch and press", through the device of communication mechanism to "program" instructions, data
"Program" will have to receive the data processing of the request message, at this point in the program for the corresponding processing,

CodePudding user response:

refer to the second floor Chen8013 response:
"peripheral" don't you, don't offer the ability to notice?
Should not so!

Peripherals you want to read information, it should be a communication mechanism,
So, should be "stop switch and press", through the device of communication mechanism to "program" instructions, data
"Program" will have to receive the data processing of the request message, at this point in the program for the corresponding processing,


An I/O card, no supporting mechanism, realizing the VB?

CodePudding user response:

Use Timer control doesn't work?

CodePudding user response:

Exotic flower of the solution, will only make you sidetrack.
Time control is almost the highest can reach the precision of 10 ms, if you still feel too late, then don't try to use VB to solve the problem.

In general, the real-time system you can use the "low-level languages such as C or C + + write directly control layer, and then in addition to write the human-computer interaction (but it is too trouble for low-level language)

PLC actually run inside what also not by industrial PC program to control, it comes with both memory and processor, industrial computer is used to give the user control parameters or deal with the late data.

This program could you: C an I/O card is the basic control application background, and then through the other way and VB program communication, users only dealing with VB program,

Communication very much, you can even use the network protocol to control from the other computer.

CodePudding user response:

Then you can direct the DO WHILE LOOP, * * processing, so the fastest
TIMER accuracy of 10 milliseconds, that you can use the SLEEP 1 so just stop for a second, test again

CodePudding user response:

Then you can direct the DO WHILE LOOP, * * processing, so the fastest
TIMER accuracy of 10 milliseconds, that you can use the SLEEP so you only 1 stop a millisecond, test again

CodePudding user response:

Precision design idea has a problem, the timer is around 15 ms, about their time on the code within the 30 ms,
If this time is not enough precision, communications equipment on time was also need into consideration, a back and forth communication may take 5 ~ 10 ms
Real time requirements so high, can use VB or with PC is not appropriate,

CodePudding user response:

Write the along while all gone
  • Related