虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

while循环

  • 微机灯光控制系统

    一、实验目的1.掌握定时/计数器、输入/输出接口电路设计方法。    2.掌握中断控制编程技术的方法和应用。3.掌握8086汇编语言程序设计方法。 二、实验内容与要求 微机灯光控制系统主要用于娱乐场所的彩灯控制。系统的彩灯共有12组,在实验时用12个发光二极管模拟。1. 基本要求:灯光控制共有8种模式,如12个灯依次点亮;12个灯同时闪烁等八种。系统可以通过键盘和显示屏的人机对话,将8种模式进行任意个数、任意次序的连接组合。系统不断重复执行输入的模式组合,直至键盘有任意一个键按下,退出灯光控制系统,返回DOS系统。2. 提高要求:音乐彩灯控制系统,根据音乐的变化控制彩灯的变化,主要有以下几种:第一种为音乐节奏控制彩灯,按音乐的节拍变换彩灯花样。第二种音律的强弱(信号幅度大小)控制彩灯。强音时,灯的亮度加大,且被点亮的数目增多。第三种按音调高低(信号频率高低)控制彩灯。低音时,某一部分灯点亮;高音时,另一部分点亮。 三、实验报告要求 1.设计目的和内容 2.总体设计 3.硬件设计:原理图(接线图)及简要说明 4.软件设计框图及程序清单5.设计结果和体会(包括遇到的问题及解决的方法) 四、设计原理我们以背景霓虹灯的一种显示效果为例,介绍控制霓虹灯显示的基本原理。设有一排 n 段水平排列的霓虹灯,某种显示方式为从左到右每0.2 秒逐个点亮。其控制过程如下: 若以“ 1 ”代表霓虹灯点亮,以“ 0 ”代表霓虹灯熄灭,则开始时刻, n 段霓虹灯的控制信号均为“ 0 ”,随后,控制器将一帧 n 个数据送至 n 段霓虹灯的控制端,其中,最左边的一段霓虹灯对应的控制数据为“ 1 ”,其余的数据均为零,即 1000 … 000 。当 n 个数据送完以后,控制器停止送数,保留这种状态(定时) 0.2 秒,此时,第 1 段霓虹灯被点亮,其余霓虹灯熄灭。随后,控制器又在极短的时间内将数据 1100 … 000 送至霓虹灯的控制端,并定时 0.2 秒,这段时间,前两段霓虹灯被点亮。由于送数据的过程很快,我们观测到的效果是第一段霓虹灯被点亮 0.2 秒后,第 2 段霓虹灯接着被点亮,即每隔 0.2 秒显示一帧图样。如此下去,最后控制器将数据 1111 … 111 送至 n 段霓虹灯的控制端,则 n 段霓虹灯被全部点亮。 只要改变送至每段霓虹灯的数据,即可改变霓虹灯的显示方式,显然,我们可以通过合理地组合数据(编程)来得到霓虹灯的不同显示方式。 五、总体方案论证分析系统设计思路如下:1) 采集8位开关输入信号,若输入数据为0时,将其修改为1。确定输入的硬件接口电路。采样输入开关量,并存入NUM的软件程序段。2) 以12个灯依次点亮为例(即灯光控制模式M1),考虑与其相应的灯光显示代码数据。确定显示代码数据输出的接口电路。输出一个同期显示代码的软件程序段(暂不考虑时隙的延时要求)。3) 应用定时中断服务和NUM数据,实现t=N×50ms的方法。4) 实现某一种模式灯光显示控制中12个时隙一个周期,共重复四次的控制方法。要求在初始化时采样开关输入数据NUM,并以此控制每一时隙的延时时间;在每一时隙结束时,检查有无键按下,若是退出键按下,则结束灯光控制,返回DOS系统,若是其他键就返回主菜单,重新输入控制模式数据。5) 通过人机对话,输入8种灯光显示控制模式的任意个数、任意次序连接组合的控制模式数据串(以ENTER键结尾)。对输入的数据进行检查,若数据都在1 - 8之间,则存入INBUF;若有错误,则通过屏幕显示输入错误,准备重新输入灯光显示控制模式数据。6) 依次读取INBUF中的控制模式数据进行不同模式的灯光显示控制,在没有任意键按下的情况下,系统从第一个控制模式数据开始,顺序工作到最后一个控制模式数据后,又返回到第一个控制模式数据,不断重复循环进行灯光显示控制。7) 本系统的软件在总体上有两部份,即主程序(MAIN)和实时中断服务程序(INTT)。讨论以功能明确、相互界面分割清晰的软件程序模块化设计方法。即确定有关功能模块,并画出以功能模块表示的主程序(MAIN)流程框图和定时中断服务程序的流程框图。    六、硬件电路设计   以微机实验平台和PC机资源为硬件设计的基础,不需要外加电路。主要利用了以下的资源:1.8255并行口电路8255并行口电路主要负责数据的输入与输出,可以输出数据控制发光二极管的亮灭和读取乒乓开关的数据。实验时可以将8255的A口、B口和一组发光二极管相连,C口和乒乓开关相连。2.8253定时/计数器8253定时/计数器和8259中断控制器一起实现时隙定时。本设计的定时就是采用的t=N×50ms的方法,50ms由8253定时/计数器的计数器0控制定时,N是在中断服务程序中软件计时。8253的OUT0接到IRQ2,产生中断请求信号。8253定时/计数器定时结束会发出中断信号,进入中断服务程序。3.PC机资源本设计除了利用PC机作为控制器之外,还利用了PC机的键盘和显示器。键盘主要是输入控制模式数据,显示器就是显示提示信息。   七、软件设计   软件主要分为主程序(MAIN)和中断服务程序(INTT),主程序包含系统初始化、读取乒乓开关、读取控制模式数据以及按键处理等模块。中断服务程序主要是定时时间到后根据控制模式数据点亮相应的发光二极管。1.主程序主程序的程序流程图如图1所示。

    标签: 微机 灯光控制

    上传时间: 2014-04-05

    上传用户:q986086481

  • 单片机音乐中音调和节拍的确定方法

    单片机音乐中音调和节拍的确定方法:调号-音乐上指用以确定乐曲主音高度的符号。很明显一个八度就有12个半音。A、B、C、D、E、F、G。经过声学家的研究,全世界都用这些字母来表示固定的音高。比如,A这个音,标准的音高为每秒钟振动440周。 升C调:1=#C,也就是降D调:1=BD;277(频率)升D调:1=#D,也就是降E调:1=BE;311升F调:1=#F,也就是降G调:1=BG;369升G调:1=#G,也就是降A调:1=BA;415升A调:1=#A,也就是降B调:1=BB。466,C 262   #C277   D 294   #D(bE)311  E 330   F 349   #F369   G 392  #G415A 440.    #A466    B 494 所谓1=A,就是说,这首歌曲的“导”要唱得同A一样高,人们也把这首歌曲叫做A调歌曲,或叫“唱A调”。1=C,就是说,这首歌曲的“导”要唱得同C一样高,或者说“这歌曲唱C调”。同样是“导”,不同的调唱起来的高低是不一样的。各调的对应的标准频率为: 单片机演奏音乐时音调和节拍的确定方法 经常看到一些刚学单片机的朋友对单片机演奏音乐比较有兴趣,本人也曾是这样。在此,本人将就这方面的知识做一些简介,但愿能对单片机演奏音乐比较有兴趣而又不知其解的朋友能有所启迪。 一般说来,单片机演奏音乐基本都是单音频率,它不包含相应幅度的谐波频率,也就是说不能象电子琴那样能奏出多种音色的声音。因此单片机奏乐只需弄清楚两个概念即可,也就是“音调”和“节拍”。音调表示一个音符唱多高的频率,节拍表示一个音符唱多长的时间。 在音乐中所谓“音调”,其实就是我们常说的“音高”。在音乐中常把中央C上方的A音定为标准音高,其频率f=440Hz。当两个声音信号的频率相差一倍时,也即f2=2f1时,则称f2比f1高一个倍频程, 在音乐中1(do)与 ,2(来)与 ……正好相差一个倍频程,在音乐学中称它相差一个八度音。在一个八度音内,有12个半音。以1—i八音区为例, 12个半音是:1—#1、#1—2、2—#2、#2—3、3—4、4—#4,#4—5、5一#5、#5—6、6—#6、#6—7、7—i。这12个音阶的分度基本上是以对数关系来划分的。如果我们只要知道了这十二个音符的音高,也就是其基本音调的频率,我们就可根据倍频程的关系得到其他音符基本音调的频率。 知道了一个音符的频率后,怎样让单片机发出相应频率的声音呢?一般说来,常采用的方法就是通过单片机的定时器定时中断,将单片机上对应蜂鸣器的I/O口来回取反,或者说来回清零,置位,从而让蜂鸣器发出声音,为了让单片机发出不同频率的声音,我们只需将定时器予置不同的定时值就可实现。那么怎样确定一个频率所对应的定时器的定时值呢?以标准音高A为例:   A的频率f = 440 Hz,其对应的周期为:T = 1/ f = 1/440 =2272μs 由上图可知,单片机上对应蜂鸣器的I/O口来回取反的时间应为:t = T/2 = 2272/2 = 1136μs这个时间t也就是单片机上定时器应有的中断触发时间。一般情况下,单片机奏乐时,其定时器为工作方式1,它以振荡器的十二分频信号为计数脉冲。设振荡器频率为f0,则定时器的予置初值由下式来确定:    t = 12 *(TALL – THL)/ f0 式中TALL = 216 = 65536,THL为定时器待确定的计数初值。因此定时器的高低计数器的初值为:     TH = THL / 256 = ( TALL – t* f0/12) / 256    TL = THL % 256 = ( TALL – t* f0/12) %256  将t=1136μs代入上面两式(注意:计算时应将时间和频率的单位换算一致),即可求出标准音高A在单片机晶振频率f0=12Mhz,定时器在工作方式1下的定时器高低计数器的予置初值为 :    TH440Hz = (65536 – 1136 * 12/12) /256 = FBH    TL440Hz = (65536 – 1136 * 12/12)%256 = 90H根据上面的求解方法,我们就可求出其他音调相应的计数器的予置初值。 音符的节拍我们可以举例来说明。在一张乐谱中,我们经常会看到这样的表达式,如1=C  、1=G …… 等等,这里1=C,1=G表示乐谱的曲调,和我们前面所谈的音调有很大的关联, 、 就是用来表示节拍的。以 为例加以说明,它表示乐谱中以四分音符为节拍,每一小结有三拍。比如:      其中1 、2 为一拍,3、4、5为一拍,6为一拍共三拍。1 、2的时长为四分音符的一半,即为八分音符长,3、4的时长为八分音符的一半,即为十六分音符长,5的时长为四分音符的一半,即为八分音符长,6的时长为四分音符长。那么一拍到底该唱多长呢?一般说来,如果乐曲没有特殊说明,一拍的时长大约为400—500ms 。我们以一拍的时长为400ms为例,则当以四分音符为节拍时,四分音符的时长就为400ms,八分音符的时长就为200ms,十六分音符的时长就为100ms。可见,在单片机上控制一个音符唱多长可采用循环延时的方法来实现。首先,我们确定一个基本时长的延时程序,比如说以十六分音符的时长为基本延时时间,那么,对于一个音符,如果它为十六分音符,则只需调用一次延时程序,如果它为八分音符,则只需调用二次延时程序,如果它为四分音符,则只需调用四次延时程序,依次类推。通过上面关于一个音符音调和节拍的确定方法,我们就可以在单片机上实现演奏音乐了。具体的实现方法为:将乐谱中的每个音符的音调及节拍变换成相应的音调参数和节拍参数,将他们做成数据表格,存放在存储器中,通过程序取出一个音符的相关参数,播放该音符,该音符唱完后,接着取出下一个音符的相关参数……,如此直到播放完毕最后一个音符,根据需要也可循环不停地播放整个乐曲。另外,对于乐曲中的休止符,一般将其音调参数设为FFH,FFH,其节拍参数与其他音符的节拍参数确定方法一致,乐曲结束用节拍参数为00H来表示。下面给出部分音符(三个八度音)的频率以及以单片机晶振频率f0=12Mhz,定时器在工作方式1下的定时器高低计数器的予置初值 : C调音符  频率Hz 262 277 293 311 329 349 370 392 415 440 466 494TH/TL F88B F8F2 F95B F9B7 FA14 FA66 FAB9 FB03 FB4A FB8F FBCF FC0BC调音符 1 1# 2 2# 3 4 4# 5 5# 6 6# 7频率Hz 523 553 586 621 658 697 739 783 830 879 931 987TH/TL FC43 FC78 FCAB FCDB FD08 FD33 FD5B FD81 FDA5 FDC7 FDE7 FE05C调音符  频率Hz 1045 1106 1171 1241 1316 1393 1476 1563 1658 1755 1860 1971TH/TL FB21 FE3C FE55 FE6D FE84 FE99 FEAD FEC0 FE02 FEE3 FEF3 FF02

    标签: 单片机 音调

    上传时间: 2013-10-20

    上传用户:哈哈haha

  • 多路电压采集系统

    多路电压采集系统一、实验目的1.熟悉可编程芯片ADC0809,8253的工作过程,掌握它们的编程方法。2.加深对所学知识的理解并学会应用所学的知识,达到在应用中掌握知识的目的。 二、实验内容与要求1.基本要求通过一个A/D转换器循环采样4路模拟电压,每隔一定时间去采样一次,一次按顺序采样4路信号。A/D转换器芯片AD0809将采样到的模拟信号转换为数字信号,转换完成后,CPU读取数据转换结果,并将结果送入外设即CRT/LED显示,显示包括电压路数和数据值。2. 提高要求 (1) 可以实现循环采集和选择采集2种方式。(2)在CRT上绘制电压变化曲线。 三、实验报告要求 1.设计目的和内容 2.总体设计 3.硬件设计:原理图(接线图)及简要说明 4.软件设计框图及程序清单5.设计结果和体会(包括遇到的问题及解决的方法) 四、总体设计设计思路如下:1) 4路模拟电压信号通过4个电位器提供0-5V的电压信号。2) 选择ADC0809芯片作为A/D转换器,4路输入信号分别接到ADC0809的IN0—IN4通道,每隔一定的时间采样一次,采完一路采集下一路,4路电压循环采集。3) 利用3个LED数码管显示数据,1个数码管用来显示输入电压路数,3个数码管用来显示电压采样值。4) 延时由8253定时/计数器来实现。 五、硬件电路设计根据设计思路,硬件主要利用了微机实验平台上的ADC0809模数转换器、8253定时/计数器以及LED显示输出等模块。电路原理图如下:1.基本接口实验板部分1) 电位计模块,4个电位计输出4路1-5V的电压信号。2) ADC0809模数转换器,将4路电压信号接到IN0-IN3,ADD_A、ADD_B、ADD_C分别接A0、A1、A2,CS_AD接CS0时,4个采样通道对应的地址分别为280H—283H。3) 延时模块,8253和8255组成延时电路。8255的PA0接到8253的OUT0,程序中查询计数是否结束。硬件电路图如图1所示。 图1 基本实验板上的电路图实验板上的LED显示部分实验板上主要用到了LED数码管显示电路,插孔CS1用于数码管段码的输出选通,插孔CS2用于数码管位选信号的输出选通。电路图如图2所示。

    标签: 多路 电压采集

    上传时间: 2013-11-06

    上传用户:sunchao524

  • MCS51系列单片机软件控制复位的可靠方法

    MCS51系列单片机软件控制复位的可靠方法:文章指出了一种广泛流传的误解:在MCS-51系列单片机中,只要用指令使程序从起始地址开始执行,就可以复位单片机,摆脱干扰。通过实验,揭示了软件控制复位的可靠方法。有的单片机(如8098)有专门的复位指令,某些增强型MCS-51系统单片机虽然没有复位指令,但片内集成了WATCHDOG电路,故抗干扰也不成问题。而普及型MCS-51系列单片机(如8031和8032)既然无复位指令,又不带硬件WATCHDOS,如果没有外接硬件WATCHDOG电路,就必须采用软件抗干扰技术。常用的软件抗干扰技术有:软件陷阱、指令冗余、软件WATCHDOG等,它们的作用是在系统受干扰时能及时发现,再用软件的方法使系统复位。所谓软件复位就是用一系列指令来模仿复位操作,这就是MCS-51系列单片机所特有的软件复位技术。现用一简单的实验说明。接于P1.0的发光二极管LED0用来表示主程序的工作情况,接于P1.1的发光二极管LED1用于表示低级中断子程序的工作情况,接于P1.2的发光二极管LED2用来表示高级中断子程序的工作情况,接于P3.2口的按钮用来设立干扰标志,程序检测到干扰标志后故意进入死循环或掉进陷井,模仿受干扰的情况,从而检验各种复位方法的实际效果。实验初始化程序如下:

    标签: MCS 51 单片机 软件控制

    上传时间: 2013-11-03

    上传用户:sevenbestfei

  • USB Demonstration for DK3200 w

    The μPSD32xx family, from ST, consists of Flash programmable system devices with a 8032 MicrocontrollerCore. Of these, the μPSD3234A and μPSD3254A are notable for having a complete implementationof the USB hardware directly on the chip, complying with the Universal Serial Bus Specification, Revision1.1.This application note describes a demonstration program that has been written for the DK3200 hardwaredemonstration kit (incorporating a μPSD3234A device). It gives the user an idea of how simple it is to workwith the device, using the HID class as a ready-made device driver for the USB connection.IN-APPLICATION-PROGRAMMING (IAP) AND IN-SYSTEM-PROGRAMMING (ISP)Since the μPSD contains two independent Flash memory arrays, the Micro Controller Unit (MCU) can executecode from one memory while erasing and programming the other. Product firmware updates in thefield can be reliably performed over any communication channel (such as CAN, Ethernet, UART, J1850)using this unique architecture. For In-Application-Programming (IAP), all code is updated through theMCU. The main advantage for the user is that the firmware can be updated remotely. The target applicationruns and takes care on its own program code and data memory.IAP is not the only method to program the firmware in μPSD devices. They can also be programmed usingIn-System-Programming (ISP). A IEEE1149.1-compliant JTAG interface is included on the μPSD. Withthis, the entire device can be rapidly programmed while soldered to the circuit board (Main Flash memory,Secondary Boot Flash memory, the PLD, and all configuration areas). This requires no MCU participation.The MCU is completely bypassed. So, the μPSD can be programmed or reprogrammed any time, anywhere, even when completely uncommitted.Both methods take place with the device in its normal hardware environment, soldered to a printed circuitboard. The IAP method cannot be used without previous use of ISP, because IAP utilizes a small amountof resident code to receive the service commands, and to perform the desired operations.

    标签: Demonstration 3200 USB for

    上传时间: 2014-02-27

    上传用户:zhangzhenyu

  • Input Signal Rise and Fall Tim

    All inputs of the C16x family have Schmitt-Trigger input characteristics. These Schmitt-Triggers are intended to always provide proper internal low and high levels, even if anundefined voltage level (between TTL-VIL and TTL-VIH) is externally applied to the pin.The hysteresis of these inputs, however, is very small, and can not be properly used in anapplication to suppress signal noise, and to shape slow rising/falling input transitions.Thus, it must be taken care that rising/falling input signals pass the undefined area of theTTL-specification between VIL and VIH with a sufficient rise/fall time, as generally usualand specified for TTL components (e.g. 74LS series: gates 1V/us, clock inputs 20V/us).The effect of the implemented Schmitt-Trigger is that even if the input signal remains inthe undefined area, well defined low/high levels are generated internally. Note that allinput signals are evaluated at specific sample points (depending on the input and theperipheral function connected to it), at that signal transitions are detected if twoconsecutive samples show different levels. Thus, only the current level of an input signalat these sample points is relevant, that means, the necessary rise/fall times of the inputsignal is only dependant on the sample rate, that is the distance in time between twoconsecutive evaluation time points. If an input signal, for instance, is sampled throughsoftware every 10us, it is irrelevant, which input level would be seen between thesamples. Thus, it would be allowable for the signal to take 10us to pass through theundefined area. Due to the sample rate of 10us, it is assured that only one sample canoccur while the signal is within the undefined area, and no incorrect transition will bedetected. For inputs which are connected to a peripheral function, e.g. capture inputs, thesample rate is determined by the clock cycle of the peripheral unit. In the case of theCAPCOM unit this means a sample rate of 400ns @ 20MHz CPU clock. This requiresinput signals to pass through the undefined area within these 400ns in order to avoidmultiple capture events.For input signals, which do not provide the required rise/fall times, external circuitry mustbe used to shape the signal transitions.In the attached diagram, the effect of the sample rate is shown. The numbers 1 to 5 in thediagram represent possible sample points. Waveform a) shows the result if the inputsignal transition time through the undefined TTL-level area is less than the time distancebetween the sample points (sampling at 1, 2, 3, and 4). Waveform b) can be the result ifthe sampling is performed more than once within the undefined area (sampling at 1, 2, 5,3, and 4).Sample points:1. Evaluation of the signal clearly results in a low level2. Either a low or a high level can be sampled here. If low is sampled, no transition willbe detected. If the sample results in a high level, a transition is detected, and anappropriate action (e.g. capture) might take place.3. Evaluation here clearly results in a high level. If the previous sample 2) had alreadydetected a high, there is no change. If the previous sample 2) showed a low, atransition from low to high is detected now.

    标签: Signal Input Fall Rise

    上传时间: 2013-10-23

    上传用户:copu

  • 介绍C16x系列微控制器的输入信号升降时序图及特性

    All inputs of the C16x family have Schmitt-Trigger input characteristics. These Schmitt-Triggers are intended to always provide proper internal low and high levels, even if anundefined voltage level (between TTL-VIL and TTL-VIH) is externally applied to the pin.The hysteresis of these inputs, however, is very small, and can not be properly used in anapplication to suppress signal noise, and to shape slow rising/falling input transitions.Thus, it must be taken care that rising/falling input signals pass the undefined area of theTTL-specification between VIL and VIH with a sufficient rise/fall time, as generally usualand specified for TTL components (e.g. 74LS series: gates 1V/us, clock inputs 20V/us).The effect of the implemented Schmitt-Trigger is that even if the input signal remains inthe undefined area, well defined low/high levels are generated internally. Note that allinput signals are evaluated at specific sample points (depending on the input and theperipheral function connected to it), at that signal transitions are detected if twoconsecutive samples show different levels. Thus, only the current level of an input signalat these sample points is relevant, that means, the necessary rise/fall times of the inputsignal is only dependant on the sample rate, that is the distance in time between twoconsecutive evaluation time points. If an input signal, for instance, is sampled throughsoftware every 10us, it is irrelevant, which input level would be seen between thesamples. Thus, it would be allowable for the signal to take 10us to pass through theundefined area. Due to the sample rate of 10us, it is assured that only one sample canoccur while the signal is within the undefined area, and no incorrect transition will bedetected. For inputs which are connected to a peripheral function, e.g. capture inputs, thesample rate is determined by the clock cycle of the peripheral unit. In the case of theCAPCOM unit this means a sample rate of 400ns @ 20MHz CPU clock. This requiresinput signals to pass through the undefined area within these 400ns in order to avoidmultiple capture events.

    标签: C16x 微控制器 输入信号 时序图

    上传时间: 2014-04-02

    上传用户:han_zh

  • 定时与计数技术

    第6章 定时与计数技术6.1  概  述1.定时  定义:提供的时间基准。  分类:内部定时、外部定时。2.计数  定时与计数本质上是一致的。  计数的信号随机,定时的信号具有周期性。3.应用分时系统切换任务的时间基准、测速、计数6.1.2 定时方法1.软件定时  通过软件指令周期方法定时,如执行循环程序。  增加CPU负担,通用性差,一般用于短延时。2.不可编程硬件定时  采用中小规模IC构成。  不增加CPU负担,成本低,定时值不可改变。3.可编程硬件定时  采用可编程计数器完成,软件可改变计数值。  可编程定时/计数器:实质上定时和计数本质上都是脉冲计数器,定时计的是内部基准时钟源产生的脉冲,计数是计外部脉冲。6.1.3  定时/计数器基本原理1.内部逻辑CPU接口:  片选、低端地址线、读写控制线、数据线外设接口: 时钟、控制、输出内部逻辑:  端口地址译码器、各种寄存器2.工作过程  设初值、控制(计数)、输出

    标签: 定时 计数技术

    上传时间: 2013-11-07

    上传用户:yuzsu

  • 用C51写的普通拼音输入法源程序代码

    用C51写的普通拼音输入法源程序代码:原作使用了一个二维数组用以查表,我认为这样比较的浪费空间,而且每个字表的索引地址要手工输入,效率不高。所以我用结构体将其改写了一下。就是大家现在看到的这个。  因为代码比较的大,共有6,000多汉字,这样就得要12,000 byte来存放GB内码,所以也是没办法的.编译结果约为3000h,因为大部分是索引表,代码优化几乎无效。    在Keil C里仿真芯片选用的是华邦的W77E58,它有32k ROM, 256B on-chip RAM, 1K on-chip SRAM (用DPTR1指针寻址,相当于有1K的片上xdata)。条件有限,没有上片试验,仿真而已。  打算将其移植到AVR上,但CodeAVRC与IAR EC++在结构体、指针的定义使用上似乎与C51不太一样,现在还未搞定。还希望在这方面有经验的网友能给予指导。 #include<stdio.h> char * py_ime(char *); void main(void){ while(1)    {     char input_string[]="yI";     xdata char chinese_string[255];     sprintf(chinese_string,"%s",py_ime(input_string));    }}

    标签: C51 拼音输入法 代码 源程序

    上传时间: 2013-10-30

    上传用户:cainaifa

  • 采用18b20芯片的温度测量C51源程序

    #include <reg51.h>#include<intrins.h> #define   BUSY1    (DQ1==0) sbit      DQ1    =  P0^4; unsigned char idata TMP; unsigned char idata TMP_d; unsigned char f; void wr_ds18_1(char dat);unsigned char rd_ds18_1(); /***************延时程序,单位us,大于10us*************/void time_delay(unsigned char time){   time=time-10;  time=time/6;  while(time!=0)time--;} /*****************************************************//*                reset ds18b20                      *//*****************************************************/void ds_reset_1(void){  unsigned char idata count=0;    DQ1=0;   time_delay(240); time_delay(240);  DQ1=1;  return;}

    标签: 18b20 C51 芯片 温度测量

    上传时间: 2013-10-29

    上传用户:sssnaxie