Let's Make Robots!

HCSR 04 Ultrasonic Sensor Problem

Hi I write a code. But it didnt work. Led is burning and burning out not with range.

Where is the problem

#include "msp430g2452.h"
#define tr BIT0
#define ec BIT1
#define led BIT6
int range=0;
void main( void )
       WDTCTL = WDTPW + WDTHOLD; //watchdog stop
       DCOCTL=CALDCO_1MHZ;  //frequency setup
        P1DIR = tr+led;
        P1OUT=0x00;   //all are zero
     P1OUT^=tr;                       //Trigger is on for 10 us
     range++;            //when echo coming range is increasing
   __delay_cycles(1000000);    //waiting some