ZyXEL Omni TA 128 User Guide - Page 144

Binary value, Decimal value, Hexadecimal value, Operation, Example-1, Example-2, Binary, ATS38=n

Page 144 highlights

O note: The values used in the example below differ from the actual values in the S-register and are used for demonstration purposes only. Read the value from S38 using ATS38? Convert it to binary, using the following weight table: Bit Binary value Decimal value Hexadecimal value 0 00000001 1 $01 1 00000010 2 $02 2 00000100 4 $04 3 00001000 8 $08 4 00010000 16 $10 5 00100000 32 $20 6 01000000 64 $40 7 10000000 128 $80 To set bit 3 to 1 (binary), do a logic OR operation with the value. Operation Example-1 Example-2 Binary Dec. Hex Binary Dec. Hex. 10001000 136 $88 01000000 64 $40 OR 00001000 8 $08 00001000 8 $08 10001000 136 $88 01001000 72 $48 To set bit 3 to 0 (binary), you must invert the value using a logic NOT operation and then do an logic AND operation. NOT 00001000 8 $08 00001000 8 $08 11110111 247 $F7 11110111 247 $F7 AND 10001000 136 $88 01000000 64 $40 10000000 128 $80 01000000 64 $40 Finally, using the result decimal value, issue an ATS38=n to set the register. 132

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173

132
O
note:
The values used in the example below differ from the actual
values in the S-register and are used for demonstration purposes
only.
Read the value from S38 using ATS38?
Convert it to binary, using the following weight table:
Bit
Binary value
Decimal value
Hexadecimal value
0
00000001
1
$01
1
00000010
2
$02
2
00000100
4
$04
3
00001000
8
$08
4
00010000
16
$10
5
00100000
32
$20
6
01000000
64
$40
7
10000000
128
$80
To set bit 3 to 1 (binary), do a logic OR operation with the value.
Operation
Example-1
Example-2
Binary
Dec.
Hex
Binary
Dec.
Hex.
10001000
136
$88
01000000
64
$40
OR
00001000
8
$08
00001000
8
$08
10001000
136
$88
01001000
72
$48
To set bit 3 to 0 (binary), you must invert the value using a logic
NOT operation and then do an logic AND operation.
NOT
00001000
8
$08
00001000
8
$08
11110111
247
$F7
11110111
247
$F7
AND
10001000
136
$88
01000000
64
$40
10000000
128
$80
01000000
64
$40
Finally, using the
result
decimal value, issue an
ATS38=n
to set
the register.