The Intrdef statement should be executed on the first scan of the program using the 1st.Scan special bit.
This is a trivial version of a CF that you would call on the 1st.Scan:
' Init CF called on first scan of ladder logic to initialize the system
'
INTRDEF 18, TimerInterrupt, 1000 ' interrupt once every second (1000 ms)
[/font][/color]
Now you need to write the custom function, "TimerInterrupt". A simple version might look like this:
' TimerInterrupt
'
DM[1] = DM[1] + 1 ' keep a running count of interupts processed
ToggleIO TestBit ' toggle an OUTPUT bit so that you can "see" that the program is working
[/font][/color]
The CF, TimerInterrupt is not triggered by a ladder logic rung, but is triggered every 1000 ms by a hardware timer in the PLC.
Best regards,
Gary D*ickinson