Gunitronics Posted September 9, 2019 Report Posted September 9, 2019 Using Visilogic 9.8.65. I have a project where a product recipe name is entered as a string and stored in a vector of MI integers (via the string variable edit box). The recipe name (integers) is stored in a data table. When the machine is running, from time to time it outputs the name of the recipe and other recipe parameters to the serial port. Currently I have the send function configured to send the line id of the data table, because I cannot seem to find an easy function to send the characters to the printer. It would be more meaningful for the operators to see the name of the product on the printout instead of looking at a numeric value. How do you send a user editable, variable string to the serial port ? Thanks
Cam Posted September 9, 2019 Report Posted September 9, 2019 Look at the protocol send FB. You can declare and ASCII variable in it to do what you are trying to accomplish.
Gunitronics Posted September 9, 2019 Author Report Posted September 9, 2019 I am not 100% sure what you are referring to, but I started poking around in the protocol send FB trying any possible options that could result in the previously entered string variable (product name) rebuilt from a vector of integers which are stored in the data table. The solution was to stream the vectors of MIs from the data table, converting one linked register to two bytes. I feel this is far from being trivial, maybe there was an example to demonstrate this operation or maybe there is a far simpler way to achieve what I was trying to do. 1. String variable entered by operator 2. MI40-MI 49 (20 characters) saved in a data table 3. reading the content of the data table and decoding the integers to pairs of characters 4. As a result, I finally see the decoded product name in the serial printout. Yay ! Do you think there is an easier way to print the user entered string variable to the serial port ?
MVP 2023 Joe Tauser Posted September 10, 2019 MVP 2023 Report Posted September 10, 2019 You got the Protocol Send right. You can create a string data type in a data table that will make your life much easier. Just right-click on the column header and define the string length. It looks like you've already figured out that you can rename the column. Double-click on the cell to edit it - remember to save. Retrieve the data with a Data Table Read Row into an integer array Then load the array into your Send block and trigger it. If you want to post your program I can poke at it for you. I'm always happy to help those who have put some effort in. Joe T.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now