Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Sensor reading with nexys2 board

Status
Not open for further replies.

xilinx1001

Member level 3
Member level 3
Joined
Apr 3, 2013
Messages
60
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,781
Hi,

I need to measure the distance using range sensor. I need to trigger the sensor using nexys2 board.
The sensor is triggered by generating pulse from nexys2 board. Then the sensor generates the echo to measure the distance of the object.
When the object is detected the echo automatically becomes zero.

I am generating the trigger using the following code and it will automatically generates echo

Code:
code:
process(clk) 


begin	
  if(clk'event and clk = '1') then   
        
   if(count <= "000000000001001011000"  ) then
    trg <= '1';
	   count <=count+"0000000000000000000001" ;
   else	
    trg <= '0';
	 count <=count+"0000000000000000000001" ;
	 
	 if (count ="1001100010010110100000") then
			count<="0000000000000000000000";	

	end if;
  end if;
   end if;
end process;

How can I measure the distance using echo and how can I convert it to cm. The time period of each cycle is 20nsec. The distance is converted to cm using the following formula.


X in cm=(X in usec)/58;


How can I measure the distance in cm, the actual time period is in nano sec. I need to convert it by dividing by 1000 and then by 58 to convert it to cm.

How can I write the code for this. The symbol division(/) cannot be used in my current version of xilinx.



Regards
Vivek Alaparthi
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top