/*---------------------------------------------------------------------------------------------------------*/
/* */
/* 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] GPIO input output demo
* @param None
* [url=home.php?mod=space&uid=266161]@return[/url] None
* [url=home.php?mod=space&uid=1543424]@Details[/url] GPIO toggle and UART0 TXD0 send out.
*/
void main (void)
{
MFP_P46_GPIO;
P31_PUSHPULL_MODE;
MFP_P50_GPIO;
P50_PUSHPULL_MODE;
MFP_P51_GPIO;
P51_PUSHPULL_MODE;
/*
For UART0 P3.1 as TXD output setting
* include uart.c in Common Setting for UART0
*/
MFP_P31_UART0_TXD; // UART0 TXD use P1.6
P31_QUASI_MODE; // set P1.6 as Quasi mode for UART0 trasnfer
UART_Open(24000000,UART0_Timer1,115200); // Open UART0 use timer1 as baudrate generate and baud rate = 115200
while(1)
{
SFRS = 0;
P46 ^= 1;
while (P5|CLR_BIT6); // P56 = 1;
while (!(P5&SET_BIT6)); // P56 = 0;
/* include timer.c for delay setting */
Timer2_Delay(24000000,128,100,1000);
UART_Send_Data(UART0,0x55);
}
}
|