I've been developing a tester using a Micro850 in Connected Components Workbench and part of that tester requires me to scan a barcode every test cycle to know which tests to run in that cycle. When I want to read what's in the buffer I use an ACB block to count the characters in there to both check to see if it's the correct length for a test as well as feed that length into an ARD block if the length is correct. The ARD block reads what's in the buffer if the length is correct and sends that info to the rest of the program to parse which tests are required. An ACL block clears the buffer regardless of whether or not the barcode length is correct and then it's ready for another testing cycle.
From every bit of documentation and online examples what I have seems to be a pretty standard way of doing something like this, but I'm running into some problems with clearing the buffer when the length is not correct. If the buffer length is either zero or the correct length for the ARD then things work perfectly. However, when I feed a non-zero incorrect barcode into this system, the buffer no longer gets cleared until I power cycle the PLC. I set up a testing environment that distills down my program into just counting, reading, and clearing the buffer seen below.
I manually toggle the ScanBarcode bit while testing and the correct barcode length (BarcodeScanLength) is 36.
Am I doing something horribly wrong here? The buffer clears fine if I run the ARD block regardless of whether or not the length is correct but then everything breaks if the length is greater than 82 which is more than the ARD block can handle. It seems to me that for whatever reason, if the ARD block is not happy then the ACL block cannot clear the buffer. Any help would be appreciated because I think that I don't fully understand how these blocks work and documentation on them is fairly basic.
From every bit of documentation and online examples what I have seems to be a pretty standard way of doing something like this, but I'm running into some problems with clearing the buffer when the length is not correct. If the buffer length is either zero or the correct length for the ARD then things work perfectly. However, when I feed a non-zero incorrect barcode into this system, the buffer no longer gets cleared until I power cycle the PLC. I set up a testing environment that distills down my program into just counting, reading, and clearing the buffer seen below.
I manually toggle the ScanBarcode bit while testing and the correct barcode length (BarcodeScanLength) is 36.
Am I doing something horribly wrong here? The buffer clears fine if I run the ARD block regardless of whether or not the length is correct but then everything breaks if the length is greater than 82 which is more than the ARD block can handle. It seems to me that for whatever reason, if the ARD block is not happy then the ACL block cannot clear the buffer. Any help would be appreciated because I think that I don't fully understand how these blocks work and documentation on them is fairly basic.