MSP430_SMBus_Users_Guide-1_10_00_00
MSP430_单片机_资料
MSP430_单片机_资料MSP430_单片机_资料Ulrt-lao wowep drsien wigthTexas nsItumertn s超功低微耗控制器超低功耗控微器制SM4P0Augus3t 0 0/1MSP430_单片机_资料ltUra-lwo pwored signe withMSP340发展历程性能Flsh aFalhs1.-836. VL CDD riev r. 1….-3.6 8V Bsica lCoc Tiker_A meNwROM/OPT.525 -VL DC DrvireFL TiLmrePor/ tBasc Tiierm8- bi tT/ C33xxCD120L Tmeri_ ASAUTR MPFY14xTiermB _DAC2 21US RT MPAYC mo_Ap4F4NewxF13Tixmr_Be DCA1 2UASTRC op_AmF42x3x2xCDL48 ADC41X1xUSART24F1x3x1xLCD921x1x1Cop_AF40xm***-*****20XX年20XX年0202Agustu0 0 /2UlMSP430_单片机_资料ratl-wop wor eedisgn itwhSM4P3:全新的0微制控R器N THE *****NH ,NT TOH EMIEL. ITs’ lFah MsS430 MPU redCuces pwoer cnsuompton driatiscally s, youo rabtteire surn lnogr.eMS430P的效极能.高/IO和PC U运是行用能同的不时钟PC 功U 的耗关通过开状寄态器存控的位实现制MSP430 的耗功极低. 行执时为601A u@ .81 V(Fasl)h 备用时为0.1u A(Fl sh)a MPS403极地延长大电了池寿命电SM4P0 有3业级工16 itb RISCM CU. -40 8-5 C M SP34 0编程方便,发开工具廉价DA MED1M,EMM ;2EMM=2*****+E2hTeMSP 304 runswith aatcwhcr staylat p tou4MH zitenrnalclck!ouAugst 00 /3MSP430_单片机_资料lUra-ltw powero dsiegnw ith*****Fxx :LASH F列特性系New灵活样多外的围模块RUNTH ***** N,O ONT HTEM IL.ET ’Is lash*****MCU red cuesp wore conumptions drsticaaly, so ylou rabtetiesrrun l ongre. 12b-t iAD /8( +4 通道, 转换1 0s) 61-ib timTe_r wAthi C3C /寄器存1-6bt iTime_B wirth 7/C C存器寄1 2 个-SURA接口T 件硬法器乘模拟号信比较器基本时模钟块- 由可程内部电阻控编频制率-由单一部电外控制阻率频-2 3kHz 振产晶生低频- 高晶振频产高生频可选择外部-时钟源超低功耗1.8V . ..3 6.V 供电电压范2围00 A@ 1MH,z 2.2V,活动模式0.7 A 备用模式0. 1A 保持R AM 据数 6 s备从模式唤醒用强大C的U 内P核16Bit R-IC S构结251n 指令s期周@ MHz8Auugs t00/4UMSP430_单片机_资料lrt-alw oopewr edign swtihSP4M0 系3列注1 - :可C由mopaatorrA_实现2 -可由Ti mr/Poert实现3 -有562 FLASBH 和oot BRM O 4 I-punt/utpuOt+ Otpuu外t模围块: TIMRSE: WT Db8tiT B1T _A T_BT- aWchtdgo 定时器- 8位定器时/计器数-Baic siTemr 1- Tmie_r A(x )捕/捉比较寄存器T-ime_r (Bx 捕)捉比/较寄存器URAT 件实软,或现用通同步异/接口步数MPY硬乘法器I/O件数字I/O ,O及tuputAgusut 00/ 5MSP430_单片机_资料Ulrt-aowlp wore dsegin witMhSP403F LSAH 列系NweFie vnew lFas hcofinurgtiaon avsilaable now!号型LASH 1 FB 4 KB 8 KB 1K6KB 32 B K8 K4 B60KBA/ DlSpeo loSe p2-b1t 12i-itb 12-bti1 2b-it12 bit-Tmire sA3A3 A 3 +B 33 A +3 A3B +B7 A + B3 A7 +3B 7SUART 1 12 2M2P Yvv v/IO 4 114 8 448 8 4484 8FALH 型S超低功耗Falsh 内核10,000 次写/0周期擦程存储器序段:51分2 信B存储息分器:128B段可以分擦段除或整擦除体编和擦程除电由压内产生部有代读出码护保*****101 *****1F211MS P34F031 M3FS*****FMSP 40F317 4SPM*****F *****F94Augst 00 u/6MSP430_单片机_资料低功耗的超现实:速起动和快电省模式其他MCUIUltarlo- powewrd esig nithw* / 4b8tiC UP* 电流耗大消* 唤醒慢Ic c /A45 400 ***-*****IvAgr300 5022 00tVc c=3 V1 se ccylcetime**********ctAvei odMe PML0*****LLPMIAvrg3 t例L:P3, M备模式用(*****C1) 3276xHz 振8荡活动器基。
MSP430G2xx3设备的SMBus库用户指南说明书
SMBus Library for MSP430G2xx3Devices User’s GuideDOCNUM-1.10.00.00Copyright©2015T exas Instruments Incorporated.1 CopyrightCopyright©2015Texas Instruments Incorporated.All rights reserved.MSP430and MSP430Ware are trademarks of Texas Instruments Instruments. ARM and Thumb are registered trademarks and Cortex is a trademark of ARM Limited.Other names and brands may be claimed as the property ofbe aware that an important notice concerning availability,standard warranty,and use in critical applications of Texas Instruments semi-conductor products and disclaimers thereto appears at the end of this document.Texas Instruments13532N.Central Expressway MS3810Dallas,TX75243/Revision InformationThis is version1.10.00.00of this document,last updated on Fri Feb13201511:59:44.Table of Contents2Table of ContentsCopyright (1)Revision Information (1)1Introduction (3)1.1Introduction (3)1.2SMBus (3)1.3The MSP430™SMBus Library Package (4)2Introduction to the MSP430™SMBus API (5)2.1Overview (5)2.2Supported Device Families (5)2.3Supported Development Environments (5)2.4Stack Organization (5)2.5Usage of MCU Peripheral Resources (6)2.6Release Notes and Migration from Previous Versions (6)3SMBus API Usage (7)3.1Introduction (7)3.2Usage (7)3.3Examples (8)IMPORTANT NOTICE (9)1Introduction1.1IntroductionThs SMBus(Sytem Management Bus)API(application programming interface)stack forMSP430™microcontrollers is a turnkey API.It includes support for applications where theMSP430™microcontroller is acting as the master or a slave.The API is designed to minimize the SMBus knowledge required to write an application:All SMBus protocol is handled automatically by the APIThe data interface presented to the application is simple to use,abstracting the applicationfrom SMBus protocolThe user should not need to modify the API source.However,for experienced developers,thesource is open and available for editing.Accessing the API’s source can also be useful for systemdebug.Application examples are included in the MSP430™SMBus Library Package.1.2SMBusThe System Management Bus(SMBus)is a lightweight two-wire interface based on the principlesof I2C,commonly used as a control bus and for power management tasks in computing,mobilecomputing and battery operated applications.A device performing data transfers on the bus canbe considered a master,which is the device which initiates a transaction and drives the clock,or aslave,which is the target of a SMBus transaction driven by the master.Both the master and theslave can act as transmitters or as receivers.SMBus2.0shares a lot of similarities with I2C,but some of the most relevant differences include:Time-out detection when a device stretches the clock for too longPacket Error Checking(PEC)can be optionally appended at the end of each transaction,allowing the bus to automatically validate packetsI2C only defines a PHY and Data-Link layers,but SMBus defines a network layer withdifferent SMBus protocols which can be used to exchange data between devicesOptional use of additional lines such as SMBAlert#and SMBSUS#.For more information about SMBus,please refer to the SMBus2.0specification:/specs/.For more information about I2C,please refer to/documents/user manual/UM10204.pdf1.2.1Supported FeaturesThe following table details the SMBus features supported in the MSP430™SMBus library.SMBus Feature MSP430FR5xx6xx MSP430G2xx3Applicable SMBus2.0 Master Slave Master Slave specification sectionClock Timeout detection1Y es Y es Y es1Y es1 3.1.1.2Manual NACK on invalid address/data N/A Y es2N/A No 4.2Arbitration Y es N/A Y es N/A 4.3.2Clock stretching Y es Y es Y es Y es 4.3.3Multiple Slave address N/A No N/A No 5.2General Call address N/A No N/A No 5.2PEC Y es Y es Y es Y es 5.4Quick Command Partial3Partial3Parial3Partial3 5.5.1Send Byte Y es Y es Y es Y es 5.5.2Receive Byte Y es Y es Y es Y es 5.5.3Write Byte/Word Y es Y es Y es Y es 5.5.4Read Byte/Word Y es Y es Y es Y es 5.5.5Process Call Y es Y es Y es Y es 5.5.6Block Write/Read Y es Y es Y es Y es 5.5.7Block write-block read process call Y es Y es Y es Y es 5.5.8Host notify protocol No No No No 5.5.9ARP No No No No 5.6SMBAlert#No No No No Appendix ASMBSUS#No No No No Appendix ANotes:1.MSP430G2xx3USCI doesn’t have integrated timeout detection and requires a timer2.MSP430FR5x/6xx can optionally-use DMA to stretch SCL while deciding to ACK/NACK thecurrent byte3.Only QuickCommand Write is supported,not QuickCommand Read1.3The MSP430™SMBus Library PackageThis User’s Guide documents the SMBus API and examples.The contents of the package isdescribed below:smbuslib:T op level directory.Contains release notes and the manifestfile related to licensing.•docs:Contains the API and User’s Guides for the supported MSP430™devices•driverlib:Contains the standard MSP430™driverlib which is used in the libraryimplementation for device families that support driverlib(for example,MSP430FR5xx6xx)•examples:Contains the example projects for each of the supported MSP430™devices•src:Contains the source code for the SMBus Library stack2Introduction to the MSP430™SMBus API 2.1OverviewThe MSP430™SMBus API stack allows easy creation of MSP430™applications thatcommunicate with other system components over a SMBus interface.This API supports using the MSP430™microcontroller as the SMBus master or as a SMBusslave.2.2Supported Device FamiliesThe SMBus API stack is supported on the following MSP430™device families:MSP430FR5xx6xxMSP430G2xx32.3Supported Development EnvironmentsThe SMBus API stack and examples build and run on both the IAR and CCS environments forMSP430™microcontrollers.See the Release Notes HTMLfile in the SMBus Library Package forspecific IAR/CCS version information.IAR and CCS are both available in free,code-size-limited versions(8K and16K,respectively,ofobject code).Applications thatfit under8K of memory can be run on both free versions.Applications that are greater than8K cannot be built using the free IAR Kickstart tool.Instead,thefree version of CCS can be used;or a licensed version of either environment.See the Release Notes within the SMBus Library Package zipfile for additional informationspecific to a given release.2.4Stack OrganizationThe software stack is organized into three layers:The public API layer defines the API’s that should be called by application programs.Thesefunctions are defined in smbus.h.The network layer manages the SMBus protocol state machine and interfaces with thephysical layer.These functions are defined in smbus nwk.h and should not be called directlyfrom application programs.The physical layer contain all the device specific code to interact with the MSP430™microcontroller.These functions are defined in smbus phy.h and should not be called directlyfrom application programs.2.5Usage of MCU Peripheral ResourcesWithin the SMBus API,the resources shown below are considered owned by the API.If theapplication accesses them,it should be aware of how the API uses them.2.6Release Notes and Migration from Previous VersionsA Release Notes HTMLfile accompanies each release of the SMBus Library Package.Referencethisfile for any information specific to this release,including:All changes from the previous versionsInstructions for migration from previous versionsUpdated IDE configuration informationKnown issues3SMBus API Usage3.1IntroductionThis chapter contains the detailed documentation for the application API functions anddescriptions on using the API to create a SMBus master or slave application.3.2UsageThis section illustrates the basic application template for master and slave applications.See theexamples for complete applications,and the HTML API documentation for details on theindividual APIs.3.2.1Master Usage Outline//Declare master SMBus structureSMBus SMB;//Initialize GPIOs and clocks...//Initialize GPIO I2C pins...//Initialize SMBus Master always at100kbps per SMBus specSMBus masterInit(&SMB,NULL,(MCLK MHZ*1000000));//Initialize I2C and enable SMBus InterruptsSMBus masterEnableInt(&SMB);//Send SMBus Sendbyte command(0x33)uint8t ret=SMBus masterSendByte(&SMB,//SMB struct0x40,//Slave Addr0x33);//SMB Command...3.2.2Slave Usage Outlinemain(){//Declare slave SMBus structureSMBus SMB;//SMBus receive and transmit buffersuint8t au8RxBuff[SMB MAX PACKET SIZE];uint8t au8TxBuff[SMB MAX PACKET SIZE];//Initialize GPIOs and clocks...//Initialize GPIO I2C pins...//Initialize SMBus SlaveSMBus slaveInit(&SMB,NULL);//Set the slave’s addressSMBus slaveSetAddress(&SMB,0x40);//Set the RX and TX buffers for SMBusSMBus slaveSetRxBuffer(&SMB,au8RxBuff,sizeof(au8RxBuff));SMBus slaveSetTxBuffer(&SMB,au8TxBuff,sizeof(au8TxBuff));//Initialize I2C and enable SMBus InterruptsSMBus slaveEnableInt(&SMB);...while(1){disable interrupt();{BIS SR(LPM3bits+GIE);//Go to sleep}enable interrupt();}//While(1)}#pragma vector=USCIAB0TX VECTOR,USCIAB0RX VECTORinterrupt void USCI ISR(void){//Check the state of SMBusswitch(SMBus slaveProcessInt(&SMB)){case SMBus State Slave QCMD://If a Quick command was detected,execute function(if any)break;case SMBus State Slave CmdComplete://Get command using SMBus slaveGetCommand(&SMB)and process command//if command is not valid/supported//SMBus slaveReportError(&SMB,SMBUS ErrorCode Cmd);LPM3EXIT;//Exit to main loop if requiredbreak;default:break;}//Clear flags to be ready for next packetSMBus processDone(&SMB);}#pragma vector=TIMER1A0VECTORinterrupt void TIMER1A0ISR(void){//Call the SMBUS function to handle a timeout error and restart the SMBUSSMBus slaveProcessTimeoutInt(&SMB);}3.3ExamplesSeveral examples are provided with the release package that illustrate using the library toimplement both SMBus master and slave application.For each example,matching master and slave implementations are provided.ReadByte Echo-sends and echoes back a ReadByte commandWriteWord Dimmer-sends and echoes back a WriteWord commandAllProtocols-sequences through all the SMBus protocolsExamples are configured for the MSP-EXP430G2and MSP-EXP430FR5969launch pad boardsand CCS and IAR projects are provided.9 IMPORTANT NOTICET exas Instruments Incorporated and its subsidiaries(TI)reserve the right to make corrections,modifications,enhancements,improvements, and other changes to its products and services at any time and to discontinue any product or service without notice.Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete.All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty.T esting and other quality control techniques are used to the extent TI deems necessary to support this warranty.Except where mandated by government requirements,testing of all parameters of each product is not necessarily performed.TI assumes no liability for applications assistance or customer product design.Customers are responsible for their products and applications using TI components.T o minimize the risks associated with customer products and applications,customers should provide adequate design and operating safeguards.TI does not warrant or represent that any license,either express or implied,is granted under any TI patent right,copyright,mask work right,or other TI intellectual property right relating to any combination,machine,or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement e of such information may require a license from a third party under the patents or other intellectual property of the third party,or a license from TI under the patents or other intellectual property of TI.Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accom-panied by all associated warranties,conditions,limitations,and notices.Reproduction of this information with alteration is an unfair and deceptive business practice.TI is not responsible or liable for such altered rmation of third parties may be subject to additional restrictions.Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice.TI is not responsible or liable for any such statements.TI products are not authorized for use in safety-critical applications(such as life support)where a failure of the TI product would reasonably be expected to cause severe personal injury or death,unless officers of the parties have executed an agreement specifically governing such use.Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal,regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications,notwithstanding any applications-related information or support that may be provided by TI.Further,Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications.TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or“enhanced plastic.”Only products designated by TI as military-grade meet military spec-ifications.Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer’s risk,and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use.TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS16949requirements.Buyers acknowledge and agree that,if they use any non-designated products in automotive applications,TI will not be responsible for any failure to meet such requirements.Following are URLs where you can obtain information on other Texas Instruments products and application solutions:ProductsAmplifiersData ConvertersDLP®ProductsDSPClocks and TimersInterfaceLogicPower Mgmt MicrocontrollersRFIDRF/IF and ZigBee®Solutions amplifi/clockswww.ti-rfi/lprfApplicationsAudioAutomotiveBroadbandDigital ControlMedicalMilitaryOptical NetworkingSecurityT elephonyVideo&ImagingWireless/audio/automotive/broadband/digitalcontrol/medical/military/opticalnetwork/security/telephony/video/wirelessMailing Address:T exas Instruments,Post Office Box655303,Dallas,T exas75265 Copyright©2015,T exas Instruments Incorporated。
MSP430时钟系统详解
2
while(1) { P1OUT = 0x40; _delay_cycles(100); P1OUT = 0; _delay_cycles(5000); } }
// 开启 LED // 关闭 LED
2、CPU 运行在晶振(32768Hz)时钟下: 时钟下: 晶体频率为 32768 赫兹,约 3 倍的 VLO。如果我们在前面的代码中使用晶振,指示灯应闪 烁大约每秒一次。 你知道为什么 32768 赫兹是一个标准?这是因为这个数字是 2 的 15 次方, 因此很容易用简单的数字计数电路,以每秒一次获得率 ——手表和其他时间时基。认识到 ACLK 来自外部晶振时钟。 #include <msp430g2231.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗定时器 P1DIR = 0x41; // P1.0 和 P1.6 配置输出 P1OUT = 0x01; // 开启 P1.0 BCSCTL3 |= LFXT1S_0; // LFXT1 = 32768Hz 晶振 while(IFG1 & OFIFG) { IFG1 &= ~OFIFG; // 清除 OSCFault 标志 _delay_cycles(100000); // 为可见的标志延时 } P1OUT = 0; // 关闭 P1 __bis_SR_register(SCG1 + SCG0); // 关闭 DCO BCSCTL2 |= SELM_3 + DIVM_3; // MCLK = 32768/8 while(1) { P1OUT = 0x40; // 开启 LED _delay_cycles(100); P1OUT = 0; / / 关闭 LED _delay_cycles(5000); } } 3、CPU 运行在晶振(32768Hz)和 DCO 时钟下: 时钟下: 最慢的频率,我们可以运行 DCO 约在 1MHz(这也是默认速度) 。因此,我们将开始切换 MCLK 到 DCO 下。在大多数系统中,你会希望 ACLK 上运行的 VLO 或 32768 赫兹晶振。 由于 ACLK 在我们目前的代码是在晶体上运行,我们会打开 DCO 计算。
MSP430寄存器的中文解释,熟知这些写起程序来很方便
#define P5DIR_ sfrb P5DIR
#define P5SEL_ sfrb P5SEL
#define P6IN_ const sfrb P6IN #define P6OUT_ sfrb P6OUT
0x0034 /* P6 输入寄存器 */ = P6IN_; 0x0035 /* P6 输出寄存器*/ = P6OUT_; 0x0036 /* P6 方向选择寄存器*/ = P6DIR_; 0x0037 /* P6 功能选择寄存器*/ = P6SEL_;
#define P4DIR_ sfrb P4DIR
#define P4SEL_ sfrb P4SEL
/************************************************************ * DIGITAL I/O Port5/6 I/O口寄存器定义PORT5和6 无中断功能
************************************************************/
#define P5IN_ const sfrb P5IN #define P5OUT_ sfrb P5OUT
0x0030 /* P5 输入寄存器 */ = P5IN_; 0x0031 /* P5 输出寄存器*/ = P5OUT_; 0x0032 /* P5 方向选择寄存器*/ = P5DIR_; 0x0033 /* P5 功能选择寄存器*/ = P5SEL_;
#define MPY_
0x0130 /* 无符号乘法 */
sfrw
MPY
= MPY_; 0x0132 /* 有符号乘法*/ = MPYS_; 0x0134 /* 无符号乘加 */ = MAC_; 0x0136 /* 有符号乘加 */ = MACS_; 0x0138 /* 第二乘数 */ = OP2_; 0x013A /* 低6位结果寄存器 */ = RESLO_; 0x013C /* 高6位结果寄存器 */ = RESHI_; 0x013E /*结果扩展寄存器 */ = SUMEXT_;
MSP430中文数据手册
MSP430混合信号微控制器数据手册产品特性●低电压范围:2.5V~5.5V●超低功耗——活动模式:330μA at 1MHz, 3V——待机模式:0.8μA——掉电模式(RAM数据保持):0.1μA●从待机模式唤醒响应时间不超过6μs●16位精简指令系统,指令周期200ns●基本时钟模块配置——多种内部电阻——单个外部电阻——32kHz晶振——高频晶体——谐振器——外部时钟源●带有三个捕获/比较寄存器的16位定时器(Timer_A)●串行在线可编程●采用保险熔丝的程序代码保护措施●该系列产品包括——MSP430C111:2K字节ROM,128字节RAM——MSP430C112:4K字节ROM,256字节RAM——MSP430P112:4K字节OTP,256字节RAM●EPROM原型——PMS430E112:4KB EPROM, 256B RAM●20引脚塑料小外形宽体(SOWB)封装,20引脚陶瓷双列直插式(CDIP)封装(仅EPROM)●如需完整的模块说明,请查阅MSP430x1xx系列用户指南(文献编号:SLAU049产品说明TI公司的MSO43O系列超低功耗微控制器由一些基本功能模块按照不同的应用目标组合而成。
在便携式测量应用中,这种优化的体系结构结合五种低功耗模式可以达到延长电池寿命的目的。
MSP430系列的CPU采用16位精简指令系统,集成有16位寄存器和常数发生器,发挥了最高的代码效率。
它采用数字控制振荡器(DCO),使得从低功耗模式到唤醒模式的转换时间小于6μs.MSP430x11x系列是一种超低功耗的混合信号微控制器,它拥有一个内置的16位计数器和14个I/0引脚。
典型应用:捕获传感器的模拟信号转换为数据,加以处理后输出或者发送到主机。
作为独立RF传感器的前端是其另一个应用领域。
DW封装(顶视图)可用选型功能模块图管脚功能简介:1.CPUMSP430的CPU采用16位RISC架构,具有高度的应用开发透明性。
MSP430教程1
MSP430教程1:MSP430 单片机系列简介1、MSP430 单片机的发展MSP430 系列是一个 16 位的、具有精简指令集的、超低功耗的混合型单片机,在 1996 年问世,由于它具有极低的功耗、丰富的片内外设和方便灵活的开发手段,已成为众多单片机系列中一颗耀眼的新星。
回忆 MSP430 系列单片机的发展过程,可以看出有这样三个阶段:开始阶段从 1996 年推出 MSP430 系列开始到 2000 年初,这个阶段首先推出有 33X 、32X 、 31X 等几个系列,而后于 2000 年初又推出了 11X 、 11X1 系列。
MSP430 的 33X 、 32X 、 31X 等系列具有 LCD 驱动模块,对提高系统的集成度较有利。
每一系列有 ROM 型( C )、 OTP 型( P )、和 EPROM 型( E )等芯片。
EPROM 型的价格昂贵,运行环境温度范围窄,主要用于样机开发。
这也表明了这几个系列的开发模式,即:用户可以用 EPROM 型开发样机;用 OTP 型进行小批量生产;而 ROM 型适应大批量生产的产品。
2000 年推出了 11X/11X1 系列。
这个系列采用 20 脚封装,内存容量、片上功能和 I/O 引脚数比较少,但是价格比较低廉。
这个时期的 MSP430 已经显露出了它的特低功耗等的一系列技术特点,但也有不尽如人意之处。
它的许多重要特性,如:片内串行通信接口、硬件乘法器、足够的 I/O 引脚等,只有33X 系列才具备。
33X 系列价格较高,比较适合于较为复杂的应用系统。
当用户设计需要更多考虑成本时, 33X 并不一定是最适合的。
而片内高精度 A/D 转换器又只有 32X 系列才有。
寻找突破,引入 Flash 技术随着 Flash 技术的迅速发展, TI 公司也将这一技术引入 M SP430 系列中。
在 2000 年 7 月推出 F13X/F14X 系列,在 2001 年 7 月到 2002 年又相继推出 F41X 、 F43X 、 F44X 这些全部是 Flash 型单片机。
MSP430单片机原理解读
第 2 章MSP430 单片机原理与 C 语言基础MSP430系列超低功耗单片机有200多种型号,TI公司用3~ 4位数字表示其型号。
其中第一位数字表示大系列,如MSP430F1xx系列、MSP430F2xx系列、MSP430F4xx系列、MSP430F5xx系列等。
在每个大系列中,又分若干子系列,单片机型号中的第二位数字表示子系列号,一般子系列越大,所包含的功能模块越多。
最后1~2 位数字表示存储容量,数字越大表示RAM 和ROM 容量越大。
430 家族中还有针对热门应用而设计的一系列专用单片机。
如SP430FW4xx 系列水表专用单片机、MSP430FG4xx 系列医疗仪器专用单片机、MSP430FE4xx 系列电能计量专用单片机等。
这些专用单片机都是在同型号的通用单片机上增加专用模块而构成的。
最新的MSP430型号列表可以通过TI公司网站下载。
在开发单片机应用系统时,第一步就是单片机的选型,选择合适的单片机型号往往就能事半功倍。
单片机选型基本方法是选择功能模块最接近项目需求的系列,然后根据程序复杂程度估算存储器和RAM 空间,并留有适当的余量,最终决定选用的单片机型号。
本章节以MSP430F249单片机为学习目标,介绍单片机的基本结构和工作原理,读者可以举一反三、触类旁通,而不必每种型号都去学习却无法深入掌握。
2.1 MSP430F249单片机基本结构与原理2.1.1MSP430F249的主要结构特点供电电压范围1.8V~3.6V 。
超低功耗:活动状态270uA(1MHz,2.2V);待机模式0.3uA;关机模式0.1uA。
16位RISC精简指令集处理器。
时钟系统:多种时钟源,可灵活使用。
时钟频率达到16MHz ;具有内部振荡器;可外接32kHz 低频晶振;外接时钟输入。
12位A/D转换器,内部参考电压,采用保持电路。
16位定时器A,3个捕获/比较寄存器。
16 位定时器B,7 个捕获/比较寄存器。
MSP430入门
MSP430入门硬件初步这只是我在学习TI公司生产的16位超的功耗单片机MSP430的随笔,希望能对其他朋友有所借鉴,不对之处还请多指教。
下面,开始430之旅。
讲解430的书现在也有很多了,不过大多数都是详细说明底层硬件结构的,看了不免有些空洞和枯燥,我认为了解一个MCU的操作首先要对其基础特性有所了解,然后再仔细研究各模块的功能。
1.首先你要知道msp430的存储器结构。
典型微处理器的结构有两种:冯。
诺依曼结构——程序存储器和数据存储器统一编码;哈佛结构——程序存储器和数据存储器;msp430系列单片机属于前者,而常用的mcs51系列属于后者。
0-0xf特殊功能寄存器;0x10-0x1ff外围模块寄存器;0x200-?根据不同型号地址从低向高扩展;0x1000-0x107f seg_b0x1080_0x10ff seg_a 供flash信息存储剩下的从0xffff开始向下扩展,根据不同容量,例如149为60KB,0xffff-0x11002.复位信号是MCU工作的起点,430的复位信号有两种:上电复位信号POR和上电清除信号PUC。
POR 信号只在上电和RST/NMI复位管脚被设置为复位功能,且低电平时系统复位。
而PUC信号是POR信号产生,以及其他如看门狗定时溢出、安全键值出现错误是产生。
但是,无论那种信号触发的复位,都会使msp430在地址0xffff处读取复位中断向量,然后程序从中断向量所指的地址开始执行。
复位后的状态不写了,详见参考书,嘿嘿。
3.系统时钟是一个程序运行的指挥官,时序和中断也是整个程序的核心和中轴线。
430最多有三个振荡器,DCO内部振荡器;LFXT1外接低频振荡器,常见的32768HZ,不用外接负载电容;也可接高频450KHZ -8M,需接负载电容;XT2接高频450KHZ-8M,加外接电容。
(经验中发现,接XT2时,需要注意自己开启XT2,并延时50us等待XT2起振,然后手工清除IFG1中的OFIFG位,其操作顺序为:打开XT2->等待XT2稳定->切换系统时钟为XT2)430有三种时钟信号:MCLK系统主时钟,可分频1 2 4 8,供cpu使用,其他外围模块在有选择情况下也可使用;SMCLK系统子时钟,供外围模块使用,可选则不同振荡器产生的时钟信号;ACLK辅助时钟,只能由LFXT1产生,供外围模块。
MSP430相关说明文档
1.关于目标板供电,这个问题反映回来最多。
如果用仿真器供电,那么VCCI脚一定要接地。
VCCI是仿真器检测目标板电源的。
如果跟VCCO 接在一起,很可能导致仿真器不输出电压,导致IAR报错,找不到芯片。
如果用外部电源供电,那么VCCI一定要接到目标板电源(一般是3.3V),VCCO悬空,一定不要跟目标板电源相连,否则,有时可能会导致仿真器输出,两个电源短路,出现意想不到的情况;2. 系统中显示USB设备有问题:这个问题有可能是USB没有安装好,有时也可能系统问题。
如果驱动装好了。
电脑重启一下可能就好了。
如果还不行。
换台电脑再试一下。
3. 有时430单片机可能在死机状态,导致仿真器通过JTAG查询时,没有响应,导致IAR不能下载。
这时,拔掉JTAG 14pin插座,断开目标板电源,过至少1min时间,最好用镊子把目标板电源放电完,再插上JTAG插座,进行仿真。
4. 判断仿真器是否正常的一个简单的办法是:a) 硬件管理器中USB 设备工作正常(显示为msp430uif COMx口)。
b), 插入USB后,电脑有识别到新硬件的声音指示(开外放)代表仿真器自检通过。
那么仿真器一般不会有问题了。
重点在目标板上找原因,一般是不会有问题的。
5. 安装MSP430的LSD-FET430UIF USB仿真器驱动时出错。
"INF 找不到所需的段落" 的解决方法:首先这是您操作系统的问题a.打开“控制面板–管理工具–服务”,查看“smart card是否启用”,没有的话,请手动启动。
如果“smart card”服务也无法启用,可检查“scardsvr”服务是否存在,且已经启动,如果没有启动请手动启动,然后设为“自动”。
b.如果该服务不存在,则按以下步骤操作,单击“开始–运行”输入cmd 打开命令提示符窗口,先执行命令“scardsvr reinstall”,接着在执行命令“regsvr32 scardssp.dll”重新注册scardssp.dll。
MSP430指导书
目录目录 (I)实验一I/O端口控制实验 (1)实验二乘法器实验 (2)实验三PWM脉冲实验 (3)实验四LED数码显示实验 (4)实验五LCD段码屏显示实验 (6)实验六定时器实验 (8)实验七比较器实验 (10)实验八内部看门狗实验 (13)实验九电子时钟实验 (15)实验十独立键盘实验 (16)实验十一阵列键盘实验 (17)实验十二时钟模块FLL+操作实验 (18)实验十三 12位AD转换实验 (19)实验十四外部FLASH扩展实验 (20)实验十五I2C AT24C02实验 (22)实验十六 128×64点阵液晶显示实验(选配) (24)实验十七 RS-232通信实验 (25)IMSP430核心板的供电方式MSP430核心板有2种供电方式:1.由USB取提供,同时J0短路冒打在右边,J1短路冒打在左边,J6短路冒打在上方。
2.由外部5V的直流电源提供,把内正外负的5V电源插入JT9座,同时J0短路冒打在左边,J1短路冒打在右边,J6短路冒打在上方。
(注:5V电源用户选配)3.出厂程序为电子时钟程序,上电后自动运行电子时钟,数码管和段码LCD同时显示!II实验一 I/O端口控制实验一、实验目的1.掌握MSP430449一般IO口的应用2.掌握端口寄存器的组成和使用二、实验说明MSP430F1XX系列单片机最多有6个I/O口:P1~P6,每个端口有8个管脚。
每个管脚可以单独设置成输入或者输出方向,并且每个管脚都可以进行单独的读或者写。
P1口和P2口具有中断功能,P1口和P2口的每个管脚都可以单独设置成中断,并且可以设置成上升沿或者下降沿触发中断。
P1口的所有管脚共用一个中断向量,同样P2口的所有管脚也共用一个中断向量。
MSP430F1XX系列单片机的I/O口主要有以下特征:每个I/O口可以独立编程设置。
输入输出可以任意结合使用。
P1口和P2口的中断功能可以单独设置。
有独立的输入输出寄存器。
MSP430交通灯电路设计
目录1 引言 (1)2 系统方案 (2)2.1 设计任务 (2)2.1.1 方案介绍 (2)3 交通灯硬件系统设计 (4)3.1单片机介绍 (4)3.1.1单片机的概念与特点 (4)3.1.2单片机的应用 (4)3.1.3 单片机的发展趋势 (4)3.1.4主流单片机 (5)3.1.5 MSP430系列单片机 (6)3.2交通灯设计的其他外设......................................................................... ............ (12)3.2.1显示译码器......................................................................... (12)3.2.2 数码管的使用......................................................................... (14)3.2.3LED灯的选择......................................................................... . (15)4 交通灯系统的软件......................................................................... . (15)4.1 程序设计......................................................................... . (15)4.2交通灯主程序......................................................................... (20)5 CCS使用介绍......................................................................... .. (24)结论......................................................................... .. (29)致谢......................................................................... .. (30)参考文献......................................................................... (31)基于MSP430单片机的交通灯电路设计房鹏飞摘要:近年来随着科技的飞速发展,一个以微电子技术、计算机技术和通信技术为先导的信息革命正在蓬勃发展。
MSP430 入门及常见问题解答
MSP430 入门及常见问题解答MSP430 入门及常见问题解答Ver 0.1 - Jeffrey1.MSP430 入门 2. 如何为我的应用选择最合适的 MSP430 芯片? 3.与 MSP430 的引导加载程序通信的开发工具 4.MSP430 需配合何种晶振工作? 5. 使用哪款 MSP430 编程器可以用来烧断 JTAG 熔丝? 6.要实现 MSP430 编程,应如何连接 JTAG? 7.是否有关于 MSP430 的讨论小组或论坛? 8.使用 FET 时需要哪几根 MSP430 JTAG 信号 线? 9.MSP430 的 I/O 口的灌出和吸入电流能力 10.MSP430 仿真器(FET)的常见问题 11.通过启动加载程序(Bootstrap Loader,以下简 称 BSL)为 MSP430 编程 12.MSP430 I2C 模块的速度 13.MSP430 的 USART 的硬件配置 14.MSP430 Flash 数据保持率 15.MSP430 SPI 或 UART 的速度 16.MSP430 Flash 的写入/擦除周期数 17.MSP430 ADC12 模块的通道数 18.MSP430 哪些端口的引脚具有中断能力? 19.MSP430 的全部操作码(记忆规则)列表 20.怎样降低 MSP430 的功耗? 21.MSP430 开发工具支持哪些操作系统? 22.MSP430 DCO 的频率会抖动吗? 23.MSP430 的 Flash 块写(BLKWRT)模式的使 用 24.MSP430 外部中断输入所需的最小脉冲宽度 25.MSP430 的嵌套中断 26.MSP430 端口中断类型 27.除 32.768kHz 晶振,MSP430 还可以配合多 高频率的晶振工作? 28.MSP430 的静电效应值 29.批量生产时对 Flash 编程的方法。
30.MSP430 在上电清除(PUC)和上电复位 ( POR)时初始状态是什么? 31.MSP430 的操作和储存温度范围 32.MSP430 数据存储器的扩展 33.MSP430 的指令周期和长度 34.MSP430 的静电保护二极管 35.在哪能够找到一个 BSDL 文件来建立 JTAG 链 36. IAR Embedded Workbench 提示的错误信息: “unable to open file `cl430`” 37. USART 模块同时工作在 UART 和 SPI 模 使 式 38.系统内部 Flash 的编程及作为 EEPROM 的 使用 39.多个外部中断同时发生的处理 40.FET 支持的芯片封装类型 41.MSP430F11x1 和 MSP430F11x1A 的区别 42.使用两个管脚进行 Flash 升级 43.MSP430x4xx 低功耗晶振的配置 44. 哪一款编程器可以将用户的程序下载到 Flash 中? 45.使用 MSP430 串口编程工具 MSP-PRGS430 的问题 46.在 MSP430 BSL 通信中 80h 的使用 47.MSP430 ADC12 模块的信息源 48.使用 MSP430 Basic Clock 模块中稳定 DCO 频率 49.MSP430 的 I/O 引脚和 JTAG 引脚的复用 50.MSP430 ADC12 的速度 51.MSP430 ADC12 的基准电压引脚的连接 52.MSP430 ADC12 模块的外部电容需求 53.在哪里可以买到 MSP430 的插座 54.MSP430 工作在 8MHz 时推荐的工作电压 55.查找应用报告中的参考文件1.MSP430 的入门 . 要获取关于 MSP430 产品系列的完整信息, 请参看 MSP430 的主页 在 MSP430 主页中,有相关的链接:所有的文档、应用报告、可下载的源代码示例、开 发人员信息。
MSP430寄存器配置指导
微控网为你准备的 MSP430F 单片机入门必修课
微控网
MSP430F1XX 系列时钟模块图 时基模块结构如上图:
MSP430 系列单片机基础时钟主要是由低频晶体振荡器,高频晶体振荡器,数字控制 振荡器(DCO),锁频环(FLL)及 FLL+等模块构成。由于 430 系列单片机中的型号不同, 而时钟模块也将有所不同。虽然不同型号的单片机的时基模块有所不同,但这些模块产 生出来的结果是相同的.在 MSP430F13、14 中是有 TX2 振荡器的,而 MSP430F11X,F11X1 中是用 LFXT1CLK 来代替 XT2CLK 时钟信号的.在时钟模块中有 3 个(对于 F13,F14)时钟 信号源(或 2 个时钟信号源,对于 F11X、F11X1):
BCSCTL1 基本时钟系统控制寄存器 1
7
6
5
4
XT2OFF TXS DIVA.1 DIVA.0
3 XT5V
2
1
0
Rsel.2 Resl.1 Resl.0
XT2OFF 控制 XT2 振荡器的开启与关闭。 TX2OFF=0,XT2 振荡器开启。 TX2OFF=1,TX2 振荡器关闭(默认为 TX2 关闭)
微控网
句:_BIS_SR(LMP3_bits)和_BIC_SR(LPM3 bits) LPM3 和 LPM3_EXIT
它们的定义是一样的。这里说明在 C 语言环境中有些定义的函数是不可见的。但你可以 从 in430.h 文件看到它们的定义。
DCOCTL DCO 控制寄存器
cctlx捕获比较控制寄存器151413121110ccis1scssccicapoutmodxcciexccioutcovccifxtimera有多个捕获比较模块每个模块都有自己的控制寄存器cctlxcaptmod10选择捕获模式00禁止捕获模式01上升沿捕获10下降沿捕获11上升沿与下降沿都捕获ccisi0在捕获模式中用来定提供捕获事件的输入端00选择ccixa01选择ccixb10选择gnd11选择vccscs选择捕获信号与定时器时钟同步异步关系0异步捕获1同步捕获异步捕获模式允许在请求时立即将ccifg置位和捕获定时器值适用于捕获信号的周期远大于定时器时钟周期的情况
[计算机软件及应用]15MSP430中文用户指南
T EXAS I NSTRUMENTSMSP430系列混合信号微控制器结构及模块用户指南目录1MSP430系列1.1特性与功能1.2系统关键性能1.3MSP430系列的各型号2结构概述2.1CPU2.2代码存储器2.3数据存储器(RAM)2.4运行控制2.5外围模块2.6振荡器、倍频器和时钟发生器3系统复位、中断和运行模式3.1系统复位和初始化3.2中断系统结构3.3中断处理3.3.1SFR中的中断控制位3.3.2外部中断3.4运行模式3.5低功耗模式3.5.1 低功耗模式0与模式1,LPM0和LPM1 3.5.2 低功耗模式2与模式3,LPM2和LPM3 3.5.3 低功耗模式4,LPM43.6 低功耗应用要点4 存储器组织4.1 存储器中的数据4.2 片内ROM组织4.2.1 ROM表的处理4.2.2 计算分支跳转和子程序调用4.3 RAM与外围模块组织4.3.1 RAM4.3.2 外围模块—地址定位4.3.3 外围模块--SFR5 16位CPU5.1 CPU寄存器5.1.1 程序计数器PC5.1.2 系统堆栈指针SP5.1.3 状态寄存器SR5.1.4 常数发生寄存器CG1与CG25.2 寻址模式5.2.1 寄存器模式5.2.2 变址模式5.2.3 符号模式5.2.4 绝对模式5.2.5 间接模式5.2.6 间接增量模式5.2.7 立即模式5.2.8 指令的时钟周期与长度5.3 指令组概述5.3.1 双操作数指令5.3.2 单操作数指令5.3.3 条件跳转5.3.4 模拟指令的短格式5.3.5 其它指令5.4 指令分布6 硬件乘法器6.1 硬件乘法器的操作6.2 硬件乘法器的寄存器6.3 硬件乘法器的SFR位6.4 硬件乘法器的软件限制6.4.1 硬件乘法器软件限制--寻址模式 6.4.2 硬件乘法器软件限制--中断程序7 振荡器与系统时钟发生器7.1 晶体振荡器7.2 处理机时钟发生器7.3 系统时钟运行模式7.4 系统时钟控制寄存器7.4.1 模块寄存器7.4.2 与系统时钟发生器相关的SFR位 7.5 DCO典型特性8 数字I/O配置8.1 通用端口P08.1.1 P0控制寄存器8.1.2 P0原理图8.1.3 P0中断控制功能8.2 通用端口P1、P28.2.1 P1、P2控制寄存器8.2.2 P1、P2原理图8.2.3 P1、P2中断控制功能8.3 通用端口P3、P48.3.1 P3、P4控制寄存器8.3.2 P3、P4原理图8.4 LCD端口8.5 LCD端口--定时器/端口比较器9 通用定时器/端口模块9.1 定时器/端口模块操作9.1.1 定时器/端口计数器TPCNT1,8位操作 9.1.2 定时器/端口计数器TPCNT2,8位操作 9.1.3 定时器/端口计数器,16位操作9.2 定时器/端口寄存器9.3 定时器/端口SFR位9.4 定时器/端口在A/D中的应用9.4.1 R/D转换原理9.4.2 分辨率高于8位的转换10 定时器10.1 Basic Timer110.1.1 BasicTimer1寄存器10.1.2 SFR位10.1.3 BasicTimer1操作10.1.4 BasicTimer1操作:LCD时钟信号f LCD 10.2 8位间隔(Interval)定时器/计数器 10.2.1 8位定时器/计数器的操作10.2.2 8位定时器/计数器的寄存器10.2.3 与8位定时器/计数器有关的SFR 10.2.4 8位定时器/计数器在UART中的应用 10.3 看门狗定时器10.3.1 看门狗定时器寄存器10.3.2 看门狗定时器中断控制功能10.3.3 看门狗定时器操作10.4 8位PWM定时器10.4.1 操作10.4.2 PWM寄存器11 Timer_A11.1 Timer_A的操作11.1.1 定时器操作11.1.2 捕获模式11.1.3 比较器模式11.1.4 输出单元11.2 Timer_A的寄存器11.2.1 Timer_A控制寄存器TACTL11.2.2 捕获/比较控制寄存器CCTL11.2.3 Timer_A中断向量寄存器11.3 Timer_A的应用11.3.1 Timer_A增计数模式应用11.3.2 Timer_A连续模式应用11.3.3 Timer_A增/减计数模式应用11.3.4 Timer_A软件捕获应用11.3.5 Timer_A处理异步串行通信协议 11.4 Timer_A的特殊情况11.4.1 CCR0用作周期寄存器11.4.2 定时器寄存器的启/停11.4.3 输出单元Unit012 USART外围接口,UART模式12.1 异步操作12.1.1 异步帧格式12.1.2 异步通信的波特率发生器12.1.3 异步通信格式12.1.4 线路空闲多处理机模式12.1.5 地址位格式12.2 中断与控制功能12.2.1 USART接收允许12.2.2 USART发送允许12.2.3 USART接收中断操作12.2.4 USART发送中断操作12.3 控制与状态寄存器12.3.1 USART控制寄存器UCTL12.3.2 发送控制寄存器UTCTL12.3.3 接收控制寄存器URCTL12.3.4 波特率选择和调制控制寄存器12.3.5 USART接收数据缓存URXBUF12.3.6 USART发送数据缓存UTXBUF12.4 UART模式,低功耗模式应用特性 12.4.1 由UART帧启动接收操作12.4.2 UART模式波特率与时钟频率12.4.3 节约MSP430资源的多处理机模式 12.5 波特率的计算13 USART外围接口,SPI模式13.1 USART的同步操作13.1.1 SPI模式中的主模式,MM=1、SYNC=1 13.1.2 SPI模式中的从模式,MM=0、SYNC=1 13.2 中断与控制功能13.2.1 USART接收允许13.2.2 USART发送允许13.2.3 USART接收中断操作13.2.4 USART发送中断操作13.3 控制与状态寄存器13.3.1 USART控制寄存器13.3.2 发送控制寄存器UTCTL13.3.3 接收控制寄存器URCTL13.3.4 波特率选择和调制控制寄存器 13.3.5 USART接收数据缓存URXBUF 13.3.6 USART发送数据缓存UTXBUF14 液晶显示驱动14.1 LCD驱动基本原理14.2 LCD控制器/驱动器14.2.1 LCD控制器/驱动器功能14.2.2 LCD控制及模式寄存器14.2.3 LCD显示存储器14.2.4 LCD操作软件例程14.3 LCD端口功能14.4 LCD与端口模式混合应用实例15 A/D转换器15.1 概述15.2 A/D转换操作15.2.1 A/D转换15.2.2 A/D中断15.2.3 A/D量程15.2.4 A/D电流源15.2.5 A/D输入端与多路切换15.2.6 A/D接地与降噪15.2.7 A/D输入与输出引脚15.3 A/D控制寄存器16 其它模块16.1 晶体振荡器16.2 上电电路16.3 晶振缓冲输出附录A 外围模块分布附录B 指令组说明附录C EPROM编程本书用途及表述约定MSP430用户指南以方便工程师及程序员使用的方式提供软件和硬件资料,以帮助开发应用MSP430系列的产品。
msp430学习经验总结
msp430学习经验总结最近学习MSP430,把自己的一些经验分享下,这是我在网上发现的一篇很不错的文章,归纳得很好,简洁明了。
1.MSP430开发环境建立1.安装IAR dor msp430 软件,软件带USB仿真器的驱动。
2.插入USB仿真器,驱动选择安装目录的/drivers/TIUSBFET3.建立一个工程,选择"option"选项,设置a、选择器件,在"General"项的"Target"标签选择目标器件b、选择输出仿真,在"Linker"项里的"Output"标签,选择输出"Debug information for C-SPY",以输出调试信息用于仿真。
c、若选择"Other",Output下拉框选择"zax-m"即可以输出hex 文件用以烧录,注意,此时仿真不了。
d、选择"Debugger"项的"Setup"标签,"Driver"下拉框选择"FET Debugger"e、选择"FET Debugger"项的"Setup"标签,"Connection"下拉框选择"Texas Instrument USB-I"4.仿真器的接口,从左到右分别为 " GND,RST,TEST,VCC"2.IO口数字输入/输出端口有下列特性:□每个输入/输出位都可以独立编程。
□允许任意组合输入、输出。
□ P1 和 P2 所有 8 个位都可以分别设置为中断。
□可以独立操作输入和输出数据寄存器。
□可以分别设置上拉或下拉电阻。
在介绍这四个I/O口时提到了一个“上拉电阻”那么上拉电阻又是一个什么东东呢?他起什么作用呢?都说了是电阻那当然就是一个电阻啦,当作为输入时,上拉电阻将其电位拉高,若输入为低电平则可提供电流源;所以如果P0口如果作为输入时,处在高阻抗状态,只有外接一个上拉电阻才能有效。
MSP430单片机数据手册—英
IMPORTANT NOTICETexas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements, and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. T esting and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where mandated by government requirements, testing of all parameters of each product is not necessarily performed.TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and applications using TI components. T o minimize the risks associated with customer products and applications, customers should provide adequate design and operating safeguards.TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI.Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for such altered documentation.Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such statements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions:Products ApplicationsAmplifiers Audio /audioData Converters Automotive /automotiveDSP Broadband /broadbandInterface Digital Control /digitalcontrolLogic Military /militaryPower Mgmt Optical Networking /opticalnetwork Microcontrollers Security /securityTelephony /telephonyVideo & Imaging /videoWireless /wirelessMailing Address:Texas InstrumentsPost Office Box 655303 Dallas, Texas 75265Copyright 2004, Texas Instruments Incorporated。
2013版MSP430实验指导书
实验一IO使用一.基础知识I/O相关寄存器功能如下符号功能使用方法PxDIR输入/输出方向寄存器0:输入;1:输出PxIN输入寄存器读PxIN值PxOUT输出寄存器0:输出低;1:输出高PxIFG中断标志寄存器0:无中断请求;1:有PxIES中断触发沿选择寄存器0:上升沿;1:下降沿PxIE中断使能寄存器0:禁止中断;1:允许PxSEL功能选择寄存器0:IO;1:第二功能PxREN上拉/下拉电阻使能寄存器0:禁止;1:使能二.例程//硬件连接:P1.0~P1.7连接至扩展板LED接口D0~D7,P2.0连接至扩展板按键接口S0. //功能:每次按按键改变LED状态,即由亮到灭或者由灭到亮#include"msp430.h"//包含头文件void delay(unsigned int i)//延时子函数{unsigned int j,k;for(j=0;j<i;j++)for(k=0;k<200;k++);}int main(void){WDTCTL=WDTPW+WDTHOLD;//关看门狗P1DIR=0xff;//P1.0~P1.7都作为输出口P1OUT=0x00;//P1.0~P1.7输出低电平P2DIR&=0xfe;//P2.0作为输入口P2REN|=0x01;//使能P2.0的上/下拉电阻P2OUT|=0x01;//设置P2.0口上拉电阻while(1){if((P2IN&0x01)==0)//按键是否按下{delay(80);//延时消抖if((P2IN&0x01)==0)//按键确实按下{P1OUT=~P1OUT;//LED改变状态}}}}三.作业(1)硬件连接:P1.0~P1.7连接至扩展板LED接口D0~D7功能:流水灯,从LED0到LED7依次点亮,如此循环。
(每次只有一颗LED亮)(2)硬件连接:P1.0~P1.7连接至扩展板LED接口D0~D7,P2.0连接至扩展板S0,P2.1连接至扩展板S1。
msp430非常详细有用的讲解和例程
7
6
5
DCO.2 DCO.1 DCO.0
4 MOD.4
3 MOD.3
2 MOD.2
1 MOD.1
0 MOD.0
DCO.0-DCO.4 定义 8 种频率之一,可以分段调节 DCOCLK 频率,相邻两种频率相差 10%。而频率由注入直流发生器的电流定义。
MOD.0-MOD.4 定义在 32 个 DCO 周期中插入的 Fdco+1 周期个数,而在下的 DCO 周期 中为 Fdco 周期,控制改换 DCO 和 DCO+1 选择的两种频率。如果 DCO 常数为 7,表示 已经选择最高频率,此时不能利用 MOD.0-MOD.4 进行频率调整。
低功耗设置的技巧问题: 1、LPM4:在振荡器关闭模式期间,处理机的所有部件工作停止,此时电流消
耗最小。此时只有在系统上电电路检测到低点电平或任一请求异步响应中断的外部中断 事件时才会从新工作。因此在设计上应含有可能需要用到的外部中断才采用这种模式。 否则发生不可预料的结果。
2、LPM3:在 DC 发生器关闭期间,只有晶振是活动的。但此时设置的基本时序条 件的 DC 发生器的 DC 电流被关闭。由于此电路的高阻设计,使功耗被抑制。注:当从 DC 关闭到启动 DC0 要花一端时间 (ns-us)
微控网供应 MSP430 单片机系列开发工具,欢迎订购。 模块列表 1- 复位模块 2- 时钟模块 3- IO 端口模块 4- WDT 看门狗模块 5- Timer A 定时器模块 6- 比较器 A 模块 7- ADC12 数模转换模块 8- USART 串行异步通讯模块 9- CPU 模块及全局资料 10-MSP430 其它应用介绍
3-SMCLK: 子 系 统 时 钟 , SMCLK 是 由 2 个 时 钟 源 信 号 所 提 供 . 他 们 分 别 是 XT2CLK(F13、F14)和 DCO,如果是 F11、F11X1 则由 LFXT1CLK 代替 TX2CLK。同样 可设置相关寄存器来决定分频因子及相关的设置。
msp430各功能模块的介绍
各个时钟信号源介绍如下:1、LFXT1CLK:低频/高频时钟源。
可以外接32768Hz的时钟芯片或频率为450KHz~8MHz的标准警惕或共振器。
2、XT2CLK:高频时钟源。
需要外接两个震荡电容器。
可以外接32768Hz的时钟芯片或频率为450KHz~8MHz的标准警惕或共振器和外部时钟输入。
较常用的晶体是8MHz的。
3、DCOCLK:内部数字可控制的RC振荡器。
MSP430单片机时钟模块提供3个时钟信号以供给片内各部分电路使用,这3个时钟信号分别是:(1)ACLK:辅助时钟信号。
ACLK是从LFXT1CLK信号由1/2/4/8分频器分频后得到的。
由BCSCTL1寄存器设置DIV A相应位来决定分频因子。
ACLK可提供给CPU外围功能模块做时钟信号使用。
(2)MCLK:主时钟信号。
MCLK是由3个时钟源所提供的。
它们分别是:LFXT1CLK、XT2CLK、和DCO时钟源信号。
MCLK主要用于MCU和相关模块做时钟。
同样可设置相关寄存器来决定分频因子及相关设置。
(3)SMCLK:子系统时钟。
SMCLK由2个时钟源信号提供,他们分别是XT2CLK 和DCO。
如果是F11或F11X1系列单片机,则由LFXT1CLK代替XT2CLK。
同样可设置相关寄存器来决定分频因子及相关的设置。
低频振荡器LFXT1:LFXT1支持超低功耗,它在低频模式下使用一个32768Hz的晶体。
不需要任何电容因为在低频模式下内部集成了电容。
低频振荡器也支持高频模式和高速晶体,但连接时每端必须加电容。
电容的大小根据所接晶体频率的高低来选择。
低频振荡器在低频和高频模式下都可以选择从XIN引脚接入一个外部输入时钟信号,但所接频率必须根据所设定的工作模式来选择,并且OSCOFF位必须复位。
高频振荡器LFXT2:LFXT2作为MSP430的第二晶体振荡器。
与低频相比,其功耗更大。
高频晶体真大气外接在XIN2和XOUT2两个引脚,并且必须外接电容。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
SMBus Library for MSP430FR5xx6xx Devices User’s GuideDOCNUM-1.10.00.00Copyright©2015T exas Instruments Incorporated.1 CopyrightCopyright©2015Texas Instruments Incorporated.All rights reserved.MSP430and MSP430Ware are trademarks of Texas Instruments Instruments. ARM and Thumb are registered trademarks and Cortex is a trademark of ARM Limited.Other names and brands may be claimed as the property ofbe aware that an important notice concerning availability,standard warranty,and use in critical applications of Texas Instruments semi-conductor products and disclaimers thereto appears at the end of this document.Texas Instruments13532N.Central Expressway MS3810Dallas,TX75243/Revision InformationThis is version1.10.00.00of this document,last updated on Fri Feb13201511:59:30.Table of Contents2Table of ContentsCopyright (1)Revision Information (1)1Introduction (3)1.1Introduction (3)1.2SMBus (3)1.3The MSP430™SMBus Library Package (4)2Introduction to the MSP430™SMBus API (5)2.1Overview (5)2.2Supported Device Families (5)2.3Supported Development Environments (5)2.4Stack Organization (5)2.5Usage of MCU Peripheral Resources (6)2.6Release Notes and Migration from Previous Versions (6)3SMBus API Usage (7)3.1Introduction (7)3.2Usage (7)3.3Examples (8)IMPORTANT NOTICE (9)1Introduction1.1IntroductionThs SMBus(Sytem Management Bus)API(application programming interface)stack forMSP430™microcontrollers is a turnkey API.It includes support for applications where theMSP430™microcontroller is acting as the master or a slave.The API is designed to minimize the SMBus knowledge required to write an application:All SMBus protocol is handled automatically by the APIThe data interface presented to the application is simple to use,abstracting the applicationfrom SMBus protocolThe user should not need to modify the API source.However,for experienced developers,thesource is open and available for editing.Accessing the API’s source can also be useful for systemdebug.Application examples are included in the MSP430™SMBus Library Package.1.2SMBusThe System Management Bus(SMBus)is a lightweight two-wire interface based on the principlesof I2C,commonly used as a control bus and for power management tasks in computing,mobilecomputing and battery operated applications.A device performing data transfers on the bus canbe considered a master,which is the device which initiates a transaction and drives the clock,or aslave,which is the target of a SMBus transaction driven by the master.Both the master and theslave can act as transmitters or as receivers.SMBus2.0shares a lot of similarities with I2C,but some of the most relevant differences include:Time-out detection when a device stretches the clock for too longPacket Error Checking(PEC)can be optionally appended at the end of each transaction,allowing the bus to automatically validate packetsI2C only defines a PHY and Data-Link layers,but SMBus defines a network layer withdifferent SMBus protocols which can be used to exchange data between devicesOptional use of additional lines such as SMBAlert#and SMBSUS#.For more information about SMBus,please refer to the SMBus2.0specification:/specs/.For more information about I2C,please refer to/documents/user manual/UM10204.pdf1.2.1Supported FeaturesThe following table details the SMBus features supported in the MSP430™SMBus library.SMBus Feature MSP430FR5xx6xx MSP430G2xx3Applicable SMBus2.0 Master Slave Master Slave specification sectionClock Timeout detection1Y es Y es Y es1Y es1 3.1.1.2Manual NACK on invalid address/data N/A Y es2N/A No 4.2Arbitration Y es N/A Y es N/A 4.3.2Clock stretching Y es Y es Y es Y es 4.3.3Multiple Slave address N/A No N/A No 5.2General Call address N/A No N/A No 5.2PEC Y es Y es Y es Y es 5.4Quick Command Partial3Partial3Parial3Partial3 5.5.1Send Byte Y es Y es Y es Y es 5.5.2Receive Byte Y es Y es Y es Y es 5.5.3Write Byte/Word Y es Y es Y es Y es 5.5.4Read Byte/Word Y es Y es Y es Y es 5.5.5Process Call Y es Y es Y es Y es 5.5.6Block Write/Read Y es Y es Y es Y es 5.5.7Block write-block read process call Y es Y es Y es Y es 5.5.8Host notify protocol No No No No 5.5.9ARP No No No No 5.6SMBAlert#No No No No Appendix ASMBSUS#No No No No Appendix ANotes:1.MSP430G2xx3USCI doesn’t have integrated timeout detection and requires a timer2.MSP430FR5x/6xx can optionally-use DMA to stretch SCL while deciding to ACK/NACK thecurrent byte3.Only QuickCommand Write is supported,not QuickCommand Read1.3The MSP430™SMBus Library PackageThis User’s Guide documents the SMBus API and examples.The contents of the package isdescribed below:smbuslib:T op level directory.Contains release notes and the manifestfile related to licensing.•docs:Contains the API and User’s Guides for the supported MSP430™devices•driverlib:Contains the standard MSP430™driverlib which is used in the libraryimplementation for device families that support driverlib(for example,MSP430FR5xx6xx)•examples:Contains the example projects for each of the supported MSP430™devices•src:Contains the source code for the SMBus Library stack2Introduction to the MSP430™SMBus API 2.1OverviewThe MSP430™SMBus API stack allows easy creation of MSP430™applications thatcommunicate with other system components over a SMBus interface.This API supports using the MSP430™microcontroller as the SMBus master or as a SMBusslave.2.2Supported Device FamiliesThe SMBus API stack is supported on the following MSP430™device families:MSP430FR5xx6xxMSP430G2xx32.3Supported Development EnvironmentsThe SMBus API stack and examples build and run on both the IAR and CCS environments forMSP430™microcontrollers.See the Release Notes HTMLfile in the SMBus Library Package forspecific IAR/CCS version information.IAR and CCS are both available in free,code-size-limited versions(8K and16K,respectively,ofobject code).Applications thatfit under8K of memory can be run on both free versions.Applications that are greater than8K cannot be built using the free IAR Kickstart tool.Instead,thefree version of CCS can be used;or a licensed version of either environment.See the Release Notes within the SMBus Library Package zipfile for additional informationspecific to a given release.2.4Stack OrganizationThe software stack is organized into three layers:The public API layer defines the API’s that should be called by application programs.Thesefunctions are defined in smbus.h.The network layer manages the SMBus protocol state machine and interfaces with thephysical layer.These functions are defined in smbus nwk.h and should not be called directlyfrom application programs.The physical layer contain all the device specific code to interact with the MSP430™microcontroller.These functions are defined in smbus phy.h and should not be called directlyfrom application programs.2.5Usage of MCU Peripheral ResourcesWithin the SMBus API,the resources shown below are considered owned by the API.If theapplication accesses them,it should be aware of how the API uses them.2.6Release Notes and Migration from Previous VersionsA Release Notes HTMLfile accompanies each release of the SMBus Library Package.Referencethisfile for any information specific to this release,including:All changes from the previous versionsInstructions for migration from previous versionsUpdated IDE configuration informationKnown issues3SMBus API Usage3.1IntroductionThis chapter contains the detailed documentation for the application API functions anddescriptions on using the API to create a SMBus master or slave application.3.2UsageThis section illustrates the basic application template for master and slave applications.See theexamples for complete applications,and the HTML API documentation for details on theindividual APIs.3.2.1Master Usage Outline//Declare master SMBus structureSMBus SMB;//Initialize GPIOs and clocks...//Initialize GPIO I2C pins...//Initialize SMBus Master using eUSCI B0always at100kbps per SMBus specSMBus masterInit(&SMB,EUSCI B0BASE,(MCLK MHZ*1000000));//Initialize I2C and enable SMBus InterruptsSMBus masterEnableInt(&SMB);//Send SMBus Sendbyte command(0x33)uint8t ret=SMBus masterSendByte(&SMB,//SMB struct0x40,//Slave Addr0x33);//SMB Command...3.2.2Slave Usage Outlinemain(){//Declare slave SMBus structureSMBus SMB;//SMBus receive and transmit buffersuint8t au8RxBuff[SMB MAX PACKET SIZE];uint8t au8TxBuff[SMB MAX PACKET SIZE];//Initialize GPIOs and clocks...//Initialize GPIO I2C pins...//Initialize SMBus Slave using eUSCI B0SMBus slaveInit(&SMB,EUSCI B0BASE);//Set the slave’s addressSMBus slaveSetAddress(&SMB,0x40);//Set the RX and TX buffers for SMBusSMBus slaveSetRxBuffer(&SMB,au8RxBuff,sizeof(au8RxBuff));SMBus slaveSetTxBuffer(&SMB,au8TxBuff,sizeof(au8TxBuff));//Initialize I2C and enable SMBus InterruptsSMBus slaveEnableInt(&SMB);...while(1){disable interrupt();{BIS SR(LPM3bits+GIE);//Go to sleep}enable interrupt();}//While(1)}#pragma vector=USCI B0VECTORinterrupt void eUSCI ISR(void){//Check the state of SMBusswitch(SMBus slaveProcessInt(&SMB)){case SMBus State Slave QCMD://If a Quick command was detected,execute function(if any)break;case SMBus State Slave CmdComplete://Get command using SMBus slaveGetCommand(&SMB)and process command//if command is not valid/supported//SMBus slaveReportError(&SMB,SMBUS ErrorCode Cmd);LPM3EXIT;//Exit to main loop if requiredbreak;default:break;}//Clear flags to be ready for next packetSMBus processDone(&SMB);}3.3ExamplesSeveral examples are provided with the release package that illustrate using the library toimplement both SMBus master and slave application.For each example,matching master and slave implementations are provided.ReadByte Echo-sends and echoes back a ReadByte commandWriteWord Dimmer-sends and echoes back a WriteWord commandAllProtocols-sequences through all the SMBus protocolsExamples are configured for the MSP-EXP430G2and MSP-EXP430FR5969launch pad boardsand CCS and IAR projects are provided.9 IMPORTANT NOTICET exas Instruments Incorporated and its subsidiaries(TI)reserve the right to make corrections,modifications,enhancements,improvements, and other changes to its products and services at any time and to discontinue any product or service without notice.Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete.All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard warranty.T esting and other quality control techniques are used to the extent TI deems necessary to support this warranty.Except where mandated by government requirements,testing of all parameters of each product is not necessarily performed.TI assumes no liability for applications assistance or customer product design.Customers are responsible for their products and applications using TI components.T o minimize the risks associated with customer products and applications,customers should provide adequate design and operating safeguards.TI does not warrant or represent that any license,either express or implied,is granted under any TI patent right,copyright,mask work right,or other TI intellectual property right relating to any combination,machine,or process in which TI products or services are used. Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a warranty or endorsement e of such information may require a license from a third party under the patents or other intellectual property of the third party,or a license from TI under the patents or other intellectual property of TI.Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accom-panied by all associated warranties,conditions,limitations,and notices.Reproduction of this information with alteration is an unfair and deceptive business practice.TI is not responsible or liable for such altered rmation of third parties may be subject to additional restrictions.Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice.TI is not responsible or liable for any such statements.TI products are not authorized for use in safety-critical applications(such as life support)where a failure of the TI product would reasonably be expected to cause severe personal injury or death,unless officers of the parties have executed an agreement specifically governing such use.Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and acknowledge and agree that they are solely responsible for all legal,regulatory and safety-related requirements concerning their products and any use of TI products in such safety-critical applications,notwithstanding any applications-related information or support that may be provided by TI.Further,Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in such safety-critical applications.TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are specifically designated by TI as military-grade or“enhanced plastic.”Only products designated by TI as military-grade meet military spec-ifications.Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at the Buyer’s risk,and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use.TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are designated by TI as compliant with ISO/TS16949requirements.Buyers acknowledge and agree that,if they use any non-designated products in automotive applications,TI will not be responsible for any failure to meet such requirements.Following are URLs where you can obtain information on other Texas Instruments products and application solutions:ProductsAmplifiersData ConvertersDLP®ProductsDSPClocks and TimersInterfaceLogicPower Mgmt MicrocontrollersRFIDRF/IF and ZigBee®Solutions amplifi/clockswww.ti-rfi/lprfApplicationsAudioAutomotiveBroadbandDigital ControlMedicalMilitaryOptical NetworkingSecurityT elephonyVideo&ImagingWireless/audio/automotive/broadband/digitalcontrol/medical/military/opticalnetwork/security/telephony/video/wirelessMailing Address:T exas Instruments,Post Office Box655303,Dallas,T exas75265 Copyright©2015,T exas Instruments Incorporated。