Skip to content

PLCgen TwinCAT self-certification: division by zero exception

Test report

Tool Version
ESCET nightly-20241023-115319
TwinCAT v3.1 build 4020.56
Test suite v27

Setup of TwinCAT as described here: https://cstweb.wtb.tue.nl/4tc00/twincat/setup.html#twincat-install. Project generated as described here: https://eclipse.dev/escet/cif/tools/plcgen/twincat.html#twincat-usage.

Test case: expr_binary.cif

Encountered errors

When running the test, I encountered the following exception.

'Port_851' (851): Exception (Exception Code: 0xc000008e, SSE zero divide) in PLC Application Untitled1 Instance, Task PlcTask (RBP: 0xffffe180fb68ed10, RIP: 0xffff868f125b34c4, RSP: 0xffffe180fb68eb70), Area 0, Offset 0x6343c

It concerns line 773 of the generated PlcTask:

(* Perform update of discrete variable "a.and6". *)
a_and6 := a_vfalse AND DINT_TO_LREAL(a_vpos3) / DINT_TO_LREAL(a_vzero) = 0.0;

Addresses #1020 (closed) #679