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. 新环境配置与使用Vim指南

    1.下载源码 git clone git@github.com:vim/vim.git 2.编译 1.安装依赖软件 sudo apt-get install libncurses5-dev libgn ...

  2. 《c程序设计语言》读书笔记--子函数原型和声明的形参

    #include <stdio.h> #define Num 20 int power(int base,int n) { int p = 1; int i; for(i = 0;i &l ...

  3. leetcode:Odd Even Linked List

    Given a singly linked list, group all odd nodes together followed by the even nodes. Please note her ...

  4. iOS设备升级iOS7

    引自:http://lifehacker.com/how-to-upgrade-to-ios-7-right-now-1288208215 Although iOS 7 won't see an of ...

  5. HDU 1574 RP问题

    如果说难的话,难就难在对阶段的划分. 这又是一道对值域空间进行分段的题目. 因为rp有正有负,所以将整个数组向右平移10000个单位长度 l和r分别是rp可能的最小值 因为b是“门槛”,所以如果 发生 ...

  6. iOS基础CGAffineTransform的简单使用

    CoreGraphics框架中的CGAffineTransform类可用于设定UIView的transform属性,控制视图的缩放.旋转和平移操作: 另称放射变换矩阵,可参照线性代数的矩阵实现方式0. ...

  7. Linux diff patch

    /***************************************************************************** * Linux diff patch * ...

  8. JavaScript中Element与Node的区别,children与childNodes的区别

    关于Element跟Node的区别,cilldren跟childNodes的区别很多朋友弄不清楚,本文试图让大家明白这几个概念之间的区别. Node(节点)是DOM层次结构中的任何类型的对象的通用名称 ...

  9. Python [Leetcode 344]Reverse String

    题目描述: Write a function that takes a string as input and returns the string reversed. Example:Given s ...

  10. python练习程序(批量重命名)

    # -*- coding: cp936 -*- import sys,os,string d=0; path="F://test" srcfile=os.listdir(path) ...