#include"..\ucos-ii\includes.h" /* uC/OS interface */
#include "..\inc\drv.h"
#include "..\ucos-ii\add\osaddition.h"
#include "..\inc\OSFile.h"
#include "..\inc\drv\Ustring.h"
#include "..\inc\drv\tchScr.h"
#include <string.h>
///******************任务定义***************///
OS_STK Main_Stack[STACKSIZE*8]={0, }; //Main_Test_Task堆栈
void Main_Task(void *Id); //Main_Test_Task
#define Main_Task_Prio 12
OS_STK Led_Flash_Stack[STACKSIZE]= {0, }; //LED闪烁任务堆栈
void Led_Flash_Task(void *Id); //LED闪烁任务
#define Led_Flash_Prio 60
/**************已经定义的OS任务*************
#define Touch_Screen_Task_Prio 9
#define Main_Task_Prio 12
#define Key_Scan_Task_Prio 58
#define Lcd_Fresh_prio 59
#define Led_Flash_Prio 60
/*****************************************************/
///*****************事件定义*****************///
OS_EVENT *Nand_Rw_Sem; //Nand_Flash读写控制权旗语
//and you can use it as folloeing:
// Nand_Rw_Sem=OSSemCreate(1); //创建Nand-Flash读写控制权旗语,初值为1满足互斥条件//
// OSSemPend(Nand_Rw_Sem,0,&err);
// OSSemPost(Nand_Rw_Sem);
OS_EVENT *Uart_Rw_Sem; //Uart读写控制权旗语
//and you can use it as folloeing:
// Uart_Rw_Sem=OSSemCreate(1); //创建Uart读写控制权旗语,初值为1满足互斥条件//
// OSSemPend(Uart_Rw_Sem,0,&err);
// OSSemPost(Uart_Rw_Sem);
///////////////////////////////////////////////////////////////
int existnum1=0;
//0表示没有操作数opnum1 不存在
int opnum1,opnum2,result;
int op1=0;
int newop=0;
////////////////////////////////////////////////////////////////
// //
//0-->no operation 14-->puls 12-->multiple 3-->substract 7-->divide//
// //
////////////////////////////////////////////////////////////////
U8 empty=TRUE;
U8 secondnum=FALSE;
//表示开始输入第二个数字,用在当使用第二个操作符号的作用
//产生答案时,又开始输入第二个操作数的标志
void onKey(int nkey, int fnkey);
void Led_Flash_Task(void *Id)//指示RTOS处于正常工作中
{
unsigned char led_state;
Uart_Printf(0,"\n10");
for (;;)
{
Led_Display(led_state);
led_state=~led_state;
OSTimeDly(250);
}
}//Led_Flash_Task
void initOSGUI() //初始化操作系统的图形界面
{
initOSMessage();
initOSList();
initOSDC();
initOSCtrl();
initOSFile();
}
/////////////////////////////////////////////////////
// Main function. //
////////////////////////////////////////////////////
int Main(int argc, char **argv)
{
ARMTargetInit(); // do target (uHAL based ARM system) initialisation //
OSInit(); // needed by uC/OS-II //
uHALr_ResetMMU();
Port_Init(); //端口初始化
LCD_Init(); //LCD初始化,因要用到LCD输出结果
LCD_printf("LCD initialization is OK\n");
LCD_printf("320 x 240 Text Mode\n");
LoadFont();
LoadConfigSys();
// create the tasks in uC/OS and assign increasing //
// priorities to them so that Task3 at the end of //
// the pipeline has the highest priority. //
LCD_printf("Create task on uCOS-II...\n");
OSTaskCreate(Main_Task, (void *)0, (OS_STK *)&Main_Stack[STACKSIZE*8-1], Main_Task_Prio);// 1
OSTaskCreate(Led_Flash_Task, (void *)0, (OS_STK *)&Led_Flash_Stack[STACKSIZE-1], Led_Flash_Prio);// 10
OSAddTask_Init();
LCD_printf("Starting uCOS-II...\n");
LCD_printf("Entering graph mode...\n");
LCD_ChangeMode(DspGraMode);
initOSGUI();
InitRtc();
Nand_Rw_Sem=OSSemCreate(1); //创建Nand-Flash读写控制权旗语,初值为1满足互斥条件//
ARMTargetStart(); //Start the (uHAL based ARM system) system running //
OSStart(); // start the game //
// never reached //
return 0;
}//main
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PTextCtrl pTextCtrl;//文本框结构
#define ID_MainTextCtrl 101//文本框ID
void CreateText()
{
static char TimeKeyTable[]={'1','2','3',0,'4','5','6',0,'7','8','9',0,':','0','\b',0};//键值映射表
structRECT rect;//定义矩形结构
//U16 str[20];
SetRect(&rect, 40,30,180,50); //设置文本框
pTextCtrl=CreateTextCtrl(ID_MainTextCtrl, &rect, FONTSIZE_MIDDLE, CTRL_STYLE_FRAME,TimeKeyTable,NULL);//创建文本框
SetWndCtrlFocus(NULL,ID_MainTextCtrl);//焦点移到文本框中
DrawTextCtrl(pTextCtrl);//重绘文本框
}
void onnumchar(char mid);
void coputing();
void docompute();
//OS_EVENT *Rtc_Updata_Sem;//时钟更新控制权
void Main_Task(void *Id) //Main_Test_Task
{
int i=0;
int j=0;
int x,y;
POSMSG pMsg=0;//消息结构
PDC pdc;
char bmpnamelogo[12]={'1','4','5','_','5','9',' ',' ','B','M','P',0};
U16 ch0={'1'};
U16 ch1={'2'};
U16 ch2={'3'};
U16 ch3={'+'};
U16 ch4={'4'};
U16 ch5={'5'};
U16 ch6={'6'};
U16 ch7={'-'};
U16 ch8={'7'};
U16 ch9={'8'};
U16 ch10={'9'};
U16 ch11={'*'};
U16 ch12={'0'};
U16 ch13={'='};
U16 ch14={'C'};
U16 ch15={'/'};
pdc = CreateDC();
ClearScreen();//清屏
ShowBmp(pdc,bmpnamelogo, 1, 1);
OSTimeDly(2000);
ClearScreen();//清屏
CreateText(); //创建文本框
DrawRectFrame(pdc,20,20,205,239);
DrawRectFrame(pdc,40,30,180,50); // add a frame for the pTextCtrl
for(j=0;j<4;j++)
{
for(i=0;i<4;i++)
{
DrawRectFrame(pdc,25+i*45,60+j*45,65+i*45,100+j*45);
}
}
TextOut(pdc,40,75,&ch0,TRUE,FONTSIZE_SMALL);
TextOut(pdc,85,75,&ch1,TRUE,FONTSIZE_SMALL);
TextOut(pdc,130,75,&ch2,TRUE,FONTSIZE_SMALL);
TextOut(pdc,175,75,&ch3,TRUE,FONTSIZE_SMALL);
TextOut(pdc,40,120,&ch4,TRUE,FONTSIZE_SMALL);
TextOut(pdc,85,120,&ch5,TRUE,FONTSIZE_SMALL);
TextOut(pdc,130,120,&ch6,TRUE,FONTSIZE_SMALL);
TextOut(pdc,175,120,&ch7,TRUE,FONTSIZE_SMALL);
TextOut(pdc,40,165,&ch8,TRUE,FONTSIZE_SMALL);
TextOut(pdc,85,165,&ch9,TRUE,FONTSIZE_SMALL);
TextOut(pdc,130,165,&ch10,TRUE,FONTSIZE_SMALL);
TextOut(pdc,175,165,&ch11,TRUE,FONTSIZE_SMALL);
TextOut(pdc,40,210,&ch12,TRUE,FONTSIZE_SMALL);
TextOut(pdc,85,210,&ch13,TRUE,FONTSIZE_SMALL);
TextOut(pdc,130,210,&ch14,TRUE,FONTSIZE_SMALL);
TextOut(pdc,175,210,&ch15,TRUE,FONTSIZE_SMALL);
// Rtc_Updata_Sem=OSSemCreate(1);
//消息循环
for(;;){
pMsg=WaitMessage(0);//等待消息
switch(pMsg->Message){
case OSM_KEY: //键盘消息
onKey(pMsg->WParam,pMsg->LParam);
break;
case OSM_TOUCH_SCREEN:
//删除消息来自触摸屏
i=-1;
x=pMsg->WParam&0xffff;
y=pMsg->WParam>>16;
if((x>25)&&(x<65)&&(y>60)&&(y<100))
{
i=0;
}
else if((x>25)&&(x<65)&&(y>105)&&(y<145))
{
i=4;
}
else if((x>25)&&(x<65)&&(y>150)&&(y<190))
{
i=8;
}
else if((x>25)&&(x<65)&&(y>195)&&(y<235))
{
i=13;
}
else if((x>70)&&(x<110)&&(y>60)&&(y<100))
{
i=1;
}
else if((x>70)&&(x<110)&&(y>105)&&(y<145))
{
i=5;
}
else if((x>70)&&(x<110)&&(y>150)&&(y<190))
{
i=9;
}
else if((x>70)&&(x<110)&&(y>195)&&(y<235))
{
i=11;
}
else if((x>115)&&(x<110)&&(y>60)&&(y<100))
{
i=2;
}
else if((x>115)&&(x<155)&&(y>105)&&(y<145))
{
i=6;
没有合适的资源?快使用搜索试试~ 我知道了~
电子点菜系统
共59个文件
h:37个
o:7个
axf:3个
1星 需积分: 50 20 下载量 111 浏览量
2013-04-23
14:23:41
上传
评论 6
收藏 392KB RAR 举报
温馨提示
用于arm平台的电子点菜系统,可以实现触摸屏,可以实现键盘操作……
资源推荐
资源详情
资源评论
收起资源包目录
chumopingdianzinaozhong.rar (59个子文件)
综合实验源代码-计算器
bmp
145_59.bmp 225KB
Thumbs.db 20KB
Release
Option.o 212B
44binit.o 4KB
Memcfg.o 212B
EuCos.axf 160KB
system.bin 95KB
Lib
UCOS_LIB.ALF 122KB
ADD_LIB.ALF 100KB
INC
USB
DESC.h 7KB
DEF9603.h 12KB
MACRO.h 3KB
BITOPS.h 879B
DEFUSB.h 4KB
DRV.h 287B
Maro.h 164B
DRV
LCD240.h 351B
FILE.h 767B
FAT32.h 1018B
USB.h 1KB
RTC.h 796B
OSusb.h 55B
KeyBoard16.h 186B
Figure.h 467B
FLASH.h 1KB
tchScr.h 812B
Ustring.h 251B
LoadFile.h 199B
FAT32DEF.h 8KB
DISPLAY.h 3KB
OSFile.h 1KB
UHAL.h 2KB
DEF.h 426B
ExIO.h 1KB
BITOPS.h 879B
Calculator.apj 11KB
UCOS-II
ADD
OSAddTask.h 151B
osaddition.h 163B
Control.h 6KB
OSMessage.h 876B
List.h 348B
OS_CFG.h 3KB
UCOS_II.h 22KB
OS_CPU.h 3KB
INCLUDES.h 2KB
Debug
Option.o 212B
44binit.o 4KB
Memcfg.o 212B
EuCos.axf 209KB
main.o 61KB
WORK1.axf 189KB
system.bin 106KB
STARTUP
44binit.s 13KB
Option.h 1KB
Option.s 1003B
Memcfg.s 3KB
44b.h 15KB
SRC
ExIO.c 1KB
Main.c 13KB
共 59 条
- 1
资源评论
- 钱德勒宾2018-03-14假的。特别假的那种。
风过夏天的午后
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功