#include<p18cxxx.h>
#include<delays.h>
#include<xlcd.h>
#pragma config PLLDIV = 5 // (20 MHz кварцевый резонатор)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = ON //USB Voltage Regulator
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = ON
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
//#pragma config CCP2MX = ON
#pragma config STVREN = ON
#pragma config LVP = OFF
//#pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
//#pragma config CP2 = OFF
//#pragma config CP3 = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
//#pragma config WRT2 = OFF
//#pragma config WRT3 = OFF
#pragma config WRTB = OFF // Boot Block Write Protection
#pragma config WRTC = OFF
//#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
//#pragma config EBTR2 = OFF
//#pragma config EBTR3 = OFF
#pragma config EBTRB = OFF
char str1[]="I am PIC18F";
char str2[]="How are you?";
#pragma code
void DelayFor18TCY(void)
{
Delay10TCYx(10);
}
void DelayPORXLCD(void)
{
Delay1KTCYx(75);
}
void DelayXLCD(void)
{
Delay1KTCYx(25);
}
void main(void)
{
ADCON1 |= 0x0F;
Delay10TCYx(10);
Delay100TCYx(10);
Delay1KTCYx(10);
Delay10KTCYx(10);
OpenXLCD(FOUR_BIT&LINES_5X7);
WriteCmdXLCD(SHIFT_DISP_LEFT);
WriteCmdXLCD(CURSOR_OFF&BLINK_OFF);
SetDDRamAddr (0x80);
putsXLCD(str1);
SetDDRamAddr(0xC0);
putsXLCD(str2);
while(1)
{
}
}
НАЗАД ДАЛЬШЕ