Lab Sheet 4

PIC16F84A Input/Output

4. Report Exercises

a. Write an assembly program that

· Continuously reads inputs from PORTA (RA0-RA3)

· Outputs the summation of these numbers to PORTB

· The program knows there is a new input available at RA0-RA3 when a push button connected to RA4 is pressed and released.

· It keeps reading inputs from PORTA until the input is zero.

b. Write an assembly program that accepts two input signals on pins RA0 and RA1. According to the read inputs, the program performs a mathematical operation on variables X and Y and produces an output on PORTB according to the following table.

RA0

RA1

PORTB

0

0

X + Y

0

1

X – Y

1

Lab Sheet 4

PIC16F84A Input/Output

4. Report Exercises

a. Write an assembly program that

· Continuously reads inputs from PORTA (RA0-RA3)

· Outputs the summation of these numbers to PORTB

· The program knows there is a new input available at RA0-RA3 when a push button connected to RA4 is pressed and released.

· It keeps reading inputs from PORTA until the input is zero.

b. Write an assembly program that accepts two input signals on pins RA0 and RA1. According to the read inputs, the program performs a mathematical operation on variables X and Y and produces an output on PORTB according to the following table.

RA0

RA1

PORTB

0

0

X + Y

0

1

X – Y

1

0

X * Y

1

1

Quotient of X / Y

Table 3 Table for the fifth report problem.

c. Repeat parts a. and b. using the C Language =)

X * Y

1

1

Quotient of X / Y

Table 3 Table for the fifth report problem.

c. Repeat parts a. and b. using the C Language =)