?? main1.c
字號:
/****************************************************************************
* File: main.c
* 功能:向LCD輸出計數值
****************************************************************************/
#include "config.h"
#define TASK_STK_SIZE 64
OS_STK TaskStartStk[TASK_STK_SIZE];
void TaskStart(void *data);
uint8 const SEND[]="Hello World! \n";
/****************************************************************************
* File:delay()
* 功能:延時
****************************************************************************/
void delay(uint32 dly)
{ uint32 i;
for(; dly>0; dly--)
for(i=0; i<50000; i++);
}
void UART0_int(void)
{ U0LCR=0x83;
U0DLL=0x12;
U0DLM=0x00;
U0LCR=0x03;
}
void UART0_SendByte(uint8 data)
{
U0THR=data;
while((U0LSR&0x40)==0);
{
uint32 i;
for(i=0; i<5; i++);
}
}
void UART0_SendStr(uint8 const *str)
{
while(1)
{if(*str=='\0')
{UART0_SendByte('\r');
UART0_SendByte('\n');
break;
}
UART0_SendByte(*str++);
}
}
/****************************************************************************
* File: main()
* 功能:顯示計數值
****************************************************************************/
int main(void)
{
PINSEL0=0x00000005;
PINSEL1=0x00000000;
OSInit();
OSTaskCreate(TaskStart, (void *)0, &TaskStartStk[TASK_STK_SIZE - 1], 3);
OSStart();
}
/****************************************************************************
* 名稱:TaskStart()
* 功能:任務
****************************************************************************/
void TaskStart(void *pdata)
{ pdata=pdata;
TargetInit();
//WrOp(0x0c);
// LCDinit();
//IODIR=0x7ff; //設置為輸出
//IOCLR=0x7ff;
//DisplayText(1,15,txt);
UART0_int();
//IOCLR=led;
while(1)
{ OSSchedLock();
UART0_SendStr(SEND);
OSSchedUnlock();
//delay(10);
}
//while(1);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -