📄 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 + -