Hello everyone! I am currently utilizing a Siemens 1515 PLC with TIA Portal V19 Upd 2. Is there a way to replicate the Snapshot function and copy snapshots to Start values? My setup includes a barcode scanner that captures names, article numbers, and stored recipes. This information is stored in a User-Defined Type (UDT) within an Array in a Database (DB). It would be beneficial to have the ability to save this data. Additionally, I am implementing loops to search for specific data. Here is an example of the code I am using: ``` FOR #index := 0 TO 9 DO IF #BarcodeIn_Field1 = #Product[#index].BarCode THEN #NewProcessCycle_Product1 := #Product[#index]; END_IF; END_FOR; ``` While this loop effectively locates items, I am interested in determining if the loop finishes without any matches. For instance, if the scanned value is not found in the database.
Swedeleaner is asking if there is a way to replicate the features of Snapshot and copy snapshots to Startvalues. This involves working with a barcodescanner to scan names, article numbers, and stored recipes, all of which are stored in a User Defined Type (UDT) within an Array in a database. Swedeleaner would like to be able to save this information. Do you want to know if the loop function completes without any matches? The following code snippet can be used to check for hits: #hit_found := FALSE; FOR #index := 0 TO 9 DO IF #BarcodeIn_Field1 = #Product[#index].BarCode THEN #hit_found := TRUE; #NewProcessCycle_Product1 := #Product[#index]; END_IF; END_FOR;
JesperMP asked: What are your specific goals for this? Where do you want to save the data and for what purpose? Here is a suggested code snippet to help you achieve your objectives: Code: #hit_found := FALSE; FOR #index := 0 TO 9 DO IF #BarcodeIn_Field1 = #Product[#index].BarCode THEN #hit_found := TRUE; #NewProcessCycle_Product1 := #Product[#index]; END_IF; END_FOR; Thank you Jesper for your assistance, your expertise was invaluable. I simply want an extra layer of security for the data. I have inputted all necessary parameters as initial values. The operators will input new data (products) into the data block as required. To avoid accidental deletion of records in the database while adjusting the PLC settings, storing them as initial values could serve as a precautionary measure.
If you are looking to achieve specific outcomes, simply capturing and saving snapshots as initial values may suffice. However, you may require a more robust solution. One option is to establish a database to retain data with starting values and incorporate a 'reset to factory values' button on the Human-Machine Interface (HMI). When this button is triggered on the HMI, the following code can be implemented: IF #reset_button_activated THEN "MyDB".values := "MyDB_initial".values; #reset_button_activated := FALSE; END_IF. Alternatively, if the information resembles a recipe, there are various methods available for storing and resetting recipes.
One useful feature of Siemens programming is the WRIT_DBL function, which allows you to transfer current values to start values in a different data block. It is possible for both the source and destination of WRIT_DBL to be the same data area, but for added safety, it is recommended to use a temporary data block and perform two separate WRIT_DBL actions. Keep in mind that after using WRIT_DBL, you will need to update the datablock from the online project to the offline project, as the start values will have changed and the blocks will no longer be equal. According to the help files, "The content of work memory is not changed during the copy process," indicating that the current values remain unchanged and only the start values are updated in the destination datablock after the write command is executed.
When making adjustments to the PLC system, a simple error could lead to the loss of important data stored in the database. This raises concerns about the overall security and reliability of the system. In the world of computing, it is widely believed that data only truly exists when there are multiple copies available, as stated in "Schofield's Law of Computing". Therefore, it is crucial to have backup measures in place to prevent data loss. One possible solution is to utilize the capabilities of the PLC system, such as saving recipes and copying data to an SD card for retentive memory. For example, Siemens PLCs offer the option to transfer data from a data block to an SD card, ensuring that important information is preserved even during power cycles. Furthermore, data can also be securely transferred to an external FTP server for additional backup and accessibility. By implementing these practices, operators can mitigate the risk of data loss and ensure the smooth operation of the system. It is essential to prioritize the importance of data protection and implement the necessary measures to safeguard against potential threats.
From your explanation, it sounds like you're making efficient use of the PLC. As per my knowledge, you cannot replicate the Snapshot function directly in TIA Portal. There's no out-of-the-box feature to accomplish this currently. However, you could potentially create your own functionality to write snapshot values to Start values by manually coding it. This would require keeping track of snapshot values and writing to Start values on certain triggers. As for the code, you might consider implementing a Boolean variable to check whether a match has been found in your loop. Initialize it as FALSE before the loop, and then set it as TRUE if a match is found. If the variable remains FALSE after the loop completes, you'll know that there were no matches. For instance: ``` #NoMatch := TRUE; FOR #index := 0 TO 9 DO IF #BarcodeIn_Field1 = #Product[#index].BarCode THEN #NoMatch := FALSE; #NewProcessCycle_Product1 := #Product[#index]; END_IF; END_FOR; ``` With this addition, if `#NoMatch` remains TRUE after the loop, that means the scanned value was not found in the database.
Hello! You could add a flag variable before your loop that checks if any matches were found. Initialize that flag as 0 (meaning no matches found). When a match is found within the loop, set the flag to 1. At the end of the loop, if the flag remains 0, you'll know that no matches were found. Regarding your first question about replicating the Snapshot function, as far as I know, TIA Portal does not offer a direct method to copy snapshots to Start values. You could consider saving your UDT array in a DB that loads at startup (Startup OBs). However, this might require some careful consideration about how you manage your data.
Hey! It sounds like you’re making great use of your Siemens PLC setup! To replicate the Snapshot function, one approach you could take is to manually copy the values from your UDT instances to another structure designated as your "Start values." You might want to create a separate UDT instance specifically for storing snapshots when you trigger that operation—perhaps using a specific input trigger signal. As for your loop, you can introduce a flag variable, like `#FoundFlag`, which you set to TRUE upon a match and check its value after the loop to see if any matches were found. If it remains FALSE, then you know that the scanned value wasn’t found in your database. Hope that helps!
Hey there! It sounds like you have a solid setup with the Siemens PLC and TIA Portal. To replicate the Snapshot function and copy it to Start values, you could consider using a dedicated function block that captures the current state of your UDT and stores it in a separate DB for easy retrieval later. As for your loop, to determine if any matches were found, you could introduce a boolean flag, say `#matchFound`, that you set to `TRUE` inside the loop whenever there’s a match. After the loop, you can check this flag to know if any products were matched. This way, you can easily handle scenarios where the barcode isn't found. Good luck with your project!
✅ Work Order Management
✅ Asset Tracking
✅ Preventive Maintenance
✅ Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Answer: To replicate the Snapshot function and copy snapshots to Start values in Siemens 1515 PLC with TIA Portal V19 Upd 2, you can consider implementing a solution that involves storing data from a barcode scanner in a User-Defined Type (UDT) within an Array in a Database (DB).
Answer: Yes, you can save data from a barcode scanner by creating a User-Defined Type (UDT) to store names, article numbers, and recipes. Storing this information in an Array within a Database (DB) allows for efficient data management and retrieval.
Answer: In Siemens 1515 PLC programming, to check if a loop finishes without any matches, you can implement a logic that tracks the loop's progress. For example, you can set a flag variable before the loop starts and change its value if a match is found. After the loop completes, you can check the flag's final value to determine if any matches were found.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.