Pic - Ejercicios
Pic - Ejercicios
Pic - Ejercicios
Politécnica
de Cartagena
PIC – LAB 2
Exercise 2.1. Write a program that shows in a 7‐segment display the decimal code associated with
the value in pins RA[5:2], or the symbol ‘‐.‘ when the decimal value is greater than 9.
The 7‐segment display is connected to PORTB pins.
The values in PORTB to display each decimal digit or the symbol are indicated in the following table.
Value Code
0 0xFC
1 0x60
2 0xDA
3 0xF2
4 0x66
5 0xB6
6 0xBE
7 0xE0
8 0xFE
9 0xE6
‐. 0x03
Exercise 2.2. Write a program that shows in two 7‐segment displays the decimal value associated
with the value in pins RA[5:0]. The 7‐segment displays are connected to PORTB (displaying the units)
and to PORTC (displaying the tens).
ciclo_200us = 0
CALL bucle_retardo
ciclo_200us = ciclo_200us +1
Exercise 2.4. Write a program that executes a chronometer that must count seconds and hundredths
of seconds. Use a nested delay loop as described in the flowchart below.
Use StopWatch to verify its behavior by means of simulation.
Bucle_retardo
CONT2 = M
CONT1 = N
CONT1 = CONT1 – 1
NO SI
CONT1 =0?
CONT2 = CONT2 – 1
NO CONT2 =0?
SI
FIN