Beckhoff Twiincat divide by zero error

matt_sd

Member
Join Date
Jan 2007
Location
Australia
Posts
96
Hello everyone.

Does anyone know if it is possible to stop Twincat being stopped when a divide by zero error occurs?

Many variables that are divided are changable via scada etc
The other alternative I am doing is at every calculation that divides (there are many), if variable = 0 then variable := 0.01

or not executing the divide calculation if variable = 0

This is a pain. I know AB control logix you can stop the processor from faulting on a divide by zero..


Any suggestions? Thanks
 
You should also report the attempt to divide by zero via an alarm (or similar) so you can fix the cause of the zero divide. You could write a function that performs division (i.e. do not use any explicit divides at all) and pass the function a string (or code number etc.) and then use the passed string for alarm reporting allowing you to track down the divide by zero without stopping the processor.
 
Search for CheckDivReal in the info system - you create a fuction with this name that will trap the divide by zero condition and can then be programmed to poke up an error message or log it or whatever. works a treat, but with a (slight) performance penalty that probably doesn't matter with recent hardware. (Similar functions exist to check for sub-range violations, etc)
 
Thanks Roger, L D[AR2,P#0.0],

yes checked out that CheckDivReal, this is a high speed system I'm developing (1mS scan), so I think I will just search through and prevent divide by zero on the cals that could divide by zero as infomation system says it will put a high load on the system

Thanks

Matt
 

Similar Topics

Hi everyone, This is my first time posting, so please forgive any omissions or mistakes. I am attempting to control the velocity of a stepper...
Replies
18
Views
954
Hello sameone have Beckhoff PLC Siemens Sinamics V90 configuration example?
Replies
0
Views
96
hello, I am using Beckhoff with TwinCAT3 and when I change or add some new hardware or for any reason, there is a mismatch in the real hardware vs...
Replies
1
Views
122
I have a Beckhoff CX7000 IPC with some digital I/O built-in and I additionally need two analog inputs 0-10V. Can I install both Ethernet terminals...
Replies
4
Views
201
Hello, We are currently working on a project that involves connecting a linear potentiometer to our Beckhoff PLC. After researching, we...
Replies
2
Views
185
Back
Top Bottom