第一范文网 - 专业文章范例文档资料分享平台

嵌入式课程设计报告

来源:用户分享 时间:2025/6/25 6:08:15 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

WS_EX_NONE }, { \ WS_VISIBLE|WS_TABSTOP, 585,160,80,60, ID_LED4, \ 0, WS_EX_NONE }, { \ WS_VISIBLE|WS_TABSTOP, 285,360,80,60, ID_START, \ 0, WS_EX_NONE }, { \ WS_VISIBLE|WS_TABSTOP, 435,360,80,60, ID_STOP, \ 0, WS_EX_NONE }, {

CTRL_COMBOBOX, WS_VISIBLE|WS_TABSTOP|CBS_AUTOSPIN|CBS_AUTOLOOP,

/*CBS_AUTOSPIN创建旋钮数字框,CBS_AUTOLOOP框中的数字将自动循 环显示*/ 435,270,80,40, ID_COMBOBOX,

16

\ /*旋钮数字框初始值*/ 0, WS_EX_NONE } };

static int DialogBoxProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) /*对话框过程函数,用来接收和处理所有发送到该窗口的消息*/ {

int number; /*用来存从旋钮数字框获得的数值*/ static int t=0;

int num; /*存放定时时间*/ switch(message) {

case MSG_INITDIALOG:

/*用户在定义自己的对话框回调函数时,需要处理 MSG_INITDIALOG消息,该消息是在 MiniGUI根据对话框模板建立对话框以及 控件之后 ,发送到对话框回调函数的 。*/ SendDlgItemMessage(hWnd, ID_COMBOBOX, CB_SETSPINRANGE, 0, 10000); /*设置旋钮数字框的最大小值*/ return 1; case MSG_PAINT:/*重绘消息*/ draw_circular(hWnd,175,90,30,1); draw_circular(hWnd,325,90,30,1); draw_circular(hWnd,475,90,30,1); draw_circular(hWnd,625,90,30,1); printf(\draw_circular******************************\\n\ case MSG_TIMER:t++; /*定时器消息,这里完成LED灯的闪烁*/ if(t%2!=0) { ioctl(fd_led, 0,0); ioctl(fd_led, 0, 1); ioctl(fd_led, 0, 2); ioctl(fd_led, 0, 3); printf(\

17

draw_circular(hWnd,175,90,30,1); draw_circular(hWnd,325,90,30,1); draw_circular(hWnd,475,90,30,1); draw_circular(hWnd,625,90,30,1); break; } else { ioctl(fd_led, 1,0); ioctl(fd_led, 1, 1); ioctl(fd_led, 1, 2); ioctl(fd_led, 1, 3); printf(\ draw_circular(hWnd,175,90,30,0); draw_circular(hWnd,325,90,30,0); draw_circular(hWnd,475,90,30,0); draw_circular(hWnd,625,90,30,0); break; } case MSG_COMMAND: /*击键消息*/ switch (wParam) { case ID_LED1:a++; /*控制LED灯亮暗*/ if(a%2!=0) {

ioctl(fd_led,0,0); draw_circular(hWnd,175,90,30,1); } else {

/ ioctl(fd_led,1,0); draw_circular(hWnd,175,90,30,0); }

printf(\

18

break; case ID_LED2:b++; if(b%2!=0) {

ioctl(fd_led,0,1); draw_circular(hWnd,325,90,30,1); } else {

ioctl(fd_led,1,1); draw_circular(hWnd,325,90,30,0); }

printf(\ break; case ID_LED3:c++; if(c%2!=0) {

ioctl(fd_led,0,2); draw_circular(hWnd,475,90,30,1); } else {

ioctl(fd_led,1,2); draw_circular(hWnd,475,90,30,0); }

printf(\ break; case ID_LED4:d++; if(d%2!=0) {

ioctl(fd_led,0,3); draw_circular(hWnd,625,90,30,1);

19

printf(\ } else {

ioctl(fd_led,1,3); draw_circular(hWnd,625,90,30,0 ); } printf(\ break; case

ID_START:printf(\

number=SendMessage(GetDlgItem(hWnd,ID_COMBOBOX), CB_GETSPINVALUE, 0, 0);/*获取旋钮数字框的数值*/ printf(\

printf(\ if(number!=0) {

printf(\ num=(int)(1000*(1.0/number)); /*将频率转换为时间*/

printf(\ } else { printf(\ num=1000; }

20

搜索更多关于: 嵌入式课程设计报告 的文档
嵌入式课程设计报告.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c24ses3zfzt10ttd0oe0m_4.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top