Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Breakpoints
#1
I would like to use breakpoints in my PLC to count when I go past a line. How do I add them, clear them, and view them in a watch window?

Can I have an example for motion and PLC programs?
Reply
#2
brad Wrote:I would like to use breakpoints in my PLC to count when I go past a line. How do I add them, clear them, and view them in a watch window?

Can I have an example for motion and PLC programs?

The syntax for setting a breakpoint is:

BPSET {program name}, {line offset} [.{command offset}]:{repetitions}

For example, the command

BPSET PLC 1, 2: 0

will cause PLC 1 to pause at the beginning of the third line (two lines offset from the top) on the first time through (zero repetitions).

The command BPSET PROG 7, 17.2: 99

will cause PROG 7 to pause at the third command (offset two from the start) of the 18th line (17 offset from top) on the 100th time through (99 repetitions).

A paused PLC program is restarted at this point with the RESUME {program name} command.

A paused motion program can also be restarted at this point with the RESUME {program name} command, but also with run and step commands.

If you set a breakpoint for one or more repetitions, after the first time it stops the program and you resume, the number of repetitions before pausing again is zero. If you want to set repetitions > 0 again, you must reissue the command.

You can clear a single breakpoint with the command:

BPCLEAR {program name}, {line offset} [.{command offset}]

You can clear all breakpoints with the BPCLEARALL command.

The first breakpoint you set uses data structure Bp[0], the second Bp[1], etc.

Bp[].Count indicates the number of repetitions left before a stop. The BPSET command forces it to the number of repetitions you specify. Each time the breakpoint is encountered, this value decrements. If it is 0 when the breakpoint is hit, the program pauses. If the breakpoint is cleared, it reports as "nan" (not-a-number). Other Bp[] elements are .Offset, .LineNumber, .LineOffset, .Index, .Code, and .Type. I haven't worked through all of these yet.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)