然后我就增加了查找ON的位置
#include "ML51.h"
void main (void)
{
unsigned char my[10];
unsigned char i=0;
MFP_P03_GPIO;
P03_PUSHPULL_MODE;
/**
For UART0 P0.5 asTXD output setting
* include uart.c in Common Setting for UART0
*/
MFP_P31_UART0_TXD; /* set P3.1 and P3.0 as Quasi mode for UART0 trasnfer */
MFP_P30_UART0_RXD;
P31_QUASI_MODE;
P30_QUASI_MODE;
UART_Open(24000000,UART0_Timer1,115200); // Open UART0 use timer1 as baudrate generate and baud rate = 115200
ENABLE_UART0_PRINTF;
/**
UART0 loop test
UART0 TXD send data received by RXD pin. Connect TXD pin and RXD pin check result.
*/
while(1)
{
unsigned char temp;
temp = UART_Receive_Data(UART0);
UART_Send_Data(UART0,temp);
my[i++]=temp;
if(i>=10)
{
ENABLE_UART0_PRINTF;
printf ("\nHello\n");
DISABLE_UART0_PRINTF;
for(i=0;i<10;i++)
{
if(my[i]=='O')
if(my[i+1]=='N')
P03 ^=1;
}
i=0;
}
}
}
|