MSP430寄存器详述 (2)讲课稿_第1页
MSP430寄存器详述 (2)讲课稿_第2页
MSP430寄存器详述 (2)讲课稿_第3页
MSP430寄存器详述 (2)讲课稿_第4页
MSP430寄存器详述 (2)讲课稿_第5页
已阅读5页,还剩75页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Good is good, but better carries it.精益求精,善益求善。MSP430寄存器详述 (2)-/*中断*/*中断使能1*/#defineIE1_0 x0000sfrbIE1=IE1_;#defineWDTIE0 x01/*看门狗中断使能*/#defineOFIE0 x02/*外部晶振故障中断使能*/#defineNMIIE0 x10/*非屏蔽中断使能*/#defineACCVIE0 x20/*可屏蔽中断使能/flash写中断错误*/#defineURXIE00 x40/*串口0接收中断使能*/#defineUTXIE00 x80/*串口0发送中断使能*/中断使能I

2、E1UTXIE0URXIE0ACCVIENMIIEOFIEWDTIE/*中断标志1*/#defineIFG1_0 x0002sfrbIFG1=IFG1_;#defineWDTIFG0 x01/*看门狗中断标志*/#defineOFIFG0 x02/*外部晶振故障中断标志*/#defineNMIIFG0 x10/*非屏蔽中断标志*/#defineURXIFG00 x40/*串口0接收中断标志*/#defineUTXIFG00 x80/*串口0发送中断标志*/中断标志IFG1UTXIFG0URXIFG0NMIIFGOFIFGWDTIFG/*中断模式使能1*/#defineME1_0 x0004sf

3、rbME1=ME1_;#defineURXE00 x40/*串口0接收中断模式使能*/#defineUSPIE00 x40/*同步中断模式使能*/#defineUTXE00 x80/*串口0发送中断模式使能*/中断模式使能ME1UTXE0URXE0USPIE0/*中断使能2*/#defineIE2_0 x0001sfrbIE2=IE2_;#defineURXIE10 x10/*串口1接收中断使能*/#defineUTXIE10 x20/*串口1发送中断使能*/中断使能IE2UTXIE1URXIE1/*中断标志2*/#defineIFG2_0 x0003sfrbIFG2=IFG2_;#defin

4、eURXIFG10 x10/*串口1接收中断标志*/#defineUTXIFG10 x20/*串口1发送中断标志*/中断标志IFG2UTXIFG1URXIFG1/*中断模式使能2*/#defineME2_0 x0005sfrbME2=ME2_;#defineURXE10 x10/*串口1接收中断模式使能*/#defineUSPIE10 x10/*同步中断模式使能*/#defineUTXE10 x20/*串口1发送中断模式使能*/中断模式使能ME2UTXE1URXE1USPIE1/*看门狗*/#defineWDTCTL_0 x0120P145sfrwWDTCTL=WDTCTL_;#defineW

5、DTIS00 x0001/*选择WDTCNT的四个输出端之一*/#defineWDTIS10 x0002/*选择WDTCNT的四个输出端之一*/#defineWDTSSEL0 x0004/*选择WDTCNT的时钟源*/#defineWDTCNTCL0 x0008/*清除WDTCNT端:为1时从0开始计数*/#defineWDTTMSEL0 x0010/*选择模式0:看门狗模式;1:定时器模式*/#defineWDTNMI0 x0020/*选择NMI/RST引脚功能0:为RST;1:为NMI*/#defineWDTNMIES0 x0040/*WDTNMI=1时.选择触发延0:为上升延1:为下降延

6、*/#defineWDTHOLD0 x0080/*停止看门狗定时器工作0:启动;1:停止*/看门狗控制寄存器WDTCTL口令WDTHOLDWDTNMIESWDTNMIWDTTMSELWDTCNTCLWDTSSELWDTIS1WDTIS0注:口令(15-8):读取为69H,写为5AH。#defineWDTPW0 x5A00/*写密码:高八位*/*SMCLK=1MHz定时器模式*/#defineWDT_MDLY_32WDTPW+WDTTMSEL+WDTCNTCL/*TSMCLK*2POWER15=32ms复位状态*/#defineWDT_MDLY_8WDTPW+WDTTMSEL+WDTCNTCL+

7、WDTIS0/*TSMCLK*2POWER13=8.192ms*/#defineWDT_MDLY_0_5WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1/*TSMCLK*2POWER9=0.512ms*/#defineWDT_MDLY_0_064WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0/*TSMCLK*2POWER6=0.512ms*/*ACLK=32.768KHz定时器模式*/#defineWDT_ADLY_1000WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL/*TACLK*2POWER15=1000ms*/#defineWDT

8、_ADLY_250WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0/*TACLK*2POWER13=250ms*/#defineWDT_ADLY_16WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1/*TACLK*2POWER9=16ms*/#defineWDT_ADLY_1_9WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0/*TACLK*2POWER6=1.9ms*/*SMCLK=1MHz看门狗模式*/#defineWDT_MRST_32WDTPW+WDTCNTCL/*TSMCLK*2POWE

9、R15=32ms复位状态*/#defineWDT_MRST_8WDTPW+WDTCNTCL+WDTIS0/*TSMCLK*2POWER13=8.192ms*/#defineWDT_MRST_0_5WDTPW+WDTCNTCL+WDTIS1/*TSMCLK*2POWER9=0.512ms*/#defineWDT_MRST_0_064WDTPW+WDTCNTCL+WDTIS1+WDTIS0/*TSMCLK*2POWER6=0.512ms*/*ACLK=32.768KHz看门狗模式*/#defineWDT_ARST_1000WDTPW+WDTCNTCL+WDTSSEL/*TACLK*2POWER15

10、=1000ms*/#defineWDT_ARST_250WDTPW+WDTCNTCL+WDTSSEL+WDTIS0/*TACLK*2POWER13=250ms*/#defineWDT_ARST_16WDTPW+WDTCNTCL+WDTSSEL+WDTIS1/*TACLK*2POWER9=16ms*/#defineWDT_ARST_1_9WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0/*TACLK*2POWER6=1.9ms*/*基本定时器*/#defineBTCTL_(0 x0040)/*控制寄存器*/MSP430F4XX系列(P148)#defineBTIP0(0

11、x01)#defineBTIP1(0 x02)#defineBTIP2(0 x04)/*BTIP2-0:定时中断频率*/#defineBTFRFQ0(0 x08)#defineBTFRFQ1(0 x10)/*输出fLCD信号*/#defineBTDIV(0 x20)/*fCLK2=ACLK:256*/#defineBTHOLD(0 x40)/*0:启动;1:停止*/#defineBTSSEL(0 x80)/*fBT=fMCLK(mainclock)*/基本计时器控制寄存器BTSSELBTHOLDBTDIVBTFRFQ1BTFRFQ0BTIP2BTIP1BTIP0#defineBTCNT1_(0

12、 x0046)/*BasicTimerCount1*/#defineBTCNT2_(0 x0047)/*BasicTimerCount2*/*FrequencyoftheBTCNT2codedwithBit5and7inBTCTL*/#defineBT_fCLK2_ACLK(0 x00)#defineBT_fCLK2_ACLK_DIV256(BTDIV)/*256分频*/#defineBT_fCLK2_MCLK(BTSSEL)#defineBT_fCLK2_ACLK_DIV256(BTSSEL+BTDIV)/*很少使用吧*/*InterruptintervaltimefINTcodedwith

13、Bits0-2inBTCTL*/#defineBT_fCLK2_DIV2(0 x00)/*fINT=fCLK2:2(default)*/#defineBT_fCLK2_DIV4(BTIP0)/*fINT=fCLK2:4*/#defineBT_fCLK2_DIV8(BTIP1)/*fINT=fCLK2:8*/#defineBT_fCLK2_DIV16(BTIP1+BTIP0)/*fINT=fCLK2:16*/#defineBT_fCLK2_DIV32(BTIP2)/*fINT=fCLK2:32*/#defineBT_fCLK2_DIV64(BTIP2+BTIP0)/*fINT=fCLK2:64*

14、/#defineBT_fCLK2_DIV128(BTIP2+BTIP1)/*fINT=fCLK2:128*/#defineBT_fCLK2_DIV256(BTIP2+BTIP1+BTIP0)/*fINT=fCLK2:256*/*FrequencyofLCDcodedwithBits3-4*/#defineBT_fLCD_DIV32(0 x00)/*fLCD=fACLK:32(default)*/#defineBT_fLCD_DIV64(BTFRFQ0)/*fLCD=fACLK:64*/#defineBT_fLCD_DIV128(BTFRFQ1)/*fLCD=fACLK:128*/#define

15、BT_fLCD_DIV256(BTFRFQ1+BTFRFQ0)/*fLCD=fACLK:256*/*LCDfrequencyvalueswithfBT=fACLK*/#defineBT_fLCD_1K(0 x00)/*fACLK:32(default)*/#defineBT_fLCD_512(BTFRFQ0)/*fACLK:64*/#defineBT_fLCD_256(BTFRFQ1)/*fACLK:128*/#defineBT_fLCD_128(BTFRFQ1+BTFRFQ0)/*fACLK:256*/*LCDfrequencyvalueswithfBT=fMCLK*/#defineBT_f

16、LCD_31K(BTSSEL)/*fMCLK:32还是fMCLK?*/#defineBT_fLCD_15_5K(BTSSEL+BTFRFQ0)/*fMCLK:64*/#defineBT_fLCD_7_8K(BTSSEL+BTFRFQ1+BTFRFQ0)/*fMCLK:256*/*withassumedvluesoffACLK=32KHz,fMCLK=1MHz*/*fBT=fACLKisthoughtforlongerintervaltimes*/#defineBT_ADLY_0_064(0 x00)/*0.064msinterval(default)*/#defineBT_ADLY_0_125

17、(BTIP0)/*0.125ms*/#defineBT_ADLY_0_25(BTIP1)/*0.25ms*/#defineBT_ADLY_0_5(BTIP1+BTIP0)/*0.5ms*/#defineBT_ADLY_1(BTIP2)/*1ms*/#defineBT_ADLY_2(BTIP2+BTIP0)/*2ms*/#defineBT_ADLY_4(BTIP2+BTIP1)/*4ms*/#defineBT_ADLY_8(BTIP2+BTIP1+BTIP0)/*8ms*/#defineBT_ADLY_16(BTDIV)/*16ms*/#defineBT_ADLY_32(BTDIV+BTIP0)

18、/*32ms*/#defineBT_ADLY_64(BTDIV+BTIP1)/*64ms*/#defineBT_ADLY_125(BTDIV+BTIP1+BTIP0)/*125ms*/#defineBT_ADLY_250(BTDIV+BTIP2)/*250ms*/#defineBT_ADLY_500(BTDIV+BTIP2+BTIP0)/*500ms*/#defineBT_ADLY_1000(BTDIV+BTIP2+BTIP1)/*1000ms*/#defineBT_ADLY_2000(BTDIV+BTIP2+BTIP1+BTIP0)/*2000ms*/*fCLK2=fMCLK(1MHz)is

19、thoughtforshortintervaltimes*/*thetimingforshortintervalsismoreprecisethanACLK*/*BesurethattheSCFQCTL-Registerissetto01FhsothatfMCLK=1MHz*/*Toolowintervaltimeresultsininterruptstoofrequentfortheprocessortohandle!*/#defineBT_MDLY_0_002(BTSSEL)/*0.002msinterval*intervaltimes*/#defineBT_MDLY_0_004(BTSS

20、EL+BTIP0)/*0.004ms*tooshortfor*/#defineBT_MDLY_0_008(BTSSEL+BTIP1)/*0.008ms*interrupt*/#defineBT_MDLY_0_016(BTSSEL+BTIP1+BTIP0)/*0.016ms*handling*/#defineBT_MDLY_0_032(BTSSEL+BTIP2)/*0.032ms*/#defineBT_MDLY_0_064(BTSSEL+BTIP2+BTIP0)/*0.064ms*/#defineBT_MDLY_0_125(BTSSEL+BTIP2+BTIP1)/*0.125ms*/#defin

21、eBT_MDLY_0_25(BTSSEL+BTIP2+BTIP1+BTIP0)/*0.25ms*/*Reset/HoldcodedwithBits6-7inBT(1)CTL*/*thisisforBT*/#defineBTRESET_CNT1(BTRESET)/*BTCNT1isresetwhileBTRESETisset*/#defineBTRESET_CNT1_2(BTRESET+BTDIV)/*BTCNT1.AND.BTCNT2areresetwhileisset*/*thisisforBT1*/#defineBTHOLD_CNT1(BTHOLD)/*BTCNT1isheldwhileB

22、THOLDisset*/#defineBTHOLD_CNT1_2(BTHOLD+BTDIV)/*BT1CNT1.AND.BT1CNT2areheldwhileisset*/*INTERRUPTCONTROLBITS*/*#defineBTIE0 x80*/*#defineBTIFG0 x80*/*定时器A3*/#defineTAIV_(0 x012E)/*TimerAInterruptVectorWord*/READ_ONLYDEFW(TAIV,TAIV_)#defineTACTL_(0 x0160)/*TimerAControl*/DEFW(TACTL,TACTL_)#defineTACCT

23、L0_(0 x0162)/*TimerACapture/CompareControl0*/DEFW(TACCTL0,TACCTL0_)#defineTACCTL1_(0 x0164)/*TimerACapture/CompareControl1*/DEFW(TACCTL1,TACCTL1_)#defineTACCTL2_(0 x0166)/*TimerACapture/CompareControl2*/DEFW(TACCTL2,TACCTL2_)#defineTAR_(0 x0170)/*TimerA*/DEFW(TAR,TAR_)#defineTACCR0_(0 x0172)/*TimerA

24、Capture/Compare0*/DEFW(TACCR0,TACCR0_)#defineTACCR1_(0 x0174)/*TimerACapture/Compare1*/DEFW(TACCR1,TACCR1_)#defineTACCR2_(0 x0176)/*TimerACapture/Compare2*/DEFW(TACCR2,TACCR2_)/*Alternateregisternames*/#defineCCTL0TACCTL0/*TimerACapture/CompareControl0*/#defineCCTL1TACCTL1/*TimerACapture/CompareCont

25、rol1*/#defineCCTL2TACCTL2/*TimerACapture/CompareControl2*/#defineCCR0TACCR0/*TimerACapture/Compare0*/#defineCCR1TACCR1/*TimerACapture/Compare1*/#defineCCR2TACCR2/*TimerACapture/Compare2*/#defineCCTL0_TACCTL0_/*TimerACapture/CompareControl0*/#defineCCTL1_TACCTL1_/*TimerACapture/CompareControl1*/#defi

26、neCCTL2_TACCTL2_/*TimerACapture/CompareControl2*/#defineCCR0_TACCR0_/*TimerACapture/Compare0*/#defineCCR1_TACCR1_/*TimerACapture/Compare1*/#defineCCR2_TACCR2_/*TimerACapture/Compare2*/*TACTL:定时器A控制寄存器*/#defineTASSEL1(0 x0200)/*TimerAclocksourceselect0*/#defineTASSEL0(0 x0100)/*TimerAclocksourceselec

27、t1*/#defineID1(0 x0080)/*TimerAclockinputdivider1*/#defineID0(0 x0040)/*TimerAclockinputdivider0*/#defineMC1(0 x0020)/*TimerAmodecontrol1*/#defineMC0(0 x0010)/*TimerAmodecontrol0*/#defineTACLR(0 x0004)/*TimerAcounterclear*/#defineTAIE(0 x0002)/*TimerAcounterinterruptenable*/#defineTAIFG(0 x0001)/*Ti

28、merAcounterinterruptflag*/15-109876543210XTASSEL1TASSEL0ID1ID0MC1MC0XTACLRTAIETAIFG/*MC1.MC0:计数模式控制位*/#defineMC_0(0*0 x10u)/*00停止模式*/#defineMC_1(1*0 x10u)/*01增计数模式*/#defineMC_2(2*0 x10u)/*10连续计数模式*/#defineMC_3(3*0 x10u)/*11增减计数模式*/*ID1.ID0:输入分频选择*/#defineID_0(0*0 x40u)/*00:不分频*/#defineID_1(1*0 x40u)

29、/*01:2分频*/#defineID_2(2*0 x40u)/*10:4分频*/#defineID_3(3*0 x40u)/*11:8分频*/*SSEL1.SSEL0:输入分频器的时钟源选择*/#defineTASSEL_0(0*0 x100u)/*00:TACLK见具体器件说明*/#defineTASSEL_1(1*0 x100u)/*01:ACLK*/#defineTASSEL_2(2*0 x100u)/*10:SMCLK*/#defineTASSEL_3(3*0 x100u)/*11:INCLK见具体器件说明*/*TACCTLx:捕获/比较控制寄存器*/#defineCM1(0 x80

30、00)/*Capturemode1*/#defineCM0(0 x4000)/*Capturemode0*/#defineCCIS1(0 x2000)/*Captureinputselect1*/#defineCCIS0(0 x1000)/*Captureinputselect0*/#defineSCS(0 x0800)/*0:异步捕获;1:同步捕获*/#defineSCCI(0 x0400)/*Latchedcapturesignal(read)*/#defineCAP(0 x0100)/*0:比较模式;1:捕获模式*/#defineOUTMOD2(0 x0080)/*Outputmode2

31、*/#defineOUTMOD1(0 x0040)/*Outputmode1*/#defineOUTMOD0(0 x0020)/*Outputmode0*/#defineCCIE(0 x0010)/*0:禁止中断;1:允许中断*/#defineCCI(0 x0008)/*Captureinputsignal(read)*/#defineOUT(0 x0004)/*PWMOutputsignalifoutputmode0*/#defineCOV(0 x0002)/*捕获溢出标志(1为溢出)*/#defineCCIFG(0 x0001)/*Capture/compareinterruptflag*

32、/15.1413.121110987.6.543210CM1.0CCIS1.0SCSSCCICAPOUTMOD2.1.0CCIECCIOUTCOVCCIFG/*OUTMODx:输出模式选择*/#defineOUTMOD_0(0*0 x20u)/*PWMoutputmode:0输出*/#defineOUTMOD_1(1*0 x20u)/*PWMoutputmode:1置位*/#defineOUTMOD_2(2*0 x20u)/*PWMoutputmode:2-PWM翻转/复位*/#defineOUTMOD_3(3*0 x20u)/*PWMoutputmode:3-PWM置位/复位*/#defin

33、eOUTMOD_4(4*0 x20u)/*PWMoutputmode:4翻转*/#defineOUTMOD_5(5*0 x20u)/*PWMoutputmode:5复位*/#defineOUTMOD_6(6*0 x20u)/*PWMoutputmode:6-PWM翻转/置位*/#defineOUTMOD_7(7*0 x20u)/*PWMoutputmode:7-PWM复位/置位*/*CCIS1.CCIS0:捕获事件的输入源*/#defineCCIS_0(0*0 x1000u)/*Captureinputselect:0-CCIxA*/#defineCCIS_1(1*0 x1000u)/*Cap

34、tureinputselect:1-CCIxB*/#defineCCIS_2(2*0 x1000u)/*Captureinputselect:2-GND*/#defineCCIS_3(3*0 x1000u)/*Captureinputselect:3-Vcc*/*CM1.CM0:捕获模式选择*/#defineCM_0(0*0 x4000u)/*Capturemode:0禁止捕获模式*/#defineCM_1(1*0 x4000u)/*Capturemode:1上升沿捕获*/#defineCM_2(2*0 x4000u)/*Capturemode:1下降沿捕获*/#defineCM_3(3*0

35、x4000u)/*Capturemode:1上升下降沿捕获*/*硬件乘法器的寄存器定义*/#defineMPY_0 x0130/*无符号乘法*/sfrwMPY=MPY_;#defineMPYS_0 x0132/*有符号乘法*/sfrwMPYS=MPYS_;#defineMAC_0 x0134/*无符号乘加*/sfrwMAC=MAC_;#defineMACS_0 x0136/*有符号乘加*/sfrwMACS=MACS_;#defineOP2_0 x0138/*第二乘数*/sfrwOP2=OP2_;#defineRESLO_0 x013A/*低6位结果寄存器*/sfrwRESLO=RESLO_;#

36、defineRESHI_0 x013C/*高6位结果寄存器*/sfrwRESHI=RESHI_;#defineSUMEXT_0 x013E/*结果扩展寄存器*/constsfrwSUMEXT=SUMEXT_;/*LCD*/#defineLCDCTL_(0 x0090)/*LCDControl*/DEFC(LCDCTL,LCDCTL_)/*thenamesofthemodebitsaredifferentfromthespec*/#defineLCDON(0 x01)#defineLCDLOWR(0 x02)/*unused*/#defineLCDSON(0 x04)/*段输出控制:0禁止;1允

37、许*/#defineLCDMX0(0 x08)#defineLCDMX1(0 x10)/*输出模式选择*/#defineLCDP0(0 x20)#defineLCDP1(0 x40)#defineLCDP2(0 x80)/*输出端或端口信息组合*/LCDCTLLCDP2LCDP1LCDP0LCDMX1LCDMX0LCDSONLCDLOWRLCDON/*输出模式选择*/#defineLCDSTATIC(LCDSON)#defineLCD2MUX(LCDMX0+LCDSON)#defineLCD3MUX(LCDMX1+LCDSON)#defineLCD4MUX(LCDMX1+LCDMX0+LCDS

38、ON)/*输出端或端口信息组合*/#defineLCDSG0(0 x00)/*-PortOnly(default)*/#defineLCDSG0_1(LCDP0)/*S0-S15seeDatasheet*/#defineLCDSG0_2(LCDP1)/*S0-S19seeDatasheet*/#defineLCDSG0_3(LCDP1+LCDP0)/*S0-S23seeDatasheet*/#defineLCDSG0_4(LCDP2)/*S0-S27seeDatasheet*/#defineLCDSG0_5(LCDP2+LCDP0)/*S0-S31seeDatasheet*/#defineLC

39、DSG0_6(LCDP2+LCDP1)/*S0-S35seeDatasheet*/#defineLCDSG0_7(LCDP2+LCDP1+LCDP0)/*S0-S39seeDatasheet*/#defineLCDOG1_7(0 x00)/*-PortOnly(default)*/#defineLCDOG2_7(LCDP0)/*S0-S15seeDatasheet*/#defineLCDOG3_7(LCDP1)/*S0-S19seeDatasheet*/#defineLCDOG4_7(LCDP1+LCDP0)/*S0-S23seeDatasheet*/#defineLCDOG5_7(LCDP2

40、)/*S0-S27seeDatasheet*/#defineLCDOG6_7(LCDP2+LCDP0)/*S0-S31seeDatasheet*/#defineLCDOG7(LCDP2+LCDP1)/*S0-S35seeDatasheet*/#defineLCDOGOFF(LCDP2+LCDP1+LCDP0)/*S0-S39seeDatasheet*/#defineLCDMEM_(0 x0091)/*LCDMemory*/#ifndef_IAR_SYSTEMS_ICC#defineLCDMEM(LCDMEM_)/*LCDMemory(forassembler)*/#else#defineLCD

41、MEM(char*)LCDMEM_)/*LCDMemory(forC)*/#endif#defineLCDM1_(0 x0091)/*LCDMemory1*/DEFC(LCDM1,LCDM1_)#defineLCDM2_(0 x0092)/*LCDMemory2*/DEFC(LCDM2,LCDM2_)#defineLCDM3_(0 x0093)/*LCDMemory3*/DEFC(LCDM3,LCDM3_)#defineLCDM4_(0 x0094)/*LCDMemory4*/DEFC(LCDM4,LCDM4_)#defineLCDM5_(0 x0095)/*LCDMemory5*/DEFC(

42、LCDM5,LCDM5_)#defineLCDM6_(0 x0096)/*LCDMemory6*/DEFC(LCDM6,LCDM6_)#defineLCDM7_(0 x0097)/*LCDMemory7*/DEFC(LCDM7,LCDM7_)#defineLCDM8_(0 x0098)/*LCDMemory8*/DEFC(LCDM8,LCDM8_)#defineLCDM9_(0 x0099)/*LCDMemory9*/DEFC(LCDM9,LCDM9_)#defineLCDM10_(0 x009A)/*LCDMemory10*/DEFC(LCDM10,LCDM10_)#defineLCDM11

43、_(0 x009B)/*LCDMemory11*/DEFC(LCDM11,LCDM11_)#defineLCDM12_(0 x009C)/*LCDMemory12*/DEFC(LCDM12,LCDM12_)#defineLCDM13_(0 x009D)/*LCDMemory13*/DEFC(LCDM13,LCDM13_)#defineLCDM14_(0 x009E)/*LCDMemory14*/DEFC(LCDM14,LCDM14_)#defineLCDM15_(0 x009F)/*LCDMemory15*/DEFC(LCDM15,LCDM15_)#defineLCDM16_(0 x00A0)

44、/*LCDMemory16*/DEFC(LCDM16,LCDM16_)#defineLCDM17_(0 x00A1)/*LCDMemory17*/DEFC(LCDM17,LCDM17_)#defineLCDM18_(0 x00A2)/*LCDMemory18*/DEFC(LCDM18,LCDM18_)#defineLCDM19_(0 x00A3)/*LCDMemory19*/DEFC(LCDM19,LCDM19_)#defineLCDM20_(0 x00A4)/*LCDMemory20*/DEFC(LCDM20,LCDM20_)#defineLCDMA(LCDM10)/*LCDMemoryA*

45、/#defineLCDMB(LCDM11)/*LCDMemoryB*/#defineLCDMC(LCDM12)/*LCDMemoryC*/#defineLCDMD(LCDM13)/*LCDMemoryD*/#defineLCDME(LCDM14)/*LCDMemoryE*/#defineLCDMF(LCDM15)/*LCDMemoryF*/*Flash存储器*/#defineFCTL1_(0 x0128)/*FLASHControl1*/DEFW(FCTL1,FCTL1_)#defineFCTL2_(0 x012A)/*FLASHControl2*/DEFW(FCTL2,FCTL2_)#def

46、ineFCTL3_(0 x012C)/*FLASHControl3*/DEFW(FCTL3,FCTL3_)/*控制寄存器1:FCTL1*/#defineFRKEY(0 x9600)/*口令码:读出为96H*/#defineFWKEY(0 xA500)/*口令码:写入为5AH*/#defineFXKEY(0 x3300)/*forusewithXORinstruction*/#defineERASE(0 x0002)/*擦除一段控制位:1使能*/#defineMERAS(0 x0004)/*主存擦除控制位:1使能*/#defineWRT(0 x0040)/*编程位:1使能*/#defineBLK

47、WRT(0 x0080)/*段编程位:1选用段编程方式*/#defineSEGWRT(0 x0080)/*段编程位:1选用段编程方式*/15-8765-3210口令码BLKWRTWRTXMERASERASEX/*控制寄存器2:FCTL2*/#defineFN0(0 x0001)/*DivideFlashclockby1to64usingFN0toFN5*/#defineFN1(0 x0002)/*32*FN5+16*FN4+8*FN3+4*FN2+2*FN1+FN0+1*/#ifndefFN2#defineFN2(0 x0004)#endif#ifndefFN3#defineFN3(0 x00

48、08)#endif#ifndefFN4#defineFN4(0 x0010)#endif#defineFN5(0 x0020)#defineFSSEL0(0 x0040)/*Flashclockselect0*/*todistinguishfromUSARTSSELx*/#defineFSSEL1(0 x0080)/*Flashclockselect1*/15-876543210口令码SSEL1SSEL0FN5FN4FN3FN2FN1FN0#defineFSSEL_0(0 x0000)/*Flashclockselect:0-ACLK*/#defineFSSEL_1(0 x0040)/*Fla

49、shclockselect:1-MCLK*/#defineFSSEL_2(0 x0080)/*Flashclockselect:2-SMCLK*/#defineFSSEL_3(0 x00C0)/*Flashclockselect:3-SMCLK*/*控制寄存器3:FCTL3*/#defineBUSY(0 x0001)/*忙标志位:1忙*/#defineKEYV(0 x0002)/*口令码出错标志位:1出错,发PUC信号*/#defineACCVIFG(0 x0004)/*非法访问中断标志:1出现非法访问*/#defineWAIT(0 x0008)/*等待段编程信号位:1在等待中*/#defin

50、eLOCK(0 x0010)/*Lockbit:1-Flashislocked(readonly)*/#defineEMEX(0 x0020)/*紧急退出位:1使能*/15-876543210口令码XXEMEXLOCKWAITACCVIFGKEYVBUSY/*比较器A*/#defineCACTL1_(0 x0059)/*ComparatorAControl1*/DEFC(CACTL1,CACTL1_)#defineCACTL2_(0 x005A)/*ComparatorAControl2*/DEFC(CACTL2,CACTL2_)#defineCAPD_(0 x005B)/*比较器A端口禁止寄

51、存器*/DEFC(CAPD,CAPD_)/*比较器A控制寄存器1:CACTL1*/76543210CAEXCARSELCAREF1CAREF0CAONCAIESCAIECAIFG#defineCAIFG(0 x01)/*Comp.AInterruptFlag*/#defineCAIE(0 x02)/*Comp.AInterruptEnable*/#defineCAIES(0 x04)/*中断触发沿选择:0上升;1下降*/#defineCAON(0 x08)/*Comp.Aenable*/#defineCAREF0(0 x10)/*Comp.AInternalReferenceSelect0*/

52、#defineCAREF1(0 x20)/*Comp.AInternalReferenceSelect1*/#defineCARSEL(0 x40)/*Comp.AInternalReferenceEnable*/*选择内部参考电压加到比较器A的正/负端*/#defineCAEX(0 x80)/*Comp.AExchangeInputs:when1*/*参考源选择*/#defineCAREF_0(0 x00)/*Comp.AInt.Ref.Select0:Off*/#defineCAREF_1(0 x10)/*Comp.AInt.Ref.Select1:0.25*Vcc*/#defineCAR

53、EF_2(0 x20)/*Comp.AInt.Ref.Select2:0.5*Vcc*/#defineCAREF_3(0 x30)/*Comp.AInt.Ref.Select3:Vt*/*比较器A控制寄存器2:CACTL2*/76543210CACTL2.7CACTL2.6CACTL2.5CACTL2.4P2CA1P2CA0CAFCAOUT#defineCAOUT(0 x01)/*Comp.AOutput:1whenCA0CA1*/#defineCAF(0 x02)/*Comp.AEnableOutputFilter:1*/#defineP2CA0(0 x04)/*Comp.AConnectE

54、xternalSignaltoCA0:1*/#defineP2CA1(0 x08)/*Comp.AConnectExternalSignaltoCA1:1*/#defineCACTL24(0 x10)#defineCACTL25(0 x20)#defineCACTL26(0 x40)#defineCACTL27(0 x80)/*高4位具体见芯片数据手册*/*比较器端口禁止寄存器:CAPD*/#defineCAPD0(0 x01)/*Comp.ADisableInputBufferofPortRegister.0*/#defineCAPD1(0 x02)/*Comp.ADisableInputB

55、ufferofPortRegister.1*/#defineCAPD2(0 x04)/*Comp.ADisableInputBufferofPortRegister.2*/#defineCAPD3(0 x08)/*Comp.ADisableInputBufferofPortRegister.3*/#defineCAPD4(0 x10)/*Comp.ADisableInputBufferofPortRegister.4*/#defineCAPD5(0 x20)/*Comp.ADisableInputBufferofPortRegister.5*/#defineCAPD6(0 x40)/*Comp

56、.ADisableInputBufferofPortRegister.6*/#defineCAPD7(0 x80)/*Comp.ADisableInputBufferofPortRegister.7*/*DMA*/#defineDMACTL0_(0 x0122)/*DMA控制寄存器0*/DEFW(DMACTL0,DMACTL0_)#defineDMA0TSEL0(0 x0001)/*DMAchannel0transferselectbit0*/#defineDMA0TSEL1(0 x0002)/*DMAchannel0transferselectbit1*/#defineDMA0TSEL2(0

57、 x0004)/*DMAchannel0transferselectbit2*/#defineDMA0TSEL3(0 x0008)/*DMAchannel0transferselectbit3*/#defineDMA1TSEL0(0 x0010)/*DMAchannel1transferselectbit0*/#defineDMA1TSEL1(0 x0020)/*DMAchannel1transferselectbit1*/#defineDMA1TSEL2(0 x0040)/*DMAchannel1transferselectbit2*/#defineDMA1TSEL3(0 x0080)/*D

58、MAchannel1transferselectbit3*/#defineDMA2TSEL0(0 x0100)/*DMAchannel2transferselectbit0*/#defineDMA2TSEL1(0 x0200)/*DMAchannel2transferselectbit1*/#defineDMA2TSEL2(0 x0400)/*DMAchannel2transferselectbit2*/#defineDMA2TSEL3(0 x0800)/*DMAchannel2transferselectbit3*/#defineDMA0TSEL_0(0*0 x0001u)/*DMAchan

59、nel0transferselect0:DMA_REQ(sw)*/#defineDMA0TSEL_1(1*0 x0001u)/*DMAchannel0transferselect1:Timer_A(TACCR2.IFG)*/#defineDMA0TSEL_2(2*0 x0001u)/*DMAchannel0transferselect2:Timer_B(TBCCR2.IFG)*/#defineDMA0TSEL_3(3*0 x0001u)/*DMAchannel0transferselect3:UART0/I2Creceive*/#defineDMA0TSEL_4(4*0 x0001u)/*DM

60、Achannel0transferselect4:UART0/I2Ctransmit*/#defineDMA0TSEL_5(5*0 x0001u)/*DMAchannel0transferselect5:DAC12_0CTL.DAC12IFG*/#defineDMA0TSEL_6(6*0 x0001u)/*DMAchannel0transferselect6:ADC12(ADC12IFG)*/#defineDMA0TSEL_7(7*0 x0001u)/*DMAchannel0transferselect7:Timer_A(TACCR0.IFG)*/#defineDMA0TSEL_8(8*0 x

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论