Professional Documents
Culture Documents
// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write
protection off)
#pragma config VCAPEN = OFF // Voltage Regulator Capacitor Enable (All VCAP pin
functionality is disabled)
#pragma config PLLEN = OFF // PLL Enable (4x PLL disabled)
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack
Overflow or Underflow will cause a Reset)
#pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out
Reset Voltage (Vbor), low trip point selected.)
#pragma config LVP = OFF // Low-Voltage Programming Enable (High-voltage on
MCLR/VPP must be used for programming)
#include <xc.h>
#define _XTAL_FREQ 20000000
#include <stdio.h>
void binbcd(void) {
diezmiles = 0;
miles = 0;
unidades = 0;
decenas = 0;
centenas = 0;
aux = voltaje;
void multiplex(void) {
for (y = 0; y <= 100; y++)
PORTD = 0x01;
PORTC = diezmiles;
__delay_ms(1);
PORTD = 0x02;
PORTC = centenas;
__delay_ms(1);
PORTD = 0x04;
PORTC = decenas;
__delay_ms(1);
}
void main() {
ANSELE = 0X01;
ANSELD = 0;
LATA = 0;
TRISE = 0X01;
ANSELB = 0;
TRISB = 0;
TRISC = 0x80;
TRISD = 0;
LATB = 0;
LATD = 0;
LATC = 0;
PORTD = 0;
PORTC = 0;
ADCON0 = 0X15;
ADCON1 = 0XF0;
while (1) {
GO = 1;
while (GO)
continue;
}
}