Embedded之Introduction
1 Embedded system
An embedded system is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. (E.g. microwave oven)
2 Infinite loop
One of the most fundamental differences between programs developed for embedded systems and those written for other computer platforms is that the embedded programs almost always end with an infinite loop.
The infinite loop is necessary because the embedded software's job is never done. It is intended to be run until either the world comes to an end or the board is reset, whichever happens first.
3 Blinking LED
/**********************************************************************
*
* Function: main()
*
* Description: Blink the green LED once a second.
*
* Notes: This outer loop is hardware-independent. However,
* it depends on two hardware-dependent functions.
*
* Returns: This routine contains an infinite loop.
*
**********************************************************************/
void main(void)
{
while ()
{
toggleLed(LED_GREEN); /* Change the state of the LED. */
delay(); /* Pause for 500 milliseconds. */
}
}
3.1 toggleLed
/**********************************************************************
*
* Function: toggleLed()
*
* Description: Toggle the state of one or both LEDs.
*
* Notes: This function is specific to Arcom's Target188EB board.
*
* Returns: None defined.
*
**********************************************************************/ #define LED_GREEN 0x40 /* The green LED is controlled by bit 6.*/
#define P2LTCH 0xFF5E /* The offset of the P2LTCH register. */ void toggleLed(unsigned char ledMask)
{
asm {
mov dx, P2LTCH /* Load the address of the register. */
in al, dx /* Read the contents of the register. */ mov ah, ledMask /* Move the ledMask into a register. */
xor al, ah /* Toggle the requested bits. */ out dx, al /* Write the new register contents. */
}; } /* toggleLed() */
3.2 delay
/**********************************************************************
*
* Function: delay()
*
* Description: Busy-wait for the requested number of milliseconds.
*
* Notes: The number of decrement-and-test cycles per millisecond
* was determined through trial and error. This value is
* dependent upon the processor type and speed.
*
* Returns: None defined.
*
**********************************************************************/ void delay(unsigned int nMilliseconds)
{
#define CYCLES_PER_MS 260 /* Number of decrement-and-test cycles. */ unsigned long nCycles = nMilliseconds * CYCLES_PER_MS; while (nCycles--); } /* delay() */
Embedded之Introduction的更多相关文章
- MySQLdb User's Guide
MySQLdb MySQLdb-1.2.2 API documentation http://mysql-python.sourceforge.net/MySQLdb-1.2.2/ MySQLdb U ...
- 嵌入式(Embedded System)笔记 —— Cortex-M3 Introduction and Basics(上)
随着课内的学习,我想把每节课所学记录下来,以作查阅.以饲读者.由于我所上的是英文班课程,因此我将把关键术语的英文给出,甚至有些内容直接使用英文. 本次所介绍内容是关于Cortex-M3的基础内容. - ...
- 嵌入式(Embedded System)笔记 —— Cortex-M3 Introduction and Basics(下)
随着课内的学习,我想把每节课所学记录下来,以作查阅.以饲读者.由于我所上的是英文班课程,因此我将把关键术语的英文给出,甚至有些内容直接使用英文. 本次所介绍内容仍是关于Cortex-M3的基础内容,相 ...
- [转]A Guide To using IMU (Accelerometer and Gyroscope Devices) in Embedded Applications.
原文地址http://www.starlino.com/imu_guide.html Introduction There’s now a FRENCH translation of this art ...
- Chromium Embedded Framework 中文文档(简介)
转自:http://www.cnblogs.com/think/archive/2011/10/06/CEF-Introduce.html 简介 Chromium Embedded Framework ...
- Introduction to ASP.NET Web Programming Using the Razor Syntax (C#)
1, http://www.asp.net/web-pages/overview/getting-started/introducing-razor-syntax-c 2, Introduction ...
- A brief introduction to weakly supervised learning(简要介绍弱监督学习)
by 南大周志华 摘要 监督学习技术通过学习大量训练数据来构建预测模型,其中每个训练样本都有其对应的真值输出.尽管现有的技术已经取得了巨大的成功,但值得注意的是,由于数据标注过程的高成本,很多任务很难 ...
- An Introduction To The SQLite C/C++ Interface
1. Summary The following two objects and eight methods comprise the essential elements of the SQLite ...
- SpagoBI 教程 Lesson 1:Introduction and Installation
SapgoBI Lesson 1: Introduction and Installation Downloading and installing SpagoBI. Download SpagoBI ...
随机推荐
- emacs 快捷键笔记
C-d C-aM-aC-eM-e===复制黏贴M-d kill-wordM-del backward-kill-wordM-k kill-sentenceC-x del back ...
- powerdesigner 15 如何导出sql schema
PowerDesigner导出所有SQL脚本 操作:Database=>Generate Database PowerDesigner怎么导出建表sql脚本 1 按照数据库类型,切换数据库. D ...
- 了解ThinkPHP(一)
1.项目开发,中,会遇到的问题: 1). 多人开发项目,分工不合理,(html php mysql) 2). 代码风格不一样,后期维护十分困难 3). 项目生命周期十分短,项目生命没有延续性, ...
- Spring Transaction + MyBatis SqlSession事务管理机制[marked]
- Spring的注解方式
在Java代码中可以使用@Resource或者@Autowired注解方式来经行注入.虽然@Resource和@Autowired都可以来完成注入依赖,但它们之间是有区别的. a.@Resource默 ...
- jquery 获取点击事件的id;jquery如何获取当前触发事件的控件ID值
写html时这样绑定 <input type="text" name="address4" id="address4" onFocus ...
- Cookie存储中文报错:java.lang.IllegalArgumentException: Control character in cookie value or attribute.(转)
项目中做自动登录和保存密码时,Cookie报错Java.lang.IllegalArgumentException,上google查了下 在http://hi.baidu.com/xtxycy/blo ...
- POJ 2369 Permutations
傻逼图论. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm& ...
- IOS中封装一个View的思路
一.封装一个View的思路 1.将View内部的业务逻辑(显示内容)封装到View中 2.一般情况下,View的位置应该由父控件来决定,也就是位置不应该固定死在View内部 3.至于View的宽高,根 ...
- id to load is required for loading----id被要求加载exception
表示id主键 没有找到,可能是数据库中的主键设置了not null 而你没有给予主键 还有就是没有传递主键到 数据库中