This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SRF05 + TM4C123G + System Tick



Hi all,
Can you show me how to control sonar sensor SRF05 by using System Tick? I have found many references and sample code of other microcontrollers. However, It is quite hard for me to understand due to the fact that I'm a newbie.
I'm using CCS and Tivaware.
Thanks for your help.

  • Hello Bao,

    Let's get to -101- How is SRF05 controlled? How is the data acquisition performed? (I can answer both the questions but helping you build the answer would help you in the long run)

    Regards
    Amit
  • Hi Amit,

    The SRF05 is a sonar. You give him a signal to start raging through a digital output (trigger pin) and receive a echo in another pin (echo pin). That signal returned is a modulated wave, the width of the positive side gives you the distance measured.
    We discussed something similar before, I have a very crude example to use that sensor and you said it would be much better to use a timer in capture mode (it was about a user wanting to use multiple sensors like this one).

    Hi Bao,

    First, don't use the systick. You have just one like that and it's more specific to just count time, it's kinda of a waste to use it when you have so many general purpose timers with more functions.
    You can check out this example here, it has what you want to achieve but it uses a General Purpose Timer:
    sites.google.com/.../timer-periodic-mode---srf04

    You can try it out since you are learning. But after that you should do better. That example is pretty crude. The timers have various modes, one is the time capture mode. That mode is perfect for reading the signal from the sensor. You should look into that and try to execute it.


    Also to note, it's good to learn how to post. Good info is key. You could for example linked to the SRF05 behavior or try to explain what you needed to do (register a pulse width).

    edit:
    Btw, that sonar, srf05 differs from the srf04 in which it has an optional single wire interface. Don't use it. At least for now. after you feel more confident in using the SRF05 with the 2 wire interface (like the srf04) then try to implement the 1 wire interface

  • Thanks all for your help and suggestion.
    I will try to do something and ask you later. Thanks again.