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