i want use timer in msp430G2553..

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by yogeshnand on Thu, 03/17/2016 - 15:22 

 

vissim embedded 9.0

i want to calculate time like for ultrasonic sensor.the time between transmitter( triggering) and receiver(Echo). how do i use it.please tell me

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by Sreeram_Mohan_Altair on Fri, 03/18/2016 - 16:14.

    Hi Yogesh,

    Could you provide more details of the sensor that you are talking about ?

    If you just want to send out an IO pulse high and wait for IO on the other and clock it you should atleast start looking at : 1) Setup a GPIO to be high or any pattern according to the transmitter requirement. 2) Configure the GPIO read to be on an interrupt and this interrupt can be used on a compound and perform any operation needed.

    I would recommend you send us more details and may be we can understand better on what is needed !

    --sreeram

    Sreeram Mohan

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by yogeshnand on Sat, 03/19/2016 - 11:39.

    i am using ultrasonic sensor HC-sr402 for object detection.so i will give 10usec pulse for triggering(input to sensor) if there is object then echo will receive on GPIO(output of sensor) . i want to calculate the time between triggering and Echo(High) received. thanking you...

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by Sreeram_Mohan_Altair on Sun, 03/20/2016 - 02:26.

    Hi yogesh,

    A simple way I suggest you could achieve this is through using a cross detect block and a pulse counter. Please find attached a simple diagram that does the same on an input square wave. Please replace the square wave with the input signal and you should be able to count the number of pulses and in turn derive the distance.

    Hope this is helpful.

    -sreeram

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by Sreeram_Mohan_Altair on Fri, 03/18/2016 - 16:14.

    Hi Yogesh,

    Could you provide more details of the sensor that you are talking about ?

    If you just want to send out an IO pulse high and wait for IO on the other and clock it you should atleast start looking at : 1) Setup a GPIO to be high or any pattern according to the transmitter requirement. 2) Configure the GPIO read to be on an interrupt and this interrupt can be used on a compound and perform any operation needed.

    I would recommend you send us more details and may be we can understand better on what is needed !

    --sreeram

    Sreeram Mohan

     

    Submitted by Sreeram_Mohan_Altair on Sun, 03/20/2016 - 02:26.

    Hi yogesh,

    A simple way I suggest you could achieve this is through using a cross detect block and a pulse counter. Please find attached a simple diagram that does the same on an input square wave. Please replace the square wave with the input signal and you should be able to count the number of pulses and in turn derive the distance.

    Hope this is helpful.

    -sreeram

    HI SIR ,

    i want to reset this counter afetrer some interval of time. i tried it . but it reset but again it not start from zero value . please look over the attached program.

    thanking you

    yogesh

    Unable to find an attachment - read this blog