[PIC®/AVR®/dsPIC®产品] 求各位大佬试试PIC18F的DMA的IOC触发方式

[复制链接]
 楼主| yiyigirl2014 发表于 2023-9-26 16:08 | 显示全部楼层 |阅读模式
这是我改成软件触发了,在IOC中断里触发,可以实现传输一个字符。
我改成IOC触发就不行了。会丢失几个数。间隔的丢。。。好奇怪啊。
谁能搞定这个功放发个帖分享一下。
  1. #include "mcc_generated_files/system/system.h"

  2. /*
  3.     Main application
  4. */
  5. void LED(void)
  6. {
  7.     LED_Toggle();
  8.     DMA1_TransferStart();
  9. }
  10. int main(void)
  11. {
  12.     SYSTEM_Initialize();

  13.     // If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts
  14.     // If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global Interrupts
  15.     // Use the following macros to:

  16.     // Enable the Global Interrupts
  17.     INTERRUPT_GlobalInterruptEnable();

  18.     // Disable the Global Interrupts
  19.     //INTERRUPT_GlobalInterruptDisable();
  20.    
  21.     SW_SetInterruptHandler(LED);
  22.     printf("Hello \n");
  23.     for(uint8_t i=0;i<10;i++)
  24.     {
  25.         srcVarName1[i]='1'+i;
  26.     }
  27.     for(int i=0;i<10;i++)
  28.     {
  29.         putch(srcVarName1[i]);
  30.     }
  31.     putch('\n');


  32.     while(1)
  33.     {
  34.     }   
  35. }






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
gaoyang9992006 发表于 2023-9-27 11:32 | 显示全部楼层
是有点问题。
wahahaheihei 发表于 2023-10-24 20:47 | 显示全部楼层
可能是哪儿没设置对。
lcczg 发表于 2023-11-1 09:12 | 显示全部楼层
我感觉是优先级没有设置。应该设置优先级最高。
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();
    DMA1_SetDMAPriority(1);
    DMA1_StartTransferWithTrigger();

    while(1)
    {
    }   
}
Jacquetry 发表于 2023-11-20 11:04 来自手机 | 显示全部楼层
优先级有问题吗?
Undshing 发表于 2023-11-21 08:58 来自手机 | 显示全部楼层
改改优先级试试吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

230

主题

3676

帖子

10

粉丝
快速回复 在线客服 返回列表 返回顶部