• CES
  • AMARTS
  • Electronic Kid
  • Useful-news
  • Forum
  • Fellowship
  • E-Library
  • All
gravatar

Module HC-SR04 module

To fit this microprocessor But I do Mini Project Micro controller.
I removed the old, yea I remember PIC16F688 buy from this site for so long I do not remember who it was sold.
At first, the MCS-51 is available now. I see another problem that I do not make that mistake a new Display.

The program uses the Interrupt External Interrupt both the rising edge and falling edges of each mode is available.
Will be obvious from the code that I wrote it straight #INT_EXT it.
When we entered Trig Module HC-SR04 module to give pulse out a relationship with the distance from the solution.

S = Time pulse on * 340/2 M.

When Timer pulse on time is read from one of the Echo module.
340 is the speed of sound, Adjust accordingly
S is the distance in meters.
The code I wrote is not a word of the above equation, MCU work because I will not make the least amount of money and then some.
By the time I read the value from the variable must calculate the amount of time it really is.

OSC = 8MHz
Timer 1 Prescell = 1

Therefore, we have

time = timer 1 value / (OSC / 4) Sec.
         = Timer 1 value / 2000000 Sec.

When I was arrested, MCU Pulse Echo legs, I would have taken the time to actually contribute to the measured distance by the time that is the time.
I read from the Echo has not been evaluated in real time. When I put the equation together and you have that.

S = (time / 2000000) * (340/2) * 100 CM.
    = Time * 0.0085 CM. (Which I want another one decimal point. The program is actually written into it by 10 again.
                                      And I mean it does not match up with the speed of sound to tell me).

The rest of you, but I'll have to show me. I took up the LCD with BIG Numer Graphic.
Your JENG made ​​so long as it still works well.

The result was about it.










Source here