Practical Programming COMP153-08S Lecture 1: Starting to program.
(ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf ·...
Transcript of (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf ·...
![Page 1: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/1.jpg)
ASCII Table (7-bit)(ASCII = American Standard Code for Information Interchange)
Decimal Octal Hex Binary Value (Keyboard)------- ----- --- ------ -----
![Page 2: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/2.jpg)
ASCII Table (7-bit)(ASCII = American Standard Code for Information Interchange)
Decimal Octal Hex Binary Value (Keyboard)------- ----- --- ------ -----
Choi = $43 $68 $6F $69
![Page 3: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/3.jpg)
ASCII Table (7-bit)(ASCII = American Standard Code for Information Interchange)
Decimal Octal Hex Binary Value (Keyboard)------- ----- --- ------ -----
Choi = $43 $68 $6F $69
0100 0011 => ‘C’ = $430100 0011 => C = $430100 0011 => MSB odd parity
![Page 4: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/4.jpg)
ASCII Table (7-bit)(ASCII = American Standard Code for Information Interchange)
Decimal Octal Hex Binary Value (Keyboard)------- ----- --- ------ -----
Choi = $43 $68 $6F $69
0100 0011 => ‘C’ = $430100 0011 => C = $430100 0011 => MSB odd parity1100 0011 => MSB even parity
![Page 5: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/5.jpg)
ASCII Table (7-bit)(ASCII = American Standard Code for Information Interchange)
Decimal Octal Hex Binary Value (Keyboard)------- ----- --- ------ -----
Choi = $43 $68 $6F $69
0100 0011 => ‘C’ = $43 0110 1111 => ‘o’ = $6F0100 0011 => C = $430100 0011 => MSB odd parity1100 0011 => MSB even parity
0110 1111 => o = $6F1110 1111 => MSB odd parity0110 1111 => MSB even parity
![Page 6: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/6.jpg)
100 0011 => ‘C’ = $430100 0011 => MSB odd parity
110 1111 => ‘o’ = $6F1110 1111 => MSB odd parity
1100 0011 => MSB even parity 0110 1111 => MSB even parity
P it Ci itParity Circuit
D7 D6 D5 D4 D3 D2 D1 D0 = P
![Page 7: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/7.jpg)
![Page 8: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/8.jpg)
![Page 9: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/9.jpg)
0100 0011 => ‘C’ = $430100 0011 => MSB odd parity1100 0011 => MSB even parity
D6 D5 D4 D3 D2 D1 D0 = P1 0 0 0 0 1 1 = P
Even Parity
1 1 0 0 0 0 1 1
Even Parity
D7 D6 D5 D4 D3 D2 D1 D01 1 0 0 0 0 1 1
![Page 10: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/10.jpg)
![Page 11: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/11.jpg)
Boolean Algebra (Binary Logic)
Timing
![Page 12: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/12.jpg)
Boolean Algebra (Binary Logic)
Timing
Input
O t tOutput
![Page 13: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/13.jpg)
Boolean Algebra (Binary Logic)
Timing
Input
O t tOutput
TpAND
Input
Output
0 ns10 ns
![Page 14: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/14.jpg)
Boolean Algebra (Binary Logic)
Timing
I t B
Input A
Input B
Output
![Page 15: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/15.jpg)
Boolean Algebra (Binary Logic)
Timing
I t B
Input A
Input B
Output
![Page 16: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/16.jpg)
![Page 17: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/17.jpg)
a b c d z0 0 0 0 0
Converting truth table0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 1
to Boolean equation
0 0 1 1 10 1 0 0 00 1 0 1 00 1 1 0 00 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 01 0 0 1 01 0 1 0 01 0 1 1 11 1 0 0 11 1 0 1 11 1 1 0 11 1 1 1 1
![Page 18: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/18.jpg)
a b c d z0 0 0 0 0
Converting truth table0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 1
to Boolean equation
0 0 1 1 10 1 0 0 00 1 0 1 00 1 1 0 00 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 01 0 0 1 01 0 1 0 01 0 1 1 11 1 0 0 11 1 0 1 11 1 1 0 11 1 1 1 1
![Page 19: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/19.jpg)
a b c d z0 0 0 0 0
Converting truth table0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 1
to Boolean equation
0 0 1 1 10 1 0 0 00 1 0 1 00 1 1 0 0
z = a’b’cd+ a’bcd
b’ d 0 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 0
+ ab’cd+ abc’d’+ abc’d 1 0 0 1 0
1 0 1 0 01 0 1 1 1
+ abc d+ abcd’+ abcd
1 1 0 0 11 1 0 1 11 1 1 0 11 1 1 1 1
![Page 20: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/20.jpg)
a b c d z0 0 0 0 0
Converting truth table0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 1
to Boolean equation
0 0 1 1 10 1 0 0 00 1 0 1 00 1 1 0 0
z = a’b’cd+ a’bcd
b’ d 0 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 0
+ ab’cd+ abc’d’+ abc’d 1 0 0 1 0
1 0 1 0 01 0 1 1 1
+ abc d+ abcd’+ abcd
1 1 0 0 11 1 0 1 11 1 1 0 1
= ab + cd
1 1 1 1 1
![Page 21: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/21.jpg)
a b c d z0 0 0 0 0
Converting truth table0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 1
to Boolean equation
0 0 1 1 10 1 0 0 00 1 0 1 00 1 1 0 0
z = ab + cd
0 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 01 0 0 1 01 0 1 0 01 0 1 1 11 1 0 0 11 1 0 1 11 1 1 0 11 1 1 1 1
![Page 22: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/22.jpg)
Converting BooleanEquation to truth table
X
Y
X = ab
Y = cdY
z = X + Y = ab + cd
![Page 23: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/23.jpg)
a b c d X Y zConverting BooleanEquation to truth table
X = ab
Y = cd
z = X + Y = ab + cd
![Page 24: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/24.jpg)
a b c d X Y z
0 0 0 0Converting Boolean
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
Equation to truth table
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
X = ab
Y = cd1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
z = X + Y = ab + cd
1 1 1 1
![Page 25: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/25.jpg)
a b c d X Y z
0 0 0 0 0Converting Boolean
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
Equation to truth table
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
X = ab
Y = cd1 0 1 1 0
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
z = X + Y = ab + cd
1 1 1 1 1
![Page 26: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/26.jpg)
a b c d X Y z
0 0 0 0 0 0Converting Boolean
0 0 0 1 0 0
0 0 1 0 0 0
0 0 1 1 0 1
0 1 0 0 0 0
Equation to truth table
0 1 0 0 0 0
0 1 0 1 0 0
0 1 1 0 0 0
0 1 1 1 0 1
1 0 0 0 0 0
1 0 0 1 0 0
1 0 1 0 0 0
1 0 1 1 0 1
X = ab
Y = cd1 0 1 1 0 1
1 1 0 0 1 0
1 1 0 1 1 0
1 1 1 0 1 0
z = X + Y = ab + cd
1 1 1 1 1 1
![Page 27: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/27.jpg)
a b c d X Y z
0 0 0 0 0 0 0Converting Boolean
0 0 0 1 0 0 0
0 0 1 0 0 0 0
0 0 1 1 0 1 1
0 1 0 0 0 0 0
Equation to truth table
0 1 0 0 0 0 0
0 1 0 1 0 0 0
0 1 1 0 0 0 0
0 1 1 1 0 1 1
1 0 0 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 0 0 0
1 0 1 1 0 1 1
X = ab
Y = cd1 0 1 1 0 1 1
1 1 0 0 1 0 1
1 1 0 1 1 0 1
1 1 1 0 1 0 1
z = X + Y = ab + cd
1 1 1 1 1 1 1
![Page 28: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/28.jpg)
a b c d X Y z
0 0 0 0 0 0 0X
0 0 0 1 0 0 0
0 0 1 0 0 0 0
0 0 1 1 0 1 1
0 1 0 0 0 0 00 1 0 0 0 0 0
0 1 0 1 0 0 0
0 1 1 0 0 0 0
0 1 1 1 0 1 1
Y
1 0 0 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 0 0 0
1 0 1 1 0 1 1
X = ab
Y = cd1 0 1 1 0 1 1
1 1 0 0 1 0 1
1 1 0 1 1 0 1
1 1 1 0 1 0 1
z = X + Y = ab + cd
1 1 1 1 1 1 1
![Page 29: (ASCII = American Standard Code for Information ...kxc104/class/cmpen297B/08s/lec/L07Code.pdf · (ASCII = American Standard Code for Information Interchange) Decimal Octal Hex Binary](https://reader030.fdocuments.net/reader030/viewer/2022040807/5e49ca1cce1de5111971eafb/html5/thumbnails/29.jpg)