Вы находитесь на странице: 1из 25

Mark V / HMI

Binary Numbers

A. Radicati 11/2002

Basics

0 1 2 3 4 5 6 7 8 9
Decimal

0 1
Binary

A. Radicati 11/2002

Basics
1 0 0 1 1 0 1 0
Byte

Nibble

Bit

A. Radicati 11/2002

Basics

1 0 0 1 1 0 1 0
7 6 5 4 3 2 1 0
Most Significant Bit (MSB)

Least Significant Bit (LSB)

A. Radicati 11/2002

Conversion

7 9 2 2 5 3 0 1
107 106 105 104 103 102 101 100

1 x 100
0 x 101
3 x 102
5 x 103
2 x 104
2 x 105
9 x 106
7 x 107
79,225,301
A. Radicati 11/2002

Conversion

1 0 0 1 1 0 1 0
27 26 25 24 23 22 21 20

0 x 20
1 x 21
0 x 22
1 x 23
1 x 24
0 x 25
0 x 26
1 x 27
154
A. Radicati 11/2002

Conversion
2
2
2
2
2
2
2
2

154
77
38
19
9
4
2
1
0

Remainder

0
1
0
1
1
0
0
1
1 0 0 1 1 0 1 0
A. Radicati 11/2002

Hexadecimal
Decimal
26,922
43,893
61,099
61,925
10,102
60,874

Binary
110100100101010
1010101101110101
1110111010101011
1111000111100101
10011101110110
1110110111001010

A. Radicati 11/2002

Hexadecimal
0
1
2
3
4
5
6
7
8
9

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001

A
B
C
D
E
F

1010
1011
1100
1101
1110
1111

D5
5E
1D

11010101
1011110
11101

A. Radicati 11/2002

g
Mark V / HMI Analog Values
Sign Bit

0101011011101011
Most Significant Byte

Least Significant Byte

A. Radicati 11/2002

g
Mark V / HMI Analog Values
Maximum Positive Value

01111111 11111111
1 x 214
1 x 213
1 x 212
1 x 211

or

215 1 = 32,767

32,767

A. Radicati 11/2002

g
Mark V / HMI Analog Values
Twos Complement

1 010010111001011
~ 1010010111001011
0101101000110100
1
0101101000110101
=
23,093

Invert
Add 1

1010010111001011 = -23,093
A. Radicati 11/2002

g
Mark V / HMI Analog Values
Maximum Negative Value

1 000000000000001
~ 0111111111111111
1000000000000000
1
1000000000000001
=
-32,767

A. Radicati 11/2002

g
Mark V / HMI Analog Values
Hardware Values

32768
Gain
32768
2048

Hardware Value
Value

Hardware Value
500

Hardware Value = 8000

A. Radicati 11/2002

Shifting
Binary
0 1 0 0 1 1 0 1

Decimal
77

Shift
0

154

-1

0 0 0 1 0 0 1 1 0 1

19

0 0 1 0 0 1 1 0 1

38

0 0 0 0 0 1 0 0 1 1 0 1

0 1 0 0 1 1 0 1 0

A. Radicati 11/2002

Shifting
Binary
0 1 0 0 1 1 0 1

Decimal
77 x 20

0 1 0 0 1 1 0 1 0 77 x 21

Shift
0
-1

0 0 0 1 0 0 1 1 0 1

77 x 2-2

0 0 1 0 0 1 1 0 1

77 x 2-1

0 0 0 0 0 1 0 0 1 1 0 1

77 x 2-4

Number x 2-Shift
A. Radicati 11/2002

Shifting
Shift blocks are used for scaling analog
values.
Multiply and Divide blocks need a shift
input to scale the output correctly.
Scale gains must be multiples of 2 of each
other.

A. Radicati 11/2002

Mark V / HMI Addition

Always add, subtract, or compare numbers


of identical scale types.
Verify that there will be no overflow.

A. Radicati 11/2002

Mark V / HMI Addition


Name Value
IN1 36 Hz
IN2 23 Hz

Scale Type
Gain
FREQ
8192 (213)
FRQLN 64 (26)

SHIFT

IN2
7

input
shift n -N
2

A. Radicati 11/2002

Mark V / HMI Addition


32768
8192

IN1Hardware
36

IN1Hardware = 144
32768
64

IN2Hardware
23

IN2Hardware = 11776
A. Radicati 11/2002

Mark V / HMI Addition

IN2Scaled = 11776 x 2-7 = 92


ResultHardware = IN1Hardware + IN2Scaled

= 144 + 92 = 236
32768
8192

236
Result

Result = 59 PSI
A. Radicati 11/2002

g
Mark V / HMI Multiplication
Insure correct unit of the output for the
inputs.
Verify that there will be no overflow.
Input a shift.

A. Radicati 11/2002

g
Mark V / HMI Multiplication
Calculating Shift

Multiplication: Bproduct Bmultiplicand Bmultiplier


Division:

Bquotient Bdividend + Bdivisor

Where B is the exponent of the Gain


when expressed as a power of two.

A. Radicati 11/2002

g
Mark V / HMI Multiplication
Name
TEMP
TIME
OUT

Value
Scale Type
900 F
TF
60 Sec
SEC16
?? F/Sec T_SEC

Gain
4096 (212)
2048 (211)
256 (28)

Shift = Bquotient Bdividend + Bdivisor


= 8 12 + 11
=7
A. Radicati 11/2002

g
Mark V / HMI Multiplication
DVD - Divide

TEMP
TIME
7

dividend

quotient

OUT

divisor

shift

-N
2

A. Radicati 11/2002

Вам также может понравиться