xilinx1001
Member level 3
- Joined
- Apr 3, 2013
- Messages
- 60
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,781
Hi,
I am measuring the distance using range sensor SRFO5.
The sensor is having the maximum range of 400 cm.
When I trigger the sensor, it releases echo signal which is used to measure the distance of the object.
The echo signal will become zero when the object is detected.
The counter value increments which measures the echo width and beccomes zero when the object is detected.
This counter value should be divided by 58 to convert it to cm.
For division I am multiplying with 3 and then right shift by 13 places which converts the value to cm.
I took only nine bits because the maximum range is 400 which can be represented in 9 bits
My professor told me that I need to consider MSB bits also. But I do not understand why I need to consider those bits
Regards
xilinx1001
I am measuring the distance using range sensor SRFO5.
The sensor is having the maximum range of 400 cm.
When I trigger the sensor, it releases echo signal which is used to measure the distance of the object.
The echo signal will become zero when the object is detected.
The counter value increments which measures the echo width and beccomes zero when the object is detected.
This counter value should be divided by 58 to convert it to cm.
For division I am multiplying with 3 and then right shift by 13 places which converts the value to cm.
Code:
code:
process(echo, clk)
begin
if clk'event and clk ='1' then
if echo = '1' then
range_cm <= count1(23 downto 0)* "11"; --measuring distance
input <=range_cm(21 downto 13); --
else
output <=input;
end if;
end if;
end process;
I took only nine bits because the maximum range is 400 which can be represented in 9 bits
My professor told me that I need to consider MSB bits also. But I do not understand why I need to consider those bits
Regards
xilinx1001