Jump to content
43oh

itselbert

Members
  • Content Count

    8
  • Joined

  • Last visited

  1. Ah nice, thanks for linking that to me. I got a better understanding now. Cheers.
  2. I took a look at that, but I don't really understand it. I am using C, not assembly. When I read that, the pdf only says that the comp_a is used for detecting the echo. From what I understand so far, the comp_a receives a signal from the rx transducer as 1 sample as well as the original signal. What I dont understand is how it works out that the rx signal is an echo. I am thinking its something to do with the time difference between the rising edge of the original signal and the echo. I think it uses the count stored in CCR0 to calculate the distance. But this is just guess work and I am n
  3. Is there any chance someone can explain how I am meant to use the comp_a to detect the echo used to calculate the distance? I am having trouble figuring out how it works, so I can't even attempt to code it.
  4. The comp_A as of yet doesn't make much sense to me. Instead I've been working on this: #include #define RLY1 BIT6; // Global Variables char i=0; void CAinit(void); // Function Definitions void main(void) { WDTCTL = WDTPW + WDTHOLD; // disable watchdog P1OUT = 0; //P1DIR = RLY1; // P1.6 out to relay (LED) P1DIR |= BIT6; P1SEL |= BIT6; P1DIR |= BIT0; BCSCTL1 = CALBC1_8MHZ; // Set DCO to calibrated 1 MHz. DCOCTL = CALDCO_8MHZ; TACCR0 = 198; // A period of 62,500 cycles is 0 to 62,499. TACCTL0 = CCIE; // Enable interrupts for CCR0. TACCTL1
  5. Hey Bluehash/rick I managed to generate the 40 kHz signal. I am using the following code: WDTCTL = WDTPW + WDTHOLD; //P1DIR |= 0x01; //P1DIR |= 0x40; //P1OUT = 0x00; P1DIR |= BIT6; P1SEL |= BIT6; BCSCTL1 = CALBC1_8MHZ; // Set range DCOCTL = CALDCO_8MHZ; // Set DCO step + modulation */ CCR0 = 198; // for this, it gives me 40 kHz exactly CCTL1 = OUTMOD_7; CCR1 = 50; TACTL = TASSEL_2 +MC_1; _BIS_SR(LPM0_bits); How do I connect this to Comp_A? I had a look at the 3 examples but they only explain the function
  6. Hey guys, thanks for the replies. Well looking at NJC's blog page I did get it to work somewhat using the code on the page. I actually need to test it later. I was just wondering about CCR0 and CCR1. For CCR0 what exaclty is data type used for it? because CCSv4 was complaining that the number was large and it was being truncated and also is its function to divide the DCO frequency? so CCR0 = 1000 means 1MHz/1000 ? Alternatively using grace I did manage to set it to 40 kHz using one of the grace examples. Now my question is how would I proceed to use it with comp_A?
  7. Hi everyone, I literally just got the launchpad and I am hoping to use it to design an ultrasonic range finder. I've been doing some reading and I know that I need a MCU with Comp_A, so I've gotten myself some MSP430G2452 to start it all. Now the thing is I basically have no experience using microcontrollers and pretty light with coding in C, so when I read some of the documentation I am finding myself confused about alot of things. What I'm hoping to find out is how to generate a 40 kHz square wave with the DCO rather than the crystal and how to use the comp_A peripheral to calculate the
  8. Hello to everyone at 43oh! I just got the launchpad this week and I am looking forward to learning from you guys. Cheers, Elbert
×
×
  • Create New...