Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Thank you for your interest.I intend to add one other thing. however, when I delete the 2 lines (P1IE|=echo; P1IFG&=~echo;) it's still not running
  2. Hi everyone. I have a problem with my code. When I do each part. It works. But when i do them together. They don't work. I don't know why. Could anyone explain to me why it does not work. Thanks so much. Part 1. I measure distance by SRF05. This is my code: #include <msp430g2553.h> #define trigger BIT1; #define echo BIT2; unsigned int RisingEdge; unsigned int FallingEdge; unsigned int PulseTimes; unsigned short First; unsigned int distance; void timer_init(void); void do_khoang_cach(void); void main(void) { WDTCTL = WDTPW | WDTHOLD; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CAL
  3. hello everyone, I use P1.5 (timer 0.0) in msp430 launchpad with msp430g2553 for capture mode. but it seems wrong somewhere. it does not work. can anyone show me why it does not work correctly #include <msp430g2553.h> #include "uart.h" #define trigger BIT4; #define echo BIT5; void timer_init(void); void do_khoang_cach(void); unsigned int t1=0, t2=0, delta=0, first_pulse=0; void main(void) { WDTCTL = WDTPW | WDTHOLD; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; P1DIR |= trigger; P1SEL |= echo; uart_init(); timer_init(); _BIS_SR(GIE); while (1) { do_khoang_
  • Create New...