Skip to main content
Knowledgebase
Home
Renesas Electronics Europe - Knowledgebase

What is the result of the division by "0"?

Latest Updated:02/28/2012

Question:

What is the result of the division by "0"?

Answer:

M16C Family does not have a function to detect the division by "0".
As stated in the software manual of each MCU Series, when the divider value is "0", the overflow flag (O flag) in the FLG Register becomes "1" (the division result is undetermined). The division by "0" is detectable by checking the divider using an overflow interrupt. The jump address of an overflow interrupt is assigned in the fixed vecter table and an interrupt can be generated by executing the INTO instruction. The INTO instruction is a nonmaskable interrupt.

Ex)
 DIV.B
 INTO

After the DIV.B instruction is executed, if the O flag is "1", the INTO instruction generates an overflow interrupt. If the O flag is "0", an interrupt is not generated and the next instruction is executed.

Suitable Products
M32C/8A
M32C/88
M32C/87
M32C/85
M32C/84
M32C/83
M32C/80
M16C/62A
M16C/62A(M16C/62T)
M16C/62M
M16C/62N
M16C/62N(M3062GF8NFP, M3062GF8NGP)
M16C/62P
M16C/63
M16C/64A
M16C/64C
M16C/65
M16C/65C
M16C/6C
M16C/6N4, M16C/6N5
M16C/6NK, M16C/6NL, M16C/6NM, M16C/6NN
M16C/5L, M16C/56
M16C/5LD, M16C/56D
M16C/5M, M16C/57
M16C/30P
M16C/29
M16C/28
M16C/26A
M16C/1N