这是我改成软件触发了,在IOC中断里触发,可以实现传输一个字符。
我改成IOC触发就不行了。会丢失几个数。间隔的丢。。。好奇怪啊。
谁能搞定这个功放发个帖分享一下。
- #include "mcc_generated_files/system/system.h"
- /*
- Main application
- */
- void LED(void)
- {
- LED_Toggle();
- DMA1_TransferStart();
- }
- int main(void)
- {
- 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();
-
- SW_SetInterruptHandler(LED);
- printf("Hello \n");
- for(uint8_t i=0;i<10;i++)
- {
- srcVarName1[i]='1'+i;
- }
- for(int i=0;i<10;i++)
- {
- putch(srcVarName1[i]);
- }
- putch('\n');
- while(1)
- {
- }
- }
|