怎样在这个让LED亮的代码里面控制亮的时间 还有怎么让LED交替亮
(MSP430g2553 Lauchpad,有两个LED)
代码是用CCSv5写的
- ;*******************************************************************************
- .cdecls C,LIST,"msp430g2553.h" ; Include device header file
- .text ; Place program in ROM (Flash)
- .global _main ; set entry point
- INIT_STACK: .set 0x400 ;0x400 = 0x03FE+2, 0x03FE = RAM BOTTOM
- _main:
- mov.w #INIT_STACK,SP ; initialize stack pointer 11
- StopWDT: mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT (Watch Dog Timer) 12
- SetupP1: bis.b #41h, &P1DIR ; Set Pin P1.0 and Pin P1.6 as output pins (P1.0 and
- ;P1.6 connected to LEDs)
- ; immediate mode, absolute mode
- ; 41 hex = 001000001 binary
- Mainloop: xor.b #41h, &P1OUT ; Toggle P1.0 and P1.6
- ; immediate mode, absolute mode
- ; 41 hex = 01000001 binary
- Wait: mov.w #65535, R15 ; Put delay in R15
- ; immediate mode, absolute mode
- L1: dec.w R15 ; Decrement R15
- jnz L1
- ; xor.b #40h, &P1OUT ; Delay over?
- jmp Mainloop ; Again
- ;Interrupt Vectors
- .sect ".reset" ; MSP430 RESET Vector
- .short _main
- .end
|