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的更多相关文章

  1. MySQLdb User's Guide

    MySQLdb MySQLdb-1.2.2 API documentation http://mysql-python.sourceforge.net/MySQLdb-1.2.2/ MySQLdb U ...

  2. 嵌入式(Embedded System)笔记 —— Cortex-M3 Introduction and Basics(上)

    随着课内的学习,我想把每节课所学记录下来,以作查阅.以饲读者.由于我所上的是英文班课程,因此我将把关键术语的英文给出,甚至有些内容直接使用英文. 本次所介绍内容是关于Cortex-M3的基础内容. - ...

  3. 嵌入式(Embedded System)笔记 —— Cortex-M3 Introduction and Basics(下)

    随着课内的学习,我想把每节课所学记录下来,以作查阅.以饲读者.由于我所上的是英文班课程,因此我将把关键术语的英文给出,甚至有些内容直接使用英文. 本次所介绍内容仍是关于Cortex-M3的基础内容,相 ...

  4. [转]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 ...

  5. Chromium Embedded Framework 中文文档(简介)

    转自:http://www.cnblogs.com/think/archive/2011/10/06/CEF-Introduce.html 简介 Chromium Embedded Framework ...

  6. 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 ...

  7. A brief introduction to weakly supervised learning(简要介绍弱监督学习)

    by 南大周志华 摘要 监督学习技术通过学习大量训练数据来构建预测模型,其中每个训练样本都有其对应的真值输出.尽管现有的技术已经取得了巨大的成功,但值得注意的是,由于数据标注过程的高成本,很多任务很难 ...

  8. An Introduction To The SQLite C/C++ Interface

    1. Summary The following two objects and eight methods comprise the essential elements of the SQLite ...

  9. SpagoBI 教程 Lesson 1:Introduction and Installation

    SapgoBI Lesson 1: Introduction and Installation Downloading and installing SpagoBI. Download SpagoBI ...

随机推荐

  1. Sails 自定义 model 方法

    Sails 自定义 model 方法 在 Sails 中 model 提供了一些原生的静态方法,如 .create(), .update(), .destroy(), .find(), 等. 在实际业 ...

  2. 数据仓库的自动ETL研究

    但是,在实施数据集成的过程中,由于不同用户提供的数据可能来自不同的途径,其数据内容.数据格式和数据质量千差万别,有时甚至会遇到数据格式不能转换或数据转换格式后丢失信息等棘手问题,严重阻碍了数据在各部门 ...

  3. poj-2376 Cleaning Shifts (排序+贪心)

    http://poj.org/problem?id=2376 john有n头牛做打扫工作,他想在t时间内每个时间都至少有一头牛在做打扫工作,第一头牛在1,最后一头牛在t时间,每一头牛工作都有一个开始时 ...

  4. 如何实现wpf的多国语言

    http://www.cnblogs.com/horan/archive/2012/04/20/wpf-multilanguage.html 4.0版本的locbaml http://michaels ...

  5. [HDOJ1043]Eight(康托展开 BFS 打表)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1043 八数码问题,因为固定了位置所以以目标位置开始搜索,把所有情况(相当于一个排列)都记录下来,用康托 ...

  6. 多个电脑共用一个ssh

    比如我们有多个设备,但不想每个设备上生成一个ssh key,然后去github或其他网站上添加,那样的话,ssh key会比较多,搞起来会比较乱,所以我们想在不同的设备上使用同一个ssh. 做法是,我 ...

  7. hibernate的save()和persit()之间的区别

    这个问题啊,我在传智的Hibernate 视频上有小段讲解,save() 和persist() 都是持久化的保存,这两个方法在已经开启事物的情况下没多大区别:在不开启事物的时候save()方法会把数据 ...

  8. SVN 显示灰色减号代表什么意思

    灰色减号(ignored):意思就是忽略的意思,不对其进行版本控制,忽略对其进行的任何操作

  9. 一个发光的搜索边框(纯CSS3)

    这是效果图,边框会不停的闪,兼容各种浏览器 HTML代码: <body> <div class="container"> <form method=& ...

  10. table注意事项

    注意事项:1.不要给table,th,td以外的表格标签加样式:2.单元格默认平分table 的宽度3.th里面的内容默认加粗并且左右上下居中显示4.td里面的内容默认上下居中左右居左显示5. tab ...