Код
#include <xc.h>
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled)
#pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input)
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable (Brown-out Reset disabled)
#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = OFF // Internal/External Switchover (Internal/External Switchover mode is disabled)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)
// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
#pragma config STVREN = OFF // 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.)
#define _XTAL_FREQ 16000000
#define __delay_ms(x) _delay((unsigned long)((x)*(_XTAL_FREQ/4000.0)))
void initial(void)
{
GIE=0; //global interrupts ^^
OSCCON = 0b01111010; // Internal OSC 16MHz
ANSELA=0b00000000; //
T1GCON=0b00000000;
T1CON=0b00000100; // Timer1 clock Fosc,Prescaler 1:1,
// LP oscillator disable, TMR1 stop
PORTA=0x00;
LATA=0x00;
TRISA=0b00000000;
ADCON0=0b00000000;
CCP1CON=0b00000000; //
SSP1CON1=0b00000000; //
} // initial()
void main(void)
{ initial();
do{
LATA=0b11111111;
__delay_ms(1);
LATA=0b00000000;
__delay_ms(1);
}while(1);
}
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled)
#pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input)
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable (Brown-out Reset disabled)
#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = OFF // Internal/External Switchover (Internal/External Switchover mode is disabled)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)
// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
#pragma config STVREN = OFF // 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.)
#define _XTAL_FREQ 16000000
#define __delay_ms(x) _delay((unsigned long)((x)*(_XTAL_FREQ/4000.0)))
void initial(void)
{
GIE=0; //global interrupts ^^
OSCCON = 0b01111010; // Internal OSC 16MHz
ANSELA=0b00000000; //
T1GCON=0b00000000;
T1CON=0b00000100; // Timer1 clock Fosc,Prescaler 1:1,
// LP oscillator disable, TMR1 stop
PORTA=0x00;
LATA=0x00;
TRISA=0b00000000;
ADCON0=0b00000000;
CCP1CON=0b00000000; //
SSP1CON1=0b00000000; //
} // initial()
void main(void)
{ initial();
do{
LATA=0b11111111;
__delay_ms(1);
LATA=0b00000000;
__delay_ms(1);
}while(1);
}