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

U N I V E R S I T Y O F S A N J O S E – R E

C O L E T O S
Magallanes S t., C e b u C i t y

ECE 51G
Computer Applications
TUE 8:30 AM – 11:30 AM

A c t I v I t y N o. 1: # 3 3

P A U N I L, B R U C E R O N A L D R O Y S.
BSECE 5

ProBLEM

Write a documented program, which will simulate the gate array logic shown as
a logic ladder rung.

Use the I/O simulator screen and the following addresses to simulate the
program:

A_ I:1/0
B_ I:1/1
C_ I:1/2
D_ I:1/3
M_ O:1/0

TRUTH TABLE 0 1 1 1 0 0
0 1 1 1 1 1
1 0 0 0 0 0
M' A B C D M 1 0 0 0 1 0
0 0 0 0 0 0 1 0 0 1 0 0
0 0 0 0 1 0 1 0 0 1 1 1
0 0 0 1 0 0 1 0 1 0 0 0
0 0 0 1 1 0 1 0 1 0 1 0
0 0 1 0 0 0 1 0 1 1 0 0
0 0 1 0 1 0 1 0 1 1 1 1
0 0 1 1 0 0 1 1 0 0 0 0
0 0 1 1 1 1 1 1 0 0 1 0
0 1 0 0 0 0 1 1 0 1 0 0
0 1 0 0 1 0 1 1 0 1 1 1
0 1 0 1 0 0 1 1 1 0 0 0
0 1 0 1 1 1 1 1 1 0 1 0
0 1 1 0 0 0 1 1 1 1 0 0
0 1 1 0 1 0 1 1 1 1 1 1
Y = ( Y + A + B )( C D )
CoDE

bool input[4]; #input array


bool out1, out2; #separate the outputs
void setup()
{
for(int x=2; x<=5; x++)
{
pinMode(x, INPUT); #pin 2 to 5 are INPUT
}
pinMode(6, OUTPUT);
} #pin6 is set to OUTPUT

void loop()
{
for(int x=2; x<=5; x++) #reads the input
{
input[x-2] = digitalRead(x);
}
out1 = (input[0] | input [1]) | out2;
out2 = (input[2] & input [3]) & out1; #boolean equation
digitalWrite(6, out2); #displays the result of
} #the eqtn

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