computer engineering: digital logic · 2015-10-30 · computer engineering: digital logic ....

7
Digital Logic The input is‘1’ when the buon is pressed. The output is ‘1’ when the LED is ON. Unknown chip 1 is : ____________________________________ Unknown chip 2 is : ____________________________________ Unknown chip 3 is : ____________________________________ A B A AND B A OR B A XOR B 0 (unpressed) 0 (unpressed) 0 (off) 0 (off) 0 (off) 0 (unpressed) 1 (pressed) 0 (off) 1 (on) 1 (on) 1 (pressed) 0 (unpressed) 0 (off) 1 (on) 1 (on) 1 (pressed) 1 (pressed) 1 (on) 1 (on) 0 (off) A B Unknown 1 Unknown 2 Unknown 3 0 0 0 1 1 0 1 1 Computer Engineering: Digital Logic

Upload: others

Post on 04-Jan-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

Digital Logic

The input is‘1’ when the button is pressed. The output is ‘1’ when the LED is ON.

Unknown chip 1 is : ____________________________________

Unknown chip 2 is : ____________________________________

Unknown chip 3 is : ____________________________________

A B A AND B A OR B A XOR B

0 (unpressed)

0

(unpressed)

0

(off)

0

(off)

0

(off)

0 (unpressed)

1

(pressed)

0

(off)

1

(on)

1

(on)

1

(pressed)

0

(unpressed)

0

(off)

1

(on)

1

(on)

1

(pressed)

1

(pressed)

1

(on)

1

(on)

0

(off)

A B Unknown 1 Unknown 2 Unknown 3

0 0

0 1

1 0

1 1

Computer Engineering:

Digital Logic

Page 2: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

Computers aren’t very smart. They can only do exactly what you tell them to do, and they can

only “think” in ones and zeroes.

In our world, we think in letters, numbers, words, ideas, and concepts. So how do we make

computers understand us?

In order for computers to understand what we want them to do, they need to convert

characters into binary. They use what is referred to as ASCII (“AS-KEY”), which stands for the

American Standard Code for Information Interchange. This will take a character and convert it

into a number.

This number can be represented in an infinite number of different systems. The number

system called “decimal” is what you learn in school and what you use to do your math

homework in. But, we can represent numbers using other systems. The two most common

number systems, other than decimal, are “hexadecimal” and “binary”.

In hexadecimal, we have 16 different digits that we can use to represent a number. In decimal,

we only have 10 (0-9), so we have to use letters to supplement the numbers! For a

hexadecimal number, you can see any digit from 0-9, or any letter from A-F to represent the

number.

Binary is more restrictive, and can only use two digits (0-1). This is what computers use to do

different operations.

In decimal: 12 In hexadecimal: C In binary: 1100

So, if we use ASCII, we can encode any character into a decimal number, a hexadecimal

number, or a binary number!

Take the letter “R”, for example.

In decimal: 82 In hexadecimal: 52 In binary: 01010010

Computer Engineering:

Digital Logic/Binary

Page 3: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

Can you use the ASCII tables to write your name?

Can you use them to write a secret message?

Can you decipher our secret message: 01000111 01101111 00100000 01010100 01101001

01100111 01100101 01110010 01110011?

Try your initials!

First Initial: __________________

Decimal Number: _____________

Binary:

Middle Initial: ________________

Decimal Number:_____________

Binary:

Final Initial:__________________

Decimal Number:_____________

Binary:

Page 4: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

A microcontroller is a really small computer on a single board. Engineers use them in lots of

ways - from turning on the lights in your home from your phone to monitoring the

temperature in a weather balloon. Microcontrollers are often connected to other sensors or

devices to help complete these tasks. Then, engineers program the microcontroller to do what

they want. Programming microcontrollers is a really important part of computer engineering.

Scratch is a cool way to start exploring how to code. You can go to the scratch website and

start playing some modules! Scratch will help teach you how to think like a programmer and

will let you program your own stories, games, and animations.

https://scratch.mit.edu/

If you feel confident to try something harder, try exploring python! Python is a high-level

programming language that has syntax that is easy to read. Codecademy has tutorials to learn

how to use python effectively!

https://codecademy.com/tracks/python

Computer Engineering:

Microcontrollers and Coding

Assembled microcontroller Inside a microcontroller

Page 5: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

ASCII stands for American Standard Code for Information Interchange. It is used to encode standard keyboard characters, such as letters, numbers, and special characters (?,@,$,!,&, etc.) into a binary numbering system for the computer to understand. ASCII characters are represented by eight binary bits (which is equivalent to one Byte) each. Classroom activity:

1. Set out beads of two different colors. One color will represent zeroes, and the other will represent ones.

2. Have each student write out his/her initials on a piece of paper.

3. Using the Character to Binary chart below, have each student convert each of his/her initials into binary.

4. Have each student string the one and zero beads together to form a bracelet of his/her name’s representation.

Example:

Initials Binary

R 01010010 I 01001001

T 01010100

Final result: 01010010 01001001 01010100

Computer Engineering:

Teacher Handout

Page 6: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

Discussion:

● Why do computers only understand binary? Why not just use letters and numbers? o Computers use electrical “gates” to store information. These gates can only be

open or closed, which we write out as 0 and 1. ● Why don’t we count in binary?

o Binary uses a lot of digits, so representing large numbers becomes very cumbersome. Decimal is much more compact and allows for easy finger counting!

● Are there other ways to represent numbers? o Absolutely! There are an infinite number of numerical bases. The most common

ones are binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). For bases above 10 we use start using letters as well as numbers. Hexadecimal digits go 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

● Do engineers tell computers what to do in binary? o Not directly. Engineers use programming languages to write instructions. Then, a

compiler takes and translates all the instructions into binary for the computer. Sites to visit: http://encyclopedia.kids.net.au/page/as/ASCII http://www3.amherst.edu/~jcook15/binarycode.html https://learn.sparkfun.com/tutorials/digital-logic

Page 7: Computer Engineering: Digital Logic · 2015-10-30 · Computer Engineering: Digital Logic . Computers aren’t very smart. They can only do exactly what you tell them to do, and they

http://1.bp.blogspot.com/-gKRqkSphQY4/Tw5mYJ9E1WI/AAAAAAAAACk/O4jlRIa8x_E/s1600/ascii-chart.png

i