Posted 19 Sep 2023 The PLC controlling our refrigeration plant is a PLC 5/40. Years ago I wrote a VB6 GUI program using INGEAR's ABCTL driver; It still works perfectly under XP, but, needing Windows 10, I had to get their NET.ABLINK driver and rewrite in C# (at which I'm no guru). The program's basic function is to make one read of 5 ints, one read of 2 ints, three reads of 8 bits of DI, three reads of 8 bits of DO, assigning the read values to screen elements after each read. These calls are in a Timer event that allows plenty of time for the I/O. There are thread.sleep calls between the reads as well, to give them more than enough time to complete. (I also put some test code nonsense in Button events). My C# program works initially, but after 1 to 10 minutes it begins to spit error messages about startIndex, which I can't even find in my solution. If I let it run it it throws an error for incorrect data types, as though the PLC is responding to an int read with bit data. I attach a screen shot of the failure, as well as the form code (to open in Notepad or code editor). Thanks for any tips you can provide! RefrigForm.cs RefrigForm.cs.txt RefrigForm.cs Share this post Link to post Share on other sites
Posted 25 Sep 2023 PLC 5/40 and serial comms and only 250 ms between read calls. I'd try a 60,000 values in the thread.sleep command and see if things behave differently. {One read per minute to start and if that works drop down. } Just a quick off the cuff first idea! Share this post Link to post Share on other sites
Posted 25 Sep 2023 On 9/19/2023 at 3:33 PM, BLees said: error messages about startIndex, which I can't even find in my solution That strikes me as a likely threading error. I'm not familiar with those libraries (haven't touched .Net in ages), but that kind of error rings a bell in the back of my head. See if the docs are annotated with multithreading limitations or best practices. (You generally cannot interact with GUI components from a non-gui thread in most platforms.) Share this post Link to post Share on other sites