12-01-2015 05:23 PM
Hi guys,
I'm writing an application that takes input from four different sources and picks whichever one is best according to a choice algorithm. The first two sources are input manually, when when a user clicks a button (no way to automate these unfortunately), the third source is from a serial comms device, and the fourth source is in an Access Database on the local network.
What I'd like to be able to have is an event generated when we get bytes at the port (from the serial source), and also when a new value is added to the database.
Is this possible?
12-02-2015 04:20 AM
I dont think its possible to generate an event for these directly but you can easily do it indirectly. You must already have a code which detects if there is a serial port / database event occured. You must execute these part of the code periodically and if you detect a change you can call a custom event, or you can take care of it right at the loop where these algorithms are running.
If they are fast to check you can put them into the timeout case of an Event structure.
12-02-2015 06:41 AM
My suggestion is to keep the serial reading and database checking in seperate loops and then use User Events to send the latest data to your main loop that is using the event structure.