PIC Homework

13
PIC Discussion | by Eng. Tamar Jomaa Example#1: Addition of two numbers entered to portB and display the result on portA. Solution:

description

Ce cours donne une initiation aux microcontroleurs PIC de l'Université de GAZA

Transcript of PIC Homework

Page 1: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#1:

Addition of two numbers entered to portB and display the result

on portA.

Solution:

Page 2: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#2:

Subtraction of two numbers entered to portB and display the

result on portA.

Solution:

Page 3: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#3:

Check if the input number from PORTA is larger than 10 or not.

If the number is larger than 10 then a LED on RB0 will be on.

Solution:

Solution#1 solution#2

Page 4: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#4:

Half Adder program.

Solution:

Page 5: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#5:

Full Adder program.

Solution:

Page 6: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#6:

Implement 4 bit XOR.

Solution:

Page 7: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#7:

Move the content of RA0 TO RA3.

Solution:

Page 8: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#8:

Move the content of RA0 TO RB3.

Solution:

Page 9: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#9:

Multiplier to multiply two 3 digits numbers.

Solution:

Page 10: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Example#10:

Implement square of PORTA.

Solution:

Page 11: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Homework

1) Implement 8-bit decoder with two enable pins.

2) Implement 4-bit multiplixer with 2 enable pins.

3) Implement 4-bit buffer with two enable pins.

4) Implement 4-bit gray code.

5) Implement a single bit comparator.

6) Implement 4-bit divider.

7) Implement 4-bit XOR/XNOR device with select pin.

8) Implement 4-bit "AND-OR-NAND-NOR" device with

select pins.

9) Copy the input data from PORTB to all GPR.

10) Implement 4-bit L/R shift register.

Notes:

Delivery Date is 6/10/2010.

Any late homework will not be accepted.

All copy-paste homework will not be accepted and both will

take ZERO.

Each question implement the PROTUS simulation and you will

implement the code in MPLAB.

So I will receive CD that has all PROTUS and MAPLAB program

for each part.

Page 12: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Hint list

Hint for question#1:

I7 I6 I5 I4 I3 I2 I1 I0 S1 S2 S3

0 0 0 0 0 0 0 1 0 0 0

0 0 0 0 0 0 1 0 0 0 0

0 0 0 0 0 1 0 0 0 1 0

0 0 0 0 1 0 0 0 1 1 0

0 0 0 1 0 0 0 0 0 0 1

0 0 1 0 0 0 0 0 1 0 1

0 1 0 0 0 0 0 0 0 1 1

1 0 0 0 0 0 0 0 1 1 1

Hint for question#2:

F I3 I2 I1 I0 S0 S1

1 0 0 0 1 0 0

1 0 0 1 0 1 0

1 0 1 0 0 0 1

1 1 0 0 0 1 1

Page 13: PIC Homework

PIC Discussion | by Eng. Tamar Jomaa

Hint for question#3:

Hint for question#4:

Hint for question#5:

I2 I1 I1>I2 I1=I2 I1<I2

0 0 0 1 0

0 1 1 0 0

1 0 0 0 1

1 1 0 1 0