Need help with VHDL code for metal detector

OP #2703792
I am working on a metal detector at the moment but cant figure out how 
to implement it my VHDL code.
1
ENTITY sensor IS
2
     port ( metaldetector : in std_logic;
3
            metal : out std_logic;
4
          );
5
END ENTITY sensor;
As long as there isnt any metal close to the sensor 'metaldetector' gets 
pulses on a 6.1kHz frequency. So as long as the 'metaldetector' keeps 
getting pulses the out port 'metal' should be '0'.

When there is a pulse missing (or multiple pulses) 'metal' should become 
'1' until the next pulse.

It shouldnt be that hard to make a code that can do that, but i just 
cant figure it out. Any help would realy be great!
#2703833
You need a reference clock of some kind.

Then, implement a watchdog counter. If the counter is bigger than the 
required trigger value, stop counting and set metal = '1'. Restart the 
counter and set metal = '0' with each pulse you get.

As the reference clock is asynchronous (most probably) don't forget 
proper synchronisation.

Reply

A question of your own? This thread is over 14 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.