Jump to content

Debugging the code step by step


Recommended Posts

Hello everyone.

I've been given a code by a person who left the company with a bug that never got solved. The PLC works about 800-900 operations a day, and 1-2 times it will stop in the middle. Is there a way to make a log that I can look at cycle by cycle?  Or step by changes in states, I don't need to see every single one, but I could solve that myself if I could get the data.  I saw DataXport as an option but it has resolution of 1min, and my full operation lasts 20sec.

As the PLC is on a machine in production I can't play with it to test solutions, so what I need is a way to find a problem without interfeering.

PLC is V700 if it makes a difference

Link to comment
Share on other sites

  • MVP 2023

Initially I'd actually log every single parameter change to a data table with a matching time.  Or log all  variable parameters to a data table every operation start.  It all depends on how many variables change during the full operation.  

If the data tables are going to fill quickly, they can be shifted onto an SD for later viewing.

This method would at least give you a starting point, by imitating those variables to see if you can consistently reproduce the error.

cheers, Aus

Link to comment
Share on other sites

On 5/1/2020 at 12:54 AM, Ausman said:

Initially I'd actually log every single parameter change to a data table with a matching time.  Or log all  variable parameters to a data table every operation start.  It all depends on how many variables change during the full operation.  

If the data tables are going to fill quickly, they can be shifted onto an SD for later viewing.

This method would at least give you a starting point, by imitating those variables to see if you can consistently reproduce the error.

cheers, Aus

Thank you for that suggestion. 
I'd like to make a check if there's a change to any of my bits, and if there is a change in any I'd put them all in a table with addition of cycle counter and some program timers and counters.

How would that influence cycle time? I would idealy clear the table every cycle, write to it, for every single change, so probably few thousand rows, and if the timer gets too long I know there's an error, I'd copy it to the SD card so I can access it later.

I saw a command to add a row to datatable in SD card, but for the tables in memory I have to specify which row? Am I missing something or do I have to make my own counter?

I'd love to test that on my own but I have access only to a PLC that's in production, and this is solving a minor problem so not critical enough to let me access to just play with it. I'll of course try it all, just would like to know if it's even possible/reasonable the way I want it before I mess something up :D

Link to comment
Share on other sites

  • MVP 2023
3 hours ago, DinoLet said:

but for the tables in memory I have to specify which row? Am I missing something or do I have to make my own counter?

I generally just shift the entire table down one row then write to the top row every time. No need to keep track that way and it's easily accomplished in a single ladder rung.

Link to comment
Share on other sites

  • MVP 2023

Apart from your initial issue, if you don't have a spare PLC for an important process, you should have.   Then you can use the spare to trial programming changes to at least get syntax and ladder work fundamentally correct.

cheers, Aus

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...