Jump to content
43oh

flek12345

Members
  • Content Count

    4
  • Joined

  • Last visited

  1. Well... I think I am using similar configuration. I connected: HC-SR04 pin named "Vcc" to Stellaris board pin named "VBUS" HC-SR04 pin named "Trig" to Stellaris board pin named "PE4" HC-SR04 pin named "Echo" to Stellaris board pin named "PF4" HC-SR04 pin named "Gnd" to Stellaris board pin named "GND" And it works... I think, GPIO E4 has level of 3.3V. And it seems is enough to trigger measurement. Also, "Echo" is correctly recognized on pin F4. It seems 5.0 V it is not too much for GPIO. I am also novice in this area. Maybe some expert should give us advice (commen
  2. Finally, I managed to get some results... There is a problem in counting direction. I thought that I set up timer to count down. TIMER0_TAMR_R = 0x00000002; // 3) configure for periodic mode, default down-count settings But timer is counting UP. I debug it, and I see that endTick is bigger than startTick. When I calculate in this way: deltaTick = endTick - startTick; I get correct result. But, I still do not understand why timer is counting up. I thought that bit 4 (TACDIR) is defining counting direction. And in my setup it is 0. And documentation said "0
  3. @L.R.A. I will take a look at your code. @@igor I am new with Tiva... So, where can I find those library? Although, for my project (HC-SR04), whole code has less than 100 lines.... Concerning "The comments do not match the code (e.g. talks about Timer 2A, but appears to be operating on Timer0?)" Yes. You are right. I copied code from my old project where I used timer2. I will add some (us) delay between timer reset and reading it's value. Generaly, pulses will not be the same. I want to measure any distance. @@BizzaBoy I read your post before (when I was googl
  4. I am using Tiva. TM4C123GXL. On a pin F4, there is connected external device which generates pulse (HC-SR04). I want to measure that pulse width. My idea is: When pulse arrives (transition high-to-low), I will start a timer. And it will count down. I know that maximal pulse width is 23 milliseconds (so I put 100 ms in timer). When pulse is over (transition low-to-high), I will read timer value. Defeerence between those 2 ticks, I will multiply by system frequency (50 MHz). And it will be my pulse width. Right? But, whatever I do, I got pulse width equal to 99 milliseconds. (With
×
×
  • Create New...