Fortune Telling Collection - Comprehensive fortune-telling - What instructions does Mitsubishi plc use to convert floating-point numbers into integers?

What instructions does Mitsubishi plc use to convert floating-point numbers into integers?

Mitsubishi plc uses INT instruction to convert floating-point numbers into integers.

This instruction converts binary integers into binary floating-point numbers; Constants k and h are automatically converted in each floating-point operation instruction and are not processed in FLT instruction.

Use printf to output the number of bytes occupied by int:

printf("%d ",sizeof(int));

In addition to int types, there are short, long and long long types that can represent integers.

Extended data

Int sends an interrupt to CPU in assembly language.

The format is INT vec.

Vec is the interrupt vector number, and its value is 0~255. The CPU calls the interrupt routine corresponding to the kernel according to this vector number. The instruction operation is:

1 、( SP)←(SP)-2、((SP)+ 1:(SP))←(FR)

2 、( IF)←0、(TF)←0

3 、( SP)←(SP)-2、((SP)+ 1:(SP))←(CS)

4 、( SP)←(SP)-2、((SP)+ 1:(SP))←(IP)

5 、( CS)←(vec*4+2)、(IP)←(vec*4)

The INT vec instruction only affects IF and TF (set them to zero).

Baidu encyclopedia -INT