/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2019 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
//***********************************************************************************************************
// Website: http://www.nuvoton.com
// E-Mail : MicroC-8bit@nuvoton.com
//***********************************************************************************************************
#include "ML51.h"
/**
* [url=home.php?mod=space&uid=247401]@brief[/url] I2C0 master demo.
* @param None
* [url=home.php?mod=space&uid=266161]@return[/url] None
* [url=home.php?mod=space&uid=1543424]@Details[/url] please confirm enable LXT and check work stable if use LXT as WKT clock source.
*/
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;
printf (" \n PDMA Tranfer Finish! 0x%bx", finalbuffer);
}
void main (void)
{
MFP_P31_UART0_TXD;
P31_QUASI_MODE;
UART_Open(24000000,UART0_Timer3,115200);
ENABLE_UART0_PRINTF;
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;
PDMA_Run(PDMA1);
while(1);
}
|