My train of thought for the button to stop when the main interface key triggering event, inform the PLC corresponding pressure switch to automatic mode through insulation switch relay, have created a c # read write PLC thread, button to stop button after the triggering event will create a void readdata1 () thread as automatic mainframe applications, read M100 approximately 1 send instrument code to the COM port, when a thread in the next cycle to dev4bool1=true; Not repeating the same statement, when COM ports have returned data on the data of the first floor to judgment, to the second step, the question now is when the COM port receives the data how to notify the void readdata1 () thread I of article 1 of the code I have got the data to the second step operation, such as writing dev4bool1=true; Feel a bit wonky, because the same COM port should I send 5 code, is likely to go wrong, the second a program to write a lot of if statements they advice please, give a reference to the main frame of a single docking equipment is no problem won't didn't experience be made automatically
CodePudding user response:
You sent a bus (bus),The window itself, or the micro service now, you can see a thing, called bus,
Everyone on the bus programming good,
Ps: you can also look at rose robot system, the core of his design as the window of IO bus, upnp do not have what distinction,
CodePudding user response:
This is basically a "will only 1, not 2, 3,... 10000 "the design problem,Designer communication program, signaling protocol design, will be sending a message number and the other do match the confirmation number, and on (you say) ReadData link to make correction (events) is designed, so the API user can send logic at the same time no news of order, but for the operating context logic has relationship with the news of the messages (in the previous step) is used to monitor specific event callbacks message confirmation, such as
...
Var MSG=encapsulation (inputData);//for equipment to do the first thing
Device1. SendMessage (MSG, x=& gt;
{
If (x) confirmation number==MSG) send number)
{
//here to do the second thing
}
});
This is async/await such as asynchronous strategy to solve the programming style, make the whole program BuKa died, very natural, and asynchronous,
"A lot of people will only 1, not 2 and 4... 10000 ", is also the most simply will only send messages, only the most simple to receive messages, as if to see articles every word seemed to understand, but the content of the article and to solve the problem of don't understand, this is because there is no further step to design a accurate callback event mechanism, so that at least half the programming design can't do it,
CodePudding user response:
I again, for example, such as "gateway router," it for LAN internal host foreign access request, converted to a specific port on a router, and then send the message, its own routing address table, make the internal and external to a focal point of time the news of the port can accurately by internal resend the LAN host IP and port, which is "with a little heart" design precision correction process,Who don't have a tiny bit of idea, once the face of programming problem "from 1 to 2 and 4... 10000 ", the nature is lazy, they are not programming,
CodePudding user response:
When you write "cycle" of a single design, write a little bit complicated if judgment, to write a more than (2) more and more design Boolean value status, exponential variable chaos can make logical interference, less in the middle "bool mark", design a "soul" of the basic framework, forget the name of the underlying words and more actual architecture from their system, will produce the idea of a stable,