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.

CCS/LAUNCHXL2-RM46: Edge detection or input capture help.

Part Number: LAUNCHXL2-RM46
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hello everybody,

I really like to program and learn to program and I'm very new at this.

I'm trying to make a ultrasonic sensor HC-SR04 work with my launchpadxl2 rm46.

The sensor work with 5v but that is not a problem, I use a Bi-Directional LLC to not fry my input pins on the controller.

The ultrasonic sensor have two control pins, one trigger and one echo pin.

In order to generate the ultrasound you need to set the Trig on a High State for 10 µs. That will send out an 8 cycle sonic burst which will travel at the speed sound and it will be received in the Echo pin. The Echo pin will output the time in microseconds the sound wave traveled.

howtomechatronics.com/.../Ultrasonic-Sensor-Diagram.png

So i'm trying to use a PWM signal from the controller and use edge capture to see for how long the ultrasound burst travel, to calculate the distance.

I will put some photos with my code and my halcogen config. So far I haveno results and if anyone can help me understand how the n2het works will be great. I dont know if I read the right register or if I made the right config.

  • Hello,

    You can use 1 PWM t trig the sensor, and use one pin to capture the period of the input pulse. There is a tool called HET IDE which is a windows based application that provides an easy way to get started developing and debugging code for the HET.  It can be used to simulate PWM and capture.

    The IDE has many examples for PWM output and input capture.

  • Thank you, this is exactly what i'm trying to do. But how will my n2het driver will behave if I modifty the assembly code. Halcogen will no longer configure it.Only the code I wrote right?