Beruflich Dokumente
Kultur Dokumente
PRÁCTICA AUTONOMA #1
Paralelo Práctico:105
Fecha:21/10/2018
void main() {
TRISC=0x01;
TRISD=0x00;
PORTC=0x00;
PORTD=0x00;
ANSELH=0x00;
ANSEL=0x00;
while(1){
if(PORTC.RC0 == 1){
PORTD.RD = 1;
delay_ms(1000);
}
else{
PORTD.RD = 0;
}
}
}
FIEC – ESPOL 2018 - 2019 LABORATORIO DE MICROCONTROLADORES
int cont=0;
char num[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7C,0x07,0x7F,0x6F};
void main() {
TRISC=0x00;
PORTC=0x00;
ANSELH=0;
ANSEL=0;
while (cont<=9)
{
PORTC = num[cont];
cont++;
delay_ms(1000);
if (cont>9)
{
cont=0;
}
}
}
FIEC – ESPOL 2018 - 2019 LABORATORIO DE MICROCONTROLADORES
3. MATRIZ DE 8X8
int i,j,k;
char PORT[8]={1,2,4,8,16,32,64,128};
//char LETRA[8]={0x18, 0x24, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42};//LETRA A
//char FIGURA[8]={0xce, 0x91, 0x21, 0x42, 0x42, 0x21, 0x91, 0xce};//CORAZON
char MENSAJE[]={0x00, 0x7e, 0x7e, 0x18, 0x18, 0x7e, 0x7e, 0x00, //H
0x00, 0x7e, 0x7e, 0x66, 0x66, 0x7e, 0x7e, 0x00, //O
0x00, 0x7e, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x00, //L
0x00, 0x7e, 0x7e, 0x16, 0x16, 0x7e, 0x7e, 0x00, //A
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; //ESPACIO
void main() {
TRISC=0x00;
TRISD=0x00;
ANSELH=0x00;
ANSEL=0x00;
while(1){
for (k=0;k<50;k++)//
{
for (j=0; j<8;j++)//
{
PORTD = PORT[j];
PORTC = ~MENSAJE[i+j];// se niega para que se
muestre en la matriz
delay_ms(1);// delay para que se muestre en la
matriz sin parpadeos
}
}
}
}
}
FIEC – ESPOL 2018 - 2019 LABORATORIO DE MICROCONTROLADORES
Realizar las siguientes modificaciones y subir tanto el esquemático realizado en proteus al igual que
el código en mikroc.
void main() {
TRISC=0x00;
TRISD=0x00;
TRISB=0x00;
PORTC=0x00;
PORTD=0x00;
PORTB=0x00;
ANSELH=0x00;
ANSEL=0x00;
while(1){
PORTC.RC0 = 1;
PORTC.RC1 = 1;
PORTC.RC2 = 1;
PORTC.RC3 = 1;
PORTC.RC4 = 1;
PORTC.RC5 = 1;
PORTC.RC6 = 1;
PORTC.RC7 = 1;
delay_ms(5000);
PORTC=0 ;
FIEC – ESPOL 2018 - 2019 LABORATORIO DE MICROCONTROLADORES
PORTD.RD0 = 1;
PORTD.RD1 = 1;
PORTD.RD2 = 1;
PORTD.RD3 = 1;
PORTD.RD4 = 1;
PORTD.RD5 = 1;
PORTD.RD6 = 1;
PORTD.RD7 = 1;
delay_ms(5000);
PORTD=0;
PORTB.RB2 = 1;
PORTB.RB3 = 1;
PORTB.RB4 = 1;
PORTB.RB5 = 1;
PORTB.RB6 = 1;
PORTB.RB7 = 1;
delay_ms(5000);
PORTB=0 ;
}
}
int cont=0;
int cont1=0;
int time=0;
char num[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7C,0x07,0x7F,0x6F};
void main() {
ANSELH=0;
ANSEL=0;
TRISC=0;
TRISD=0;
FIEC – ESPOL 2018 - 2019 LABORATORIO DE MICROCONTROLADORES
PORTC=0;
PORTD=0;
while (cont1<=9)
{
PORTD = num[cont];
PORTC = num[cont1];
cont1++;
delay_ms(1000);
if (cont==3)
{
cont=0;
while(time<5)
{
PORTD.RD7 = 1;
delay_ms(1000);
PORTD.RD7 = 0;
delay_ms(1000);
time++;
}
}
if (cont1>9)
{
cont1=0;
cont++;
}
}
}
• Con la matriz de leds escribir su primer nombre en movimiento.
int i,j,k;
char PORT[8]={1,2,4,8,16,32,64,128};
char LETRA[8]={0x18, 0x24, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42};//LETRA A
char FIGURA[8]={0xce, 0x91, 0x21, 0x42, 0x42, 0x21, 0x91, 0xce};//CORAZON
char MENSAJE[]={0x00, 0x7e, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x00, //C
0x00, 0x7e, 0x7e, 0x16, 0x16, 0x7e, 0x7e, 0x00, //A
0x00, 0x7e, 0x7e, 0x16, 0x16, 0x6c, 0x00, 0x00, //R
0x00, 0x7e, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x00, //L
FIEC – ESPOL 2018 - 2019 LABORATORIO DE MICROCONTROLADORES
void main() {
TRISC=0x00;
TRISD=0x00;
ANSELH=0x00;
ANSEL=0x00;
while(1){
}
}
CONCLUCIONES
El contador es una manera útil con la cual podríamos realizar distintos proyectos, como un reloj o
temporizador.
Este tipo de tareas ayuda a que a la autoeducación y mejora la profundidad del aprendizaje.
RECOMENDACIONES
Es recomendable revisar la frecuencia sobre la cual está trabajando el PIC en Proteus, debido que no
será posible la visualización correcta si trabajan a diferentes frecuencias.