- int main(void)
- {
- uint8_t bv=0;
- SYSTEM_Initialize();
- // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts
- // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global Interrupts
- // Use the following macros to:
- // Enable the Global Interrupts
- //INTERRUPT_GlobalInterruptEnable();
- // Disable the Global Interrupts
- //INTERRUPT_GlobalInterruptDisable();
-
-
- printf("Hello PIC18F !\n");
- for(uint8_t i=0;i<10;i++)
- {
- printf("%c",uartdata[i]);
- }
- printf("\n");
- while(1)
- {
- if(SW_GetValue()==LOW)
- {
- LED_SetLow();
- // printf("PIC18F-BV-%2d\n",bv++);
- DMA1_TransferStart();
- while(SW_GetValue()==LOW);
- }
- else
- {
- LED_SetHigh();
- }
- }
- }
用MCC配置后,代码好简单。
|