msp430f449 msp430 launchpad - PowerPoint PPT Presentation

About This Presentation
Title:

msp430f449 msp430 launchpad

Description:

Title: msp430f449+msp430 launchpad Last modified by: Document presentation format: (4:3) Other titles: Arial Franklin Gothic Medium ... – PowerPoint PPT presentation

Number of Views:301
Avg rating:3.0/5.0
Slides: 50
Provided by: deyisuppo
Category:

less

Transcript and Presenter's Notes

Title: msp430f449 msp430 launchpad


1
msp430f449msp430 launchpad
  • 1?????IAR Embedded Workbench
  • 2?IAR????????
  • 3?IAR???

2
msp430f449??
  • 1??????1.83.6V
  • 2?????
  • ????280UA(1MHZ,2.2V)
  • ???? 1.1UA
  • ???? (RAM????)0.1UA
  • 3??5?????
  • 4???????????????6us
  • 5?12?A/D??? (8???????????????)
  • 6?16???????(RISC),150ns????
  • 7???3???/??????16????
  • 8??????????UART/SPI????
  • 9????????,?????????
  • 10????????160?
  • 11?FLASH????60KB,RAM?2KB

3
msp430f449
  • 1?IO?
  • 2???
  • 3???
  • 4???
  • 5?AD
  • 6?UART
  • 7?PWM?
  • 8????

4
1?IO?
  • ??P??????
  • 1?PxDIR ??/???????
  • (0???? 1????)
  • 2?PxIN ?????
  • ???????????,????????,???????????????I/O
    ???????
  • 3?PxOUT ?????
  • ????????????????????
  • 4?PxIFG ???????
  • (0?????? 1?????)
  • ?????8????,??????????????????
  • ?8?????????????,??????????,??????
  • ???????????gt1.5??MCLK???,??????????
  • 5?PxIES ??????????
  • (0????? 1?????)
  • 6?PxSEL ???????
  • (0?????I/O?? 1???????????)
  • 7?PxREN ??/?????????
  • (0?? 1??)

5
  • ??????P?
  • 1?P1?P2??????????
  • 2?P6???A/D????
  • 3?P1.2?P2.0???PWM?????
  • 4?P1.1MCLK P1.5ACLK
  • 5??????P2.4? P4.0???TXD,
  • P2.5
    ?P4.1???RXD?

6
  • ??????
  • 1???P???????IO???
  • 2???P?????????????
  • ?????
  • ? P1DIR0xff
    //?P1??????
  • PIOUT0x20 //
    P1???0x20
  • P1DIR0x00
    //?P1??????
  • dataP1IN
    //??P1??????
  • ????
  • ? P1DIRBIT0
    //?P1.0?????
  • P1OUTBIT0
    //P1.0??1
  • P1OUTBIT0
    //P1.0??0
  • P1DIRBIT0
    //?P1.0?????
  • dataP1INBIT0
    //??P1.0??????

7
2???
  • ???????
  • 1?LFXT1CLK????(32768HZ)
  • 2?XT2CLK????(8MHZ)
  • 3?DCOCLK?????????46MHZ
  • ????(???????)
  • ?????????

8
(No Transcript)
9
  • ????????????????
  • 1?ACLK????,??LFXT1CLK???
  • ?,?????????????
  • ???,?????????
  • 2?ACLK/nACLK??1?2?4?8????
  • P1.5??,?????????
  • 3?MCLK?????,????????
  • LFXT1CLK?XT2CLK?DCOCLK?
  • ??,???1?2?4?8???
  • ????P1.1??(????cpu)
  • 4?SMCLK?????,????????
  • XT2CLK?DCOCLK????(????????)

10
  • ??MCLK????
  • 1???????,MCLK???DCOCLK????1.048576MHZ
  • ?????MCLK(311)32768
  • 2?????ACLK??MCLK
  • void clk_initial()
  • do
  • IFG1OFIFG //??????????
  • __delay_cycles(200)
  • while((IFG1OFIFG)!0)
    //????????????
  • FLL_CTL1SELM1SELM0
    //??ACLK??MCLK

11
  • 3????? XT2CLK??MCLK
  • void clk_initial()
  • do
  • IFG1OFIFG //??????????
  • __delay_cycles(200)
  • while((IFG1OFIFG)!0)
    //????????????
  • FLL_CTL1SELM1 //??XT2CLK??MCLK
  • 4????? DCOCLK??MCLK??(1211) 2327687.995MHZ
  • void CLK_initial()
  • SCFI0FN_4 //??DCO???????2.826.6MH
    Z
  • SCFQCTL249 //????,????DCO???????
  • FLL_CTL0DCOPLUSOSCCAP_1
    //??DCO??MCLK???

12
3???
  • ?????
  • 1?????P1?P2
  • 2???????
  • 3??????????
  • 4??????
  • 5?A/D ?????
  • 6???????
  • ????? ????
  • 1??????????
  • ????????????????????????1
  • ?P1???????
  • ??????
  • P1IEBIT0//??P1.0????

13
  • ????????????????????????0
  • ???P1???????
  • ??????
  • P1IEBIT0//??P1.0????
  • 2??????????
  • _EINT()//?????,???51?EA1
  • _DINT()//?????,???51?EA0
  • 3??????Interrupt Vectors
  • define BASICTIMER_VECTOR (0 2u) / 0xFFE0
    Basic Timer /
  • define PORT2_VECTOR (1 2u) / 0xFFE2
    Port 2 /
  • define USART1TX_VECTOR (2 2u) / 0xFFE4
    USART 1 Transmit /
  • define USART1RX_VECTOR (3 2u) / 0xFFE6
    USART 1 Receive /
  • define PORT1_VECTOR (4 2u) / 0xFFE8
    Port 1 /
  • define TIMERA1_VECTOR (5 2u) / 0xFFEA
    Timer A CC1-2, TA /
  • define TIMERA0_VECTOR (6 2u) / 0xFFEC
    Timer A CC0 /
  • define ADC12_VECTOR (7 2u) / 0xFFEE
    ADC /
  • define USART0TX_VECTOR (8 2u) / 0xFFF0
    USART 0 Transmit /
  • define USART0RX_VECTOR (9 2u) / 0xFFF2
    USART 0 Receive /
  • define WDT_VECTOR (10 2u) / 0xFFF4
    Watchdog Timer /

14
  • 4??????
  • ??????????
  • PORT2_VECTOR (1 2u) / 0xFFE2 Port 2 /
  • PORT1_VECTOR (4 2u) / 0xFFE8 Port 1 /
  • TIMERA1_VECTOR (5 2u) / 0xFFEA Timer A CC1-2,
    TA /
  • TIMERA0_VECTOR (6 2u) / 0xFFEC Timer A CC0 /
  • ADC_VECTOR (7 2u) / 0xFFEE ADC /
  • USART0TX_VECTOR (8 2u) / 0xFFF0 USART 0
    Transmit /
  • USART0RX_VECTOR (9 2u) / 0xFFF2 USART 0
    Receive /
  • WDT_VECTOR (10 2u) / 0xFFF4 Watchdog Timer /
  • COMPARATORA_VECTOR (11 2u) / 0xFFF6 Comparator
    A /
  • TIMERB1_VECTOR (12 2u) / 0xFFF8 Timer B CC1-2,
    TB /
  • TIMERB0_VECTOR (13 2u) / 0xFFFA Timer B CC0 /
  • NMI_VECTOR (14 2u) / 0xFFFC Non-maskae /
  • RESET_VECTOR (15 2u) / 0xFFFE Reset Highest
    Priority /

15
  • 5??????
  • ????????????????????(???????????)
  • ??????????????
  • 1)430???????????,?????????,????????????????
  • msp430????,_DINT()?_EINT()??????????
  • 2)??????????,????????????????,????????,???????????
    ??????????????
  • 3)????????A??????,??????????B(??B?????A????),B????
    ????A???????????B??????????,? ?B????????????C,???
    ??????,???????,??????,B????????????A???,????????
  • 4)??????????????,??????????,?????????,????????????
    ??????????!????????????
  • 5)??????,??????,????????????,??TA/TB??????/????,??
    ??TAIV/TBIV,?????????
  • ?????????????,??P1/P2???,??????????,????????"EINT
    ()"???,????????????,?? ??????????,???????????,???
    ??????????????????.

16
  • 6?????????(????)
  • void interrupt_initial()
  • P1DIRBIT7 //P1.7???
  • P1IE0x80 //P1.7????
  • P1IES0x00 //P1.7?????
  • P1IFG0 //P1.7??????,???????????????????
  • _EINT() //?????
  • pragma vectorPORT1_VECTOR
  • __interrupt void Port_1(void)
  • P1IFGBIT7 //P1.7??????
  • /??????????/

17
4???
  • ?????????
  • 1?????????????????????,CPU?????,??
  • ?CPU????,???????????
  • 2????????????????????????????,???
  • ?????
  • ?????????
  • 1????????
  • 2????A?
  • 3????B?
  • 4?????RTC?

18
  • ??Timer_A?????
  • 1?????????????
  • 2?????????PWM????????????
  • 3????????
  • 4?8??????
  • 5?16?????
  • 6????PWM???????????????,?PWM?????????????,Timer_A
    ?????PWM,???????????PWM????
  • ??????????
  • 1?????????????,??????,???????????????????????????
    ??????,????????????????
  • 2????????/?????CCR0??Timer_A???????????,??CCR0?16
    ????,??????????????65536???????????TAR??????CCR0??
    ,?????CCR0?????,?????,??0???????

19

?????
??
void zengjishu() TACTLTASSEL1TACLR
//???????ACLK,????TAR?? CCTL0CCIE
//???? CCR0200 //????,?????32768/2
00/2 TACTLMC_1 //??Timer_A??????
P1DIRBIT0 //P1.0???? _EINT()
//????? pragma vertor TIMERA0_VECTOR __i
nterrupt void Timer_A(void) P1OUT0X01
//P1.0??
20
  • 3???????
  • ??????0????0XFFFF?????0????,???CCR0?????(???????
    ??)

21
  • ??
  • void lianxujishu()
  • TACTLTASSEL_1TACLR //???????ACLK,????TAR??
  • CCTL0CCIE //????
  • CCR01000 //????,?????32768/1000/2
  • TACTLMC_2 //??Timer_A???????
  • P1DIRBIT0 //P1.0????
  • _EINT() //?????
  • pragma vertor TIMERA0_VECTOR
  • __interrupt void Timer_A(void)
  • P1OUT0X01 //P1.0??
  • CCR01000

22
  • 4??/??????????????????/?????,????,???????CCR0??,?
    ???????0?
  • ????TAR???CCR01????CCR0?,????CCIFG0??,?1????
    0?,????TAIFG??

23
  • 5???/????
  • ??????
  • 1????????/???????CCTLx??CAP1?,???????
    ???????????????????????,?TAR???????????/?????CCRx?
    ?
  • ??1??????????????
  • 2???????????
  • 3??????
  • 2????????/???????CCTLx??CAP0?,???????????Ti
    mer_A ?????/???,???????8?????

24
5?A/D
  • ??msp430f449???A/D?????
  • 1? 12??????
  • 2???????????,????????
  • 3???8??????4??????
  • 4???????,??????Vref?6????
  • 5??????,??200Ks/s?
  • 6???????
  • 1??????????
    CONSEQ_0?
  • 2??????????
    CONSEQ_2?
  • 3???????????CONSEQ_1
    ?
  • 4???????????CONSEQ_3
    ?
  • ??ADC12?????

25
(No Transcript)
26
  • ??A/D???????
  • 1???????
  • P6SEL0x01 //??A/D??A0(P6.0)
  • P6SELBIT7 //??A/D??A7(P6.7)
  • 2???ADC12??,??????,????
  • ADC12CTL0ADC12ON //??ADC12??
  • ADC12CTL0SHT0_0 //???????4/200KHZ1
  • ADC12CTL0REFON //?????????2.5V
  • ADC12CTL0MSC //????/???
  • 3???????,??????
  • ADC12CTL1SHP //????SAMPCON???????
  • ADC12CTL1ADC12SSEL_0
    //??????ADC12OSC?200KHZ
  • ADC12CTL1CONSEQ_2//?????????
  • 4?????(?????)
  • ADC12CTL0ENC //????

27
  • ???MSC1?SHP1?,??????SHI???????????
    ??,??????????????????????
  • 5?????
  • ADC12CTL0ADC12SC //????
  • ??????????
  • 1????????
  • void ADC_convert()
  • P6SEL0x01 //??A/D??A0(P6.0)
  • ADC12CTL0ADC12ON SHT0_0
    //?ADC12??,???????4200KHZ1
  • ADC12CTL1SHP //????SAMPCON???????
  • ADC12CTL0ENC //????
  • ADC12CTL0ADC12SC //????
  • int Read_result()
  • int result
  • result ADC12MEM0
  • return (result)

28
  • 2????????
  • Void ADC_convert()
  • P6SEL0x02 //??A/D??A1
  • ADC12CTL0ADC12ONSHT0_8MSC
    //??ADC12??,?????????,???????4mclk64,?????????2.
    5v
  • ADC12CTL1SHPADC12SSEL_2CONSEQ_2
    //????????????????????????????????
  • ADC12CTL0ENC //????
  • ADC12CTL0ADC12SC //????
  • int Read_result()
  • int result
  • result ADC12MEM1
  • return (result)

29
  • 3?????????
  • void ADC_convert()
  • P6SEL0x0f
  • ADC12MCTL0SREF_0INCH_0
  • ADC12MCTL1SREF_0INCH_1
  • ADC12MCTL2SREF_0INCH_2
  • ADC12MCTL3SREF_0INCH_3EOS
    //EOS???????
  • ADC12CTL0ADC12ONMSC SHT0_0
    //?ADC12??,???????4200KHZ1
  • ADC12CTL1SHPCONSEQ_1 //????SAMPCON???????
  • ADC12CTL0ENC //????
  • ADC12CTL0ADC12SC //????
  • _EINT() //???
  • pragma vectorADC_VECTOR
  • __interrupt void ADC12ISR(void)
  • result0 ADC12MEM0
  • result1 ADC12MEM1

30
  • 4?????????
  • void ADC_convert()
  • P6SEL0x0f
  • ADC12MCTL0SREF_0INCH_0
  • ADC12MCTL1SREF_0INCH_1
  • ADC12MCTL2SREF_0INCH_2
  • ADC12MCTL3SREF_0INCH_3EOS
    //EOS???????
  • ADC12CTL0ADC12ONMSC SHT0_0
    //?ADC12??,???????4200KHZ1
  • ADC12CTL1SHPCONSEQ_3 //????SAMPCON???????
  • ADC12CTL0ENC //????
  • ADC12CTL0ADC12SC //????
  • _EINT() //???
  • pragma vectorADC_VECTOR
  • __interrupt void ADC12ISR(void)
  • result0 ADC12MEM0
  • result1 ADC12MEM1

31
6?USART
  • ?????????????????,?????????????????
    ???????????,msp430f449????????USART0?U
    SART1
  • ????P2.4?P2.5?P4.0?P4.1????
    UART?????SPI?????
  • ?????????????
  • 1????????????????????
  • 2???7??8???,???????????????
  • 3???????????????
  • 4????????????
  • 5?????????????????????
  • ??USART?????

32
(No Transcript)
33
  • ???????????(???)
  • 1???????(USART0?USART1)?
  • USART1 P4SEL0X03
  • P4DIR0X01
    //P4.0???TXD,P4.1???RXD
  • 2??SWRST1?,?????
  • U1CTLSWRST //
    ??USART,?????
  • 3????????????
  • UTCTL1SSEL1 //UCLKMCLK
  • 4?????????
  • ME2UTXE1URXE1 //??RXD TXD
  • 5????????
  • U1CTLCHAR
    //???????8?,????7?
  • 6??????? ?UBRU1BR0U1BR1 ?????3
  • U1BR00X1B
    //??????????????????
  • U1BR10X00
    //??????????????????
  • U1MCTL0X03 //??????38400
  • 7?SWRST0,???????
  • U1CTLSWRST
    //?SWRST?1??????
  • 8??????

34
7?PWM?
  • ??Timer_A????????PWM??
  • void PWM_Creat(int a,int b)
  • TACTLTASSEL_1TACLRID_3 //???????ACLK,???8??
    ,????TAR??
  • CCR0255 //????,?????32768/256/8/2
    8HZ
  • CCTL1OUTMOD_7
  • CCR1a //????a/256
  • CCTL2OUTMOD_7
  • CCR2b //????b/256
  • P1DIRBIT2 //CCR1
  • P1SELBIT2
  • P2DIRBIT0 //CCR2
  • P2SELBIT0
  • TACTLMC_1 //??Timer_A??????

35
???????????
36
8????
  • ???????????
  • 1?ifndef _ADC_H
  • define _ADC_H
  • extern void ADC_convert()
  • extern int Read_result()
  • endif
  • 2?????????.C??

37
msp430launchpad
  • Msp430g2553??
  • 1??????1.83.6V
  • 2?????
  • ????280UA(1MHZ,2.2V)
  • ???? 0.5UA
  • ???? (RAM????)0.1UA
  • 3??5?????
  • 4???????????????1us
  • 5?10?A/D??? (????????????,?????200Ks/s)
  • 6?16???????(RISC),6.25ns????
  • 7???3???/??????16????
  • 8??????????UART/SPI/I2C????
  • 9????????,?????????
  • 11?FLASH????16KB,RAM?512B

38
Msp430g2553???
39
Msp430g2553
  • 1?IO?
  • 2???
  • 3???
  • 4???
  • 5?AD
  • 6?PWM?

40
1?IO
  • ??P??????
  • 1??P1?P2????????IO??
  • 2???P??????????????
  • 3??P?????????????????
  • 4????P?????????????????
  • ??P?? ????
  • ???msp430f449??,????P2.6?P2.7????IO??,??
    ??????
  • P2SEL(BIT6BIT7)

41
??IO????
42
2???
  • ?????
  • 1?ACLK??????,?? LFXT1CLK ?32768HZ?
  • 2?MCLK?????,???5???
  • 1?32768HZ,??ACLK?
  • 2?1MHZ BCSCTL1
    CALBC1_1MHZ
  • DCOCTL
    CALDCO_1MHZ
  • 3?8MHZ BCSCTL1
    CALBC1_8MHZ
  • DCOCTL
    CALDCO_8MHZ
  • 4?12MHZ BCSCTL1
    CALBC1_12MHZ

  • DCOCTL CALDCO_12MHZ
  • 5?16MHZ BCSCTL1
    CALBC1_16MHZ

  • DCOCTL CALDCO_16MHZ
  • 3?SMCLK?????,???16MHZ?

43
???????
44
3???
  • ????????msp430f449???
  • ????
  • void interrupt_initial()
  • P1DIRBIT7 //P1.7???
  • P1SELBIT7
  • P1IEBIT7 //P1.7????
  • P1IES0x80 //P1.7?????
  • P1IFG0 //P1.7??????,???????????????????
  • P1DIRBIT6
  • P1OUTBIT6
  • _EINT() //?????
  • pragma vectorPORT1_VECTOR
  • __interrupt void Port_1(void)
  • P1IFGBIT7 //P1.7??????
  • P1OUTBIT6 //????

45
4???
  • ????????msp430f449???
  • ????
  • void zengjishu()
  • TACTLTASSEL_2TACLRID_3 //???????MCLK,???8??
    ,????TAR??
  • CCTL0CCIE //????
  • CCR065535 //????,?????1048576/6553
    6/8/21HZ
  • TACTLMC_1 //??Timer_A??????
  • P1DIRBIT0 //P1.0????
  • _EINT() //?????
  • pragma vector TIMER0_A0_VECTOR
  • __interrupt void Timer_A(void)
  • P1OUTBIT0 //P1.0??

46
5?A/D
  • ??????
  • 1? 10??????
  • 2???????????,????????
  • 3???6??????2??????
  • 4???????,??????Vref?8????
  • 5??????,??200Ks/s?
  • 6???????
  • 1??????????
    CONSEQ_0?
  • 2??????????
    CONSEQ_2?
  • 3???????????CONSEQ_1
    ?
  • 4???????????CONSEQ_3
    ?

47
??A/D???
48
  • ????
  • void ADC_convert()
  • P1SEL0x20 //??A/D??A5
  • ADC10CTL0 ADC10SHT_1 ADC10ONSREF_1REF2_5VR
    EFONMSC // ??ADC10??,???????8ADC10OSC/2,???????
    ??2.5v
  • ADC10CTL1 INCH_5ADC10DIV_1CONSEQ_2 //
    input A5??????????A5?P1.5,????????????,?????2
  • ADC10AE0 BIT5 // ?P1.5??AD??????
  • ADC10CTL0ENC //????
  • ADC10CTL0ADC10SC //????
  • int Read_result()
  • int result
  • result ADC10MEM
  • return (result)

49
6?PWM?
  • ????
  • void PWM_Creat(int a,int b)
  • TACTLTASSEL_2TACLRID_3 //???????MCLK,???8??
    ,????TAR??
  • CCR065535 //????,?????1048576/6553
    6/8/21HZ
  • CCTL1OUTMOD_7
  • CCR1a //????a/65536
  • CCTL2OUTMOD_7
  • CCR2b //????b/65536
  • P1DIRBIT2 //CCR1
  • P1SELBIT2
  • P1DIRBIT7 //CCR2
  • P1SELBIT7
  • TACTLMC_1 //??Timer_A??????
Write a Comment
User Comments (0)
About PowerShow.com