亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

蟲(chóng)蟲(chóng)首頁(yè)| 資源下載| 資源專輯| 精品軟件
登錄| 注冊(cè)

while循環(huán)(huán)

  • C51基本結(jié)構(gòu)程序設(shè)計(jì)

    C51基本結(jié)構(gòu)程序設(shè)計(jì)1. 掌握if語(yǔ)句來(lái)實(shí)現(xiàn)選擇結(jié)構(gòu),能利用if語(yǔ)句編寫(xiě)相應(yīng)的分枝結(jié)構(gòu)的程序。在嵌套if語(yǔ)句中,一定要搞清楚else與哪個(gè)if結(jié)合的問(wèn)題。2.掌握switch語(yǔ)句來(lái)實(shí)現(xiàn)多向分枝選擇結(jié)構(gòu),能利用switch語(yǔ)句編寫(xiě)相應(yīng)的分枝結(jié)構(gòu)的程序。 3. 掌握循環(huán)語(yǔ)句的即初始化、循環(huán)體、循環(huán)控制及結(jié)束四個(gè)部分,并能進(jìn)行循環(huán)語(yǔ)句的程序設(shè)計(jì)。分別掌握f(shuō)or 語(yǔ)句、while語(yǔ)句以及do-while語(yǔ)句的使用語(yǔ)法及方法,能利用這三種循環(huán)結(jié)構(gòu)進(jìn)行循環(huán)程序設(shè)計(jì),理解這三種語(yǔ)句的異同。4.理解并掌握continue、break語(yǔ)句在循環(huán)結(jié)構(gòu)和選擇結(jié)構(gòu)中的作用。對(duì)于goto語(yǔ)句,理解該語(yǔ)句優(yōu)缺點(diǎn)。C51語(yǔ)言是結(jié)構(gòu)化編程語(yǔ)言。結(jié)構(gòu)化語(yǔ)言的基本元素是模塊,它是程序的一部分.只有一個(gè)出口和一個(gè)入口.不允許有偶然的中途插入或以模塊的其它路徑退出。結(jié)構(gòu)化編程語(yǔ)言在沒(méi)有妥善保護(hù)或恢復(fù)堆棧和其它相關(guān)的寄存器之前,不應(yīng)隨便跳入或跳出一個(gè)模塊。因此使用這種結(jié)構(gòu)化語(yǔ)言進(jìn)行編程,當(dāng)要退出中斷時(shí),堆棧不會(huì)因?yàn)槌绦蚴褂昧巳魏慰梢越邮艿拿疃罎ⅰ?nbsp;   結(jié)構(gòu)化程序由若干模塊組成,每個(gè)模塊中包含著若干個(gè)基本結(jié)構(gòu),而每個(gè)基本結(jié)構(gòu)中可以有若干條語(yǔ)句。歸納起來(lái),C51程序有順序結(jié)構(gòu)、選擇結(jié)構(gòu)、循環(huán)結(jié)構(gòu)共三種結(jié)構(gòu)。

    標(biāo)簽: C51 基本結(jié)構(gòu) 程序設(shè)計(jì)

    上傳時(shí)間: 2013-11-01

    上傳用戶:四只眼

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

    標(biāo)簽: Demonstration 3200 USB for

    上傳時(shí)間: 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.

    標(biāo)簽: Signal Input Fall Rise

    上傳時(shí)間: 2013-10-23

    上傳用戶:copu

  • 介紹C16x系列微控制器的輸入信號(hào)升降時(shí)序圖及特性

    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.

    標(biāo)簽: C16x 微控制器 輸入信號(hào) 時(shí)序圖

    上傳時(shí)間: 2014-04-02

    上傳用戶:han_zh

  • 串行編程器源程序(Keil C語(yǔ)言)

    串行編程器源程序(Keil C語(yǔ)言)//FID=01:AT89C2051系列編程器//實(shí)現(xiàn)編程的讀,寫(xiě),擦等細(xì)節(jié)//AT89C2051的特殊處:給XTAL一個(gè)脈沖,地址計(jì)數(shù)加1;P1的引腳排列與AT89C51相反,需要用函數(shù)轉(zhuǎn)換#include <e51pro.h> #define C2051_P3_7 P1_0#define C2051_P1 P0//注意引腳排列相反#define C2051_P3_0  P1_1#define C2051_P3_1 P1_2#define C2051_XTAL P1_4#define C2051_P3_2 P1_5#define C2051_P3_3 P1_6#define C2051_P3_4 P1_7#define C2051_P3_5 P3_5 void InitPro01()//編程前的準(zhǔn)備工作{ SetVpp0V(); P0=0xff; P1=0xff; C2051_P3_5=1; C2051_XTAL=0; Delay_ms(20); nAddress=0x0000; SetVpp5V();} void ProOver01()//編程結(jié)束后的工作,設(shè)置合適的引腳電平{ SetVpp5V(); P0=0xff; P1=0xff; C2051_P3_5=1; C2051_XTAL=1;} BYTE GetData()//從P0口獲得數(shù)據(jù){ B_0=P0_7; B_1=P0_6; B_2=P0_5; B_3=P0_4; B_4=P0_3; B_5=P0_2; B_6=P0_1; B_7=P0_0; return B;} void SetData(BYTE DataByte)//轉(zhuǎn)換并設(shè)置P0口的數(shù)據(jù){ B=DataByte; P0_0=B_7; P0_1=B_6; P0_2=B_5; P0_3=B_4; P0_4=B_3; P0_5=B_2; P0_6=B_1; P0_7=B_0;} void ReadSign01()//讀特征字{ InitPro01(); Delay_ms(1);//----------------------------------------------------------------------------- //根據(jù)器件的DataSheet,設(shè)置相應(yīng)的編程控制信號(hào) C2051_P3_3=0; C2051_P3_4=0; C2051_P3_5=0; C2051_P3_7=0; Delay_ms(20); ComBuf[2]=GetData(); C2051_XTAL=1; C2051_XTAL=0; Delay_us(20); ComBuf[3]=GetData(); ComBuf[4]=0xff;//----------------------------------------------------------------------------- ProOver01();} void Erase01()//擦除器件{ InitPro01();//----------------------------------------------------------------------------- //根據(jù)器件的DataSheet,設(shè)置相應(yīng)的編程控制信號(hào) C2051_P3_3=1; C2051_P3_4=0; C2051_P3_5=0; C2051_P3_7=0; Delay_ms(1); SetVpp12V(); Delay_ms(1); C2051_P3_2=0; Delay_ms(10); C2051_P3_2=1; Delay_ms(1);//----------------------------------------------------------------------------- ProOver01();} BOOL Write01(BYTE Data)//寫(xiě)器件{//----------------------------------------------------------------------------- //根據(jù)器件的DataSheet,設(shè)置相應(yīng)的編程控制信號(hào) //寫(xiě)一個(gè)單元 C2051_P3_3=0; C2051_P3_4=1; C2051_P3_5=1; C2051_P3_7=1; SetData(Data); SetVpp12V(); Delay_us(20); C2051_P3_2=0; Delay_us(20); C2051_P3_2=1; Delay_us(20); SetVpp5V(); Delay_us(20); C2051_P3_4=0; Delay_ms(2); nTimeOut=0; P0=0xff; nTimeOut=0; while(!GetData()==Data)//效驗(yàn):循環(huán)讀,直到讀出與寫(xiě)入的數(shù)相同 {  nTimeOut++;  if(nTimeOut>1000)//超時(shí)了  {   return 0;  } } C2051_XTAL=1; C2051_XTAL=0;//一個(gè)脈沖指向下一個(gè)單元//----------------------------------------------------------------------------- return 1;} BYTE Read01()//讀器件{ BYTE Data;//----------------------------------------------------------------------------- //根據(jù)器件的DataSheet,設(shè)置相應(yīng)的編程控制信號(hào) //讀一個(gè)單元 C2051_P3_3=0; C2051_P3_4=0; C2051_P3_5=1; C2051_P3_7=1; Data=GetData(); C2051_XTAL=1; C2051_XTAL=0;//一個(gè)脈沖指向下一個(gè)單元//----------------------------------------------------------------------------- return Data;} void Lock01()//寫(xiě)鎖定位{ InitPro01();//先設(shè)置成編程狀態(tài)//----------------------------------------------------------------------------- //根據(jù)器件的DataSheet,設(shè)置相應(yīng)的編程控制信號(hào) if(ComBuf[2]>=1)//ComBuf[2]為鎖定位 {  C2051_P3_3=1;  C2051_P3_4=1;  C2051_P3_5=1;  C2051_P3_7=1;  Delay_us(20);  SetVpp12V();  Delay_us(20);  C2051_P3_2=0;  Delay_us(20);  C2051_P3_2=1;  Delay_us(20);  SetVpp5V(); } if(ComBuf[2]>=2) {  C2051_P3_3=1;  C2051_P3_4=1;  C2051_P3_5=0;  C2051_P3_7=0;  Delay_us(20);  SetVpp12V();  Delay_us(20);  C2051_P3_2=0;  Delay_us(20);  C2051_P3_2=1;  Delay_us(20);  SetVpp5V(); }//----------------------------------------------------------------------------- ProOver01();} void PreparePro01()//設(shè)置pw中的函數(shù)指針,讓主程序可以調(diào)用上面的函數(shù){ pw.fpInitPro=InitPro01; pw.fpReadSign=ReadSign01; pw.fpErase=Erase01; pw.fpWrite=Write01; pw.fpRead=Read01; pw.fpLock=Lock01; pw.fpProOver=ProOver01;}

    標(biāo)簽: Keil 串行 C語(yǔ)言 編程器

    上傳時(shí)間: 2013-11-12

    上傳用戶:gut1234567

  • 用C51寫(xiě)的普通拼音輸入法源程序代碼

    用C51寫(xiě)的普通拼音輸入法源程序代碼:原作使用了一個(gè)二維數(shù)組用以查表,我認(rèn)為這樣比較的浪費(fèi)空間,而且每個(gè)字表的索引地址要手工輸入,效率不高。所以我用結(jié)構(gòu)體將其改寫(xiě)了一下。就是大家現(xiàn)在看到的這個(gè)。  因?yàn)榇a比較的大,共有6,000多漢字,這樣就得要12,000 byte來(lái)存放GB內(nèi)碼,所以也是沒(méi)辦法的.編譯結(jié)果約為3000h,因?yàn)榇蟛糠质撬饕恚a優(yōu)化幾乎無(wú)效。    在Keil C里仿真芯片選用的是華邦的W77E58,它有32k ROM, 256B on-chip RAM, 1K on-chip SRAM (用DPTR1指針尋址,相當(dāng)于有1K的片上x(chóng)data)。條件有限,沒(méi)有上片試驗(yàn),仿真而已。  打算將其移植到AVR上,但CodeAVRC與IAR EC++在結(jié)構(gòu)體、指針的定義使用上似乎與C51不太一樣,現(xiàn)在還未搞定。還希望在這方面有經(jīng)驗(yàn)的網(wǎng)友能給予指導(dǎo)。 #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));    }}

    標(biāo)簽: C51 拼音輸入法 代碼 源程序

    上傳時(shí)間: 2013-10-30

    上傳用戶:cainaifa

  • 采用18b20芯片的溫度測(cè)量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(); /***************延時(shí)程序,單位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;}

    標(biāo)簽: 18b20 C51 芯片 溫度測(cè)量

    上傳時(shí)間: 2013-10-29

    上傳用戶:sssnaxie

  • 3.3v看門(mén)狗芯片

    The STWD100 watchdog timer circuits are self-contained devices which prevent systemfailures that are caused by certain types of hardware errors (non-responding peripherals,bus contention, etc.) or software errors (bad code jump, code stuck in loop, etc.).The STWD100 watchdog timer has an input, WDI, and an output, WDO (see Figure 2). Theinput is used to clear the internal watchdog timer periodically within the specified timeoutperiod, twd (see Section 3: Watchdog timing). While the system is operating correctly, itperiodically toggles the watchdog input, WDI. If the system fails, the watchdog timer is notreset, a system alert is generated and the watchdog output, WDO, is asserted (seeSection 3: Watchdog timing).The STWD100 circuit also has an enable pin, EN (see Figure 2), which can enable ordisable the watchdog functionality. The EN pin is connected to the internal pull-downresistor. The device is enabled if the EN pin is left floating.

    標(biāo)簽: 3.3 看門(mén)狗 芯片

    上傳時(shí)間: 2013-10-22

    上傳用戶:taiyang250072

  • RD系列微型打印機(jī)打印實(shí)例

    C51控制并口打印機(jī)實(shí)例:/* 沈陽(yáng)新榮達(dá)電子 *//* 2004-12-7 */#include <reg52.h>#define uchar unsigned char#define uint unsigned int#define data_8 P0sbit BUSY = P1^2; //打印機(jī) BUSY 接P1.2sbit STB = P1^0; //打印機(jī) STB 接P1.0void print(uchar j) //打印子程序{ uchar i;while(BUSY){}; //BUSY=1,打印機(jī)忙,等待BUSY 為0 再發(fā)數(shù)data_8=j;STB=0;i++;i--;STB=1; //給出數(shù)據(jù)鎖存時(shí)鐘BUSY=1;}void main(void){BUSY = 1; //忙信號(hào)置高STB = 1; //選通信號(hào)置高print(0x1b); //打印機(jī)初始化命令print(0x38);print(0x04);for(;;){print(0xd0); //發(fā)送漢字內(nèi)碼“新榮達(dá)”print(0xc2);print(0xc8);print(0xd9);print(0xb4);print(0xef);print(0x0d); //換行}}

    標(biāo)簽: 微型打印機(jī) 打印

    上傳時(shí)間: 2013-11-13

    上傳用戶:lwq11

  • 單片機(jī)課程總結(jié)

    單片機(jī)基礎(chǔ)知識(shí)單片機(jī)的外部結(jié)構(gòu):1、 DIP40雙列直插;2、 P0,P1,P2,P3四個(gè)8位準(zhǔn)雙向I/O引腳;(作為I/O輸入時(shí),要先輸出高電平)3、 電源VCC(PIN40)和地線GND(PIN20);4、 高電平復(fù)位RESET(PIN9);(10uF電容接VCC與RESET,即可實(shí)現(xiàn)上電復(fù)位)5、 內(nèi)置振蕩電路,外部只要接晶體至X1(PIN18)和X0(PIN19);(頻率為主頻的12倍)6、 程序配置EA(PIN31)接高電平VCC;(運(yùn)行單片機(jī)內(nèi)部ROM中的程序)7、 P3支持第二功能:RXD、TXD、INT0、INT1、T0、T1 單片機(jī)內(nèi)部I/O部件:(所為學(xué)習(xí)單片機(jī),實(shí)際上就是編程控制以下I/O部件,完成指定任務(wù))1、 四個(gè)8位通用I/O端口,對(duì)應(yīng)引腳P0、P1、P2和P3;2、 兩個(gè)16位定時(shí)計(jì)數(shù)器;(TMOD,TCON,TL0,TH0,TL1,TH1)3、 一個(gè)串行通信接口;(SCON,SBUF)4、 一個(gè)中斷控制器;(IE,IP)針對(duì)AT89C52單片機(jī),頭文件AT89x52.h給出了SFR特殊功能寄存器所有端口的定義。教科書(shū)的160頁(yè)給出了針對(duì)MCS51系列單片機(jī)的C語(yǔ)言擴(kuò)展變量類型。 C語(yǔ)言編程基礎(chǔ):1、 十六進(jìn)制表示字節(jié)0x5a:二進(jìn)制為01011010B;0x6E為01101110。2、 如果將一個(gè)16位二進(jìn)數(shù)賦給一個(gè)8位的字節(jié)變量,則自動(dòng)截?cái)酁榈?位,而丟掉高8位。3、 ++var表示對(duì)變量var先增一;var—表示對(duì)變量后減一。4、 x |= 0x0f;表示為 x = x | 0x0f;5、 TMOD = ( TMOD & 0xf0 ) | 0x05;表示給變量TMOD的低四位賦值0x5,而不改變TMOD的高四位。6、 While( 1 ); 表示無(wú)限執(zhí)行該語(yǔ)句,即死循環(huán)。語(yǔ)句后的分號(hào)表示空循環(huán)體,也就是{;}第一章    單片機(jī)最小應(yīng)用系統(tǒng):?jiǎn)纹瑱C(jī)最小系統(tǒng)的硬件原理接線圖:1、 接電源:VCC(PIN40)、GND(PIN20)。加接退耦電容0.1uF2、 接晶體:X1(PIN18)、X2(PIN19)。注意標(biāo)出晶體頻率(選用12MHz),還有輔助電容30pF3、 接復(fù)位:RES(PIN9)。接上電復(fù)位電路,以及手動(dòng)復(fù)位電路,分析復(fù)位工作原理4、 接配置:EA(PIN31)。說(shuō)明原因。第二章      基本I/O口的應(yīng)用第三章      顯示驅(qū)動(dòng)第七章      串行接口應(yīng)用

    標(biāo)簽: 單片機(jī)

    上傳時(shí)間: 2013-10-30

    上傳用戶:athjac

主站蜘蛛池模板: 沙雅县| 巧家县| 汝州市| 句容市| 龙里县| 蓬溪县| 阿巴嘎旗| 祁连县| 浑源县| 子洲县| 竹溪县| 宁化县| 西乌珠穆沁旗| 上饶市| 昌平区| 建湖县| 沈阳市| 礼泉县| 定州市| 敦化市| 夹江县| 保康县| 阜城县| 库伦旗| 诸城市| 内黄县| 东宁县| 禄劝| 平塘县| 聂荣县| 马公市| 汕头市| 安阳市| 杭锦旗| 马山县| 柏乡县| 二连浩特市| 安吉县| 宜宾县| 得荣县| 扬中市|