/*---------------------------------------------------------------------------------------------------------*/ /* */ /* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */ /* */ /*---------------------------------------------------------------------------------------------------------*/ //*********************************************************************************************************** // Website: http://www.nuvoton.com // E-Mail : MicroC-8bit@nuvoton.com //*********************************************************************************************************** //*********************************************************************************************************** // File Function: ML51 simple GPIO toggle out demo code //*********************************************************************************************************** #include "ML51.h" /** * [url=home.php?mod=space&uid=247401]@brief[/url] Low power run mode Memory to memory function demo * @param None * [url=home.php?mod=space&uid=266161]@return[/url] None * [url=home.php?mod=space&uid=1543424]@Details[/url] */ unsigned char xdata RxDatabuffer[100] _at_ 0x100; unsigned char xdata finalbuffer _at_ 0x263; unsigned char i; void PDMA1_ISR(void) interrupt 21 // Vector [url=home.php?mod=space&uid=72445]@[/url] 0xAB { PDMA_Close(PDMA1); clr_DMA1TSR_FDONE; clr_DMA1TSR_HDONE; } void main (void) { ALL_GPIO_QUASI_MODE; for(i=0;i<100;i++) { RxDatabuffer[i]=i; } /* Define PMDA function as memory to memory, and setting base address */ PDMA_Open(PDMA1,XRAM_XRAM,0x100,0x80); /* Define destination memory address */ PDMA_MTM_DestinationAddress(PDMA1,0x200); /* Define interrupt after full transfer */ PDMA_Interrupt_Enable(PDMA1,PDMAFULLINT); ENABLE_GLOBAL_INTERRUPT; FsysSelect(FSYS_LIRC); set_PCON_LPR; PDMA_Run(PDMA1); while(1); }
收藏0 举报
/*---------------------------------------------------------------------------------------------------------*/ /* */ /* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */ /* */ /*---------------------------------------------------------------------------------------------------------*/ //*********************************************************************************************************** // Website: http://www.nuvoton.com // E-Mail : MicroC-8bit@nuvoton.com //*********************************************************************************************************** //*********************************************************************************************************** // File Function: ML51 simple GPIO toggle out demo code //*********************************************************************************************************** #include "ML51.h" unsigned char xdata RxDatabuffer[100] _at_ 0x100; unsigned char ct; /** * @brief Low power run mode UART TX or receive demo * @param None * @return None * @details */ void PDMA0_ISR(void) interrupt 20 // Vector @ 0xA3 { /* if need check with XRAM PDMA value, should enable following part */ // clr_PCON_LPR; // FsysSelect(FSYS_HIRC); /* ******************** */ PDMA_Close(PDMA0); SFRS=0;DMA0TSR=0; /*only for check PDMA reciverd */ // while(1) // { // P14=0; // P14=1; // } // printf (" \n PDMA receiv UART2 RX finish! " ); /* ****** */ } void main (void) { #if 1 MFP_P46_CLKO; P46_QUASI_MODE; set_CKCON_CLOEN; MFP_P54_UART2_TXD; P54_QUASI_MODE; LowPower_LIRC_UART2_4800_init(); /*Enable Low power run mode */ FsysSelect(FSYS_LIRC); set_PCON_LPR; while(1) { LowPower_UART2_Send_Data(0x55); _delay_(); } #else All_GPIO_QUASI_MODE; MFP_P14_GPIO; /* Enable UART2 RX */ MFP_P55_UART2_RXD; P55_INPUT_MODE; LowPower_LIRC_UART2_4800_init(); /* Clear XRAM base address area to 00h */ for(ct=0;ct<10;ct++) { RxDatabuffer[ct]=0; } /* Define PMDA function as UART RX to memory, define base address and PDMA receive length */ PDMA_Open(PDMA0,SMCRX,0x100,5); /* Define interrupt after full transfer */ PDMA_Interrupt_Enable(PDMA0,PDMAFULLINT); /* Global interrupt enable */ ENABLE_GLOBAL_INTERRUPT; /* Start PDMA transfer */ PDMA_Run(PDMA0); /*Enable Low power run mode */ FsysSelect(FSYS_LIRC); set_PCON_LPR; while(1); #endif }
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
人才类勋章
发帖类勋章
等级类勋章
时间类勋章
211
3588
15
扫码关注 21ic 官方微信
扫码关注嵌入式微处理器
扫码关注电源系统设计
扫码关注21ic项目外包
扫码浏览21ic手机版
本站介绍 | 申请友情链接 | 欢迎投稿 | 隐私声明 | 广告业务 | 网站地图 | 联系我们 | 诚聘英才
京公网安备 11010802024343号