配置如下
- #include "mcc_generated_files/system/system.h"
- /*
- Main application
- */
- int i=0;
- 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();
- printf("Hello \n");
- for(int i=0;i<10;i++)
- {
- SrcVarName1[i]='1'+i;
- }
- for(int i=0;i<10;i++)
- {
- putch(SrcVarName1[i]);
- }
- putch('\n');
- while(1)
- {
- __delay_ms(1000);
-
- i++;
- if(i>20)
- {
- DMA1_StopTransfer();
- }
- else
- {
- DMA1_StartTransfer();
- }
- if(i>30) i=0;
- }
- }
这个软件触发是没问题的,很奈斯,参靠的版主的帖子。
也试了他的定时器触发也没问题,很棒。
我改成按键触发后出问题了。配置如下
比如应该收到如下内容
123456789:
实际按一下收到了两个,丢了第三个,搞不懂啊。
124578:134
|