Professional Documents
Culture Documents
* File: ejemplo1.c
* Author: Alumno
*
* Created on 12 de noviembre de 2019, 03:49 PM
*/
#include <xc.h>
#define _XTAL_FREQ 20000000
void multiplicacion ()
{
caballero=num*5;
}
void puertos ()
{
TRISB=0;
TRISC=255;
PORTB=0;
PORTC=0;
}
void main(void) {
puertos();
while(1){
num=PORTC;
multiplicacion();
switch (caballero)
{
case 0: TRISBbits.RB0=1; break;
case 5: TRISBbits.RB1=1; break;
case 10: TRISBbits.RB2=1; break;
case 15: TRISBbits.RB3=1; break;
case 20: TRISBbits.RB4=1; break;
case 25: TRISBbits.RB5=1; break;
case 30: TRISBbits.RB6=1; break;
case 35: TRISBbits.RB7=1; break;
default: PORTB=0;
}
}
return;