Value0=_PLLDIV_2_1L = $00F9 (pll divide by 2)
Value1=_CPUDIV_OSC1_PLL2_1L = $00E7 (cpudiv divide by 2, so cpu is at 48mhz)
Value2=_USBDIV_2_1L = $00FF (active, so usb is at 48mhz)
Value3=_FOSC_HS_1H = $00FC (hs active)
Value4=_FOSC_HSPLL_HS_1H = $00FE (hs active with pll)
Value5=_FCMEM_OFF_1H = $00BF
Value6=_IESO_OFF_1H = $007F
Value7=_PWRT_ON_2L = $00FE
Value8=_BOR_ON_2L = $00FF
Value9=_BORV_43_2L = $00EF
Value10=_VREGEN_ON_2L = $00FF
Value11=_WDT_OFF_2H = $00FE
Value12=_WDTPS_256_2H = $00F1
Value13=_MCLRE_ON_3H = $00FF
Value14=_LPT1OSC_OFF_3H = $00FB
Value15=_PBADEN_ON_3H = $00FF
Value16=_CCP2MX_ON_3H = $00FF
Value17=_STVREN_ON_4L = $00FF
Value18=_LVP_OFF_4L = $00FB
Value19=_XINST_OFF_4L = $00BF
Value20=_DEBUG_OFF_4L = $00FF
unsigned char RD_len;
unsigned short userWR_buffer[64];
unsigned short userRD_buffer[64];
void interrupt()
{
Hid_InterruptProc();
}
void Init_Main()
{
//--------------------------------------
// Disable all interrupts
//--------------------------------------
INTCON2 = 0xF5;
INTCON3 = 0xC0;
RCON.IPEN = 0; // Disable Priority Levels on interrupts
PIE1 = 0;
PIE2 = 0;
PIR1 = 0;
PIR2 = 0;
ADCON1 |= 0x0F; // Configure all ports with analog function as digital
TRISA = 0xFF;
TRISB = 0xFF;
TRISC = 0xFF;
TRISD = 0x00;
TRISE = 0x07;
LATA = 0;
LATB = 0;
LATC = 0;
LATD = 0;
LATE = 0;
//useless on 18F4550
//--------------------------------------
// Enable PLL !!!
//--------------------------------------
//PLLEN = 1;
//Delay_mS(5);
}
void main()
{
Init_Main();
HID_Enable(userRD_buffer, userWR_buffer);
Delay_mS(1000);
Delay_mS(1000);
while(1){
RD_len = HID_Read();
//do something
}
HID_Disable();
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?