The MAX3243E device consists of three line drivers, five line receivers, and a dual charge-pump circuit with±15-kV ESD (HBM and IEC61000-4-2, Air-Gap Discharge) and ±8-kV ESD (IEC61000-4-2, Contact Discharge)protection on serial-port connection pins. The device meets the requirements of TIA/EIA-232-F and provides theelectrical interface between an asynchronous communication controller and the serial-port connector. Thiscombination of drivers and receivers matches that needed for the typical serial port used in an IBM PC/AT, orcompatible. The charge pump and four small external capacitors allow operation from a single 3-V to 5.5-Vsupply. In addition, the device includes an always-active noninverting output (ROUT2B), which allowsapplications using the ring indicator to transmit data while the device is powered down. The device operates atdata signaling rates up to 250 kbit/s and a maximum of 30-V/ms driver output slew rate.
標簽: MULTICHANNEL 5.5 TO RS
上傳時間: 2013-10-19
上傳用戶:ddddddd
The Philips family of Multiplexers and Switches consists of bi-directional translating switches controlled via the I2C or SMBus to fan out an upstream SCL/SDA pair to 2, 4 or 8 downstream channels of SCx/SDx pairs. The Multiplexers allow only one downstream channel to be selected at a time, while the Switches allow any individual downstream channel or combination of downstream channels to be selected, depending on the content of the programmable control register. Once one or several channels have been selected, the device acts as a wire, allowing the master on the upstream channel to send commands to devices on all the active downstream channels, and devices on the active downstream channels to communicate with each other and the master. External pull-up resistors are used to pull each individual channel up to the desired voltage level. Combined interrupt output and hardware reset input are device options that are featured.
上傳時間: 2013-10-11
上傳用戶:dianxin61
高壓雙管反激變換器的設計:介紹一種雙管反激的電路拓撲,分析了其工作原理,給出了一些關鍵技術參數的計算公式,設計并研制成功的30W 380V AC5 0H z/510V DC/+15.1 V DC(1A )、+5.2VDC(2A)輔助開關電源具有功率密度高、變換效率高、可靠性高等優良的綜合性能。該變換器在高電壓輸人情況下有重要的應用價值。【關 鍵 詞 】變換器,輔助開關電源,雙管反激 [Abstract】 A n e wt opologyfo rd oubles witchfl ybackc onverteris in troduced.Th eo perationp rincipleis a nalyzeda nds ome for mulas for calculating key parameters for the topology are presented. The designed and produced auxiliary switching power supply,i. e. 30W 380V AC5 0H z/5 10V DC/+15.1 V DC《1A )、+5.2 V DC《2A ),hase xcellentc omprehensivep erformances sucha sh ighp owerd ensity, hi ghc onversione fficiencya ndh ighr eliability.Th isc onverterh asim portanta pplicationv aluef orh igh input voltag [Keywords ]converter,au xiliary switchingp owers upply,do ubles witchf lybac
上傳時間: 2013-11-01
上傳用戶:Ants
單片機音樂中音調和節拍的確定方法:調號-音樂上指用以確定樂曲主音高度的符號。很明顯一個八度就有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
PC機之間串口通信的實現一、實驗目的 1.熟悉微機接口實驗裝置的結構和使用方法。 2.掌握通信接口芯片8251和8250的功能和使用方法。 3.學會串行通信程序的編制方法。 二、實驗內容與要求 1.基本要求主機接收開關量輸入的數據(二進制或十六進制),從鍵盤上按“傳輸”鍵(可自行定義),就將該數據通過8251A傳輸出去。終端接收后在顯示器上顯示數據。具體操作說明如下:(1)出現提示信息“start with R in the board!”,通過調整乒乓開關的狀態,設置8位數據;(2)在小鍵盤上按“R”鍵,系統將此時乒乓開關的狀態讀入計算機I中,并顯示出來,同時顯示經串行通訊后,計算機II接收到的數據;(3)完成后,系統提示“do you want to send another data? Y/N”,根據用戶需要,在鍵盤按下“Y”鍵,則重復步驟(1),進行另一數據的通訊;在鍵盤按除“Y”鍵外的任意鍵,將退出本程序。2.提高要求 能夠進行出錯處理,例如采用奇偶校驗,出錯重傳或者采用接收方回傳和發送方確認來保證發送和接收正確。 三、設計報告要求 1.設計目的和內容 2.總體設計 3.硬件設計:原理圖(接線圖)及簡要說明 4.軟件設計框圖及程序清單5.設計結果和體會(包括遇到的問題及解決的方法) 四、8251A通用串行輸入/輸出接口芯片由于CPU與接口之間按并行方式傳輸,接口與外設之間按串行方式傳輸,因此,在串行接口中,必須要有“接收移位寄存器”(串→并)和“發送移位寄存器”(并→串)。能夠完成上述“串←→并”轉換功能的電路,通常稱為“通用異步收發器”(UART:Universal Asynchronous Receiver and Transmitter),典型的芯片有:Intel 8250/8251。8251A異步工作方式:如果8251A編程為異步方式,在需要發送字符時,必須首先設置TXEN和CTS#為有效狀態,TXEN(Transmitter Enable)是允許發送信號,是命令寄存器中的一位;CTS#(Clear To Send)是由外設發來的對CPU請求發送信號的響應信號。然后就開始發送過程。在發送時,每當CPU送往發送緩沖器一個字符,發送器自動為這個字符加上1個起始位,并且按照編程要求加上奇/偶校驗位以及1個、1.5個或者2個停止位。串行數據以起始位開始,接著是最低有效數據位,最高有效位的后面是奇/偶校驗位,然后是停止位。按位發送的數據是以發送時鐘TXC的下降沿同步的,也就是說這些數據總是在發送時鐘TXC的下降沿從8251A發出。數據傳輸的波特率取決于編程時指定的波特率因子,為發送器時鐘頻率的1、1/16或1/64。當波特率指定為16時,數據傳輸的波特率就是發送器時鐘頻率的1/16。CPU通過數據總線將數據送到8251A的數據輸出緩沖寄存器以后,再傳輸到發送緩沖器,經移位寄存器移位,將并行數據變為串行數據,從TxD端送往外部設備。在8251A接收字符時,命令寄存器的接收允許位RxE(Receiver Enable)必須為1。8251A通過檢測RxD引腳上的低電平來準備接收字符,在沒有字符傳送時RxD端為高電平。8251A不斷地檢測RxD引腳,從RxD端上檢測到低電平以后,便認為是串行數據的起始位,并且啟動接收控制電路中的一個計數器來進行計數,計數器的頻率等于接收器時鐘頻率。計數器是作為接收器采樣定時,當計數到相當于半個數位的傳輸時間時再次對RxD端進行采樣,如果仍為低電平,則確認該數位是一個有效的起始位。若傳輸一個字符需要16個時鐘,那么就是要在計數8個時鐘后采樣到低電平。之后,8251A每隔一個數位的傳輸時間對RxD端采樣一次,依次確定串行數據位的值。串行數據位順序進入接收移位寄存器,通過校驗并除去停止位,變成并行數據以后通過內部數據總線送入接收緩沖器,此時發出有效狀態的RxRDY信號通知CPU,通知CPU8251A已經收到一個有效的數據。一個字符對應的數據可以是5~8位。如果一個字符對應的數據不到8位,8251A會在移位轉換成并行數據的時候,自動把他們的高位補成0。 五、系統總體設計方案根據系統設計的要求,對系統設計的總體方案進行論證分析如下:1.獲取8位開關量可使用實驗臺上的8255A可編程并行接口芯片,因為只要獲取8位數據量,只需使用基本輸入和8位數據線,所以將8255A工作在方式0,PA0-PA7接實驗臺上的8位開關量。2.當使用串口進行數據傳送時,雖然同步通信速度遠遠高于異步通信,可達500kbit/s,但由于其需要有一個時鐘來實現發送端和接收端之間的同步,硬件電路復雜,通常計算機之間的通信只采用異步通信。3.由于8251A本身沒有時鐘,需要外部提供,所以本設計中使用實驗臺上的8253芯片的計數器2來實現。4:顯示和鍵盤輸入均使用DOS功能調用來實現。設計思路框圖,如下圖所示: 六、硬件設計硬件電路主要分為8位開關量數據獲取電路,串行通信數據發送電路,串行通信數據接收電路三個部分。1.8位開關量數據獲取電路該電路主要是利用8255并行接口讀取8位乒乓開關的數據。此次設計在獲取8位開關數據量時采用8255令其工作在方式0,A口輸入8位數據,CS#接實驗臺上CS1口,對應端口為280H-283H,PA0-PA7接8個開關。2.串行通信電路串行通信電路本設計中8253主要為8251充當頻率發生器,接線如下圖所示。
上傳時間: 2013-12-19
上傳用戶:小火車啦啦啦
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
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.
上傳時間: 2014-04-02
上傳用戶:han_zh
The 87LPC76X Microcontroller combines in a small package thebenefits of a high-performance microcontroller with on-boardhardware supporting the Inter-Integrated Circuit (I2C) bus interface.The 87LPC76X can be programmed both as an I2C bus master, aslave, or both. An overview of the I2C bus and description of the bussupport hardware in the 87LPC76X microcontrollers appears inapplication note AN464, Using the 87LPC76X Microcontroller as anI2C Bus Master. That application note includes a programmingexample, demonstrating a bus-master code. Here we show anexample of programming the microcontroller as an I2C slave.The code listing demonstrates communications routines for the87LPC76X as a slave on the I2C bus. It compliments the program inAN464 which demonstrates the 87LPC76X as an I2C bus master.One may demonstrate two 87LPC76X devices communicating witheach other on the I2C bus, using the AN464 code in one, and theprogram presented here in the other. The examples presented hereand in AN464 allow the 87LPC76X to be either a master or a slave,but not both. Switching between master and slave roles in amultimaster environment is described in application note AN435.The software for a slave on the bus is relatively simple, as theprocessor plays a relatively passive role. It does not initiate bustransfers on its own, but responds to a master initiating thecommunications. This is true whether the slave receives or transmitsdata—transmission takes place only as a response to a busmaster’s request. The slave does not have to worry about arbitrationor about devices which do not acknowledge their address. As theslave is not supposed to take control of the bus, we do not demandit to resolve bus exceptions or “hangups”. If the bus becomesinactive the processor simply withdraws, not interfering with themaster (or masters) on the bus which should (hopefully) try toresolve the situation.
上傳時間: 2013-11-19
上傳用戶:shirleyYim
串行編程器源程序(Keil C語言)//FID=01:AT89C2051系列編程器//實現編程的讀,寫,擦等細節//AT89C2051的特殊處:給XTAL一個脈沖,地址計數加1;P1的引腳排列與AT89C51相反,需要用函數轉換#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()//編程前的準備工作{ SetVpp0V(); P0=0xff; P1=0xff; C2051_P3_5=1; C2051_XTAL=0; Delay_ms(20); nAddress=0x0000; SetVpp5V();} void ProOver01()//編程結束后的工作,設置合適的引腳電平{ SetVpp5V(); P0=0xff; P1=0xff; C2051_P3_5=1; C2051_XTAL=1;} BYTE GetData()//從P0口獲得數據{ 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)//轉換并設置P0口的數據{ 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);//----------------------------------------------------------------------------- //根據器件的DataSheet,設置相應的編程控制信號 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();//----------------------------------------------------------------------------- //根據器件的DataSheet,設置相應的編程控制信號 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)//寫器件{//----------------------------------------------------------------------------- //根據器件的DataSheet,設置相應的編程控制信號 //寫一個單元 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)//效驗:循環讀,直到讀出與寫入的數相同 { nTimeOut++; if(nTimeOut>1000)//超時了 { return 0; } } C2051_XTAL=1; C2051_XTAL=0;//一個脈沖指向下一個單元//----------------------------------------------------------------------------- return 1;} BYTE Read01()//讀器件{ BYTE Data;//----------------------------------------------------------------------------- //根據器件的DataSheet,設置相應的編程控制信號 //讀一個單元 C2051_P3_3=0; C2051_P3_4=0; C2051_P3_5=1; C2051_P3_7=1; Data=GetData(); C2051_XTAL=1; C2051_XTAL=0;//一個脈沖指向下一個單元//----------------------------------------------------------------------------- return Data;} void Lock01()//寫鎖定位{ InitPro01();//先設置成編程狀態//----------------------------------------------------------------------------- //根據器件的DataSheet,設置相應的編程控制信號 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()//設置pw中的函數指針,讓主程序可以調用上面的函數{ pw.fpInitPro=InitPro01; pw.fpReadSign=ReadSign01; pw.fpErase=Erase01; pw.fpWrite=Write01; pw.fpRead=Read01; pw.fpLock=Lock01; pw.fpProOver=ProOver01;}
上傳時間: 2013-11-12
上傳用戶:gut1234567
用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)); }}
上傳時間: 2013-10-30
上傳用戶:cainaifa