LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edge detection in HDL Node

Solved!
Go to solution

I have used an HDL node to interface a vhdl code in labview. The code simply should turn an led 'on' and 'off' when a Push button is pressed or relased, respectively. But when i run the code, the LED remains off despite of pressing push button or not. 

I am not good in VHDL programmin but I need to demonstrate how to use VHDL node to my presentation. Can someone help me with detecting edge of push button ( or latch when released correspondingly). ?

 

I'm using sb-RIO and Labview FPGA module 8.6.


0 Kudos
Message 1 of 13
(3,512 Views)

hi

try use labview 2012 its best than old version for hdl node

 

 

 

 

regards

m.s

 

 

 

 

hi ?Q>

0 Kudos
Message 2 of 13
(3,505 Views)

Hello NapDynamite,

 

Can you verify that the VHDL code works in another environment other than LabVIEW? This can help us verifying if there is a problem on the code itself, or on the HDL Interface Node / LabVIEW code. Do you mind posting your code so I can take a look? I'll try to use LabVIEW 2012 SP1 for this, as I don't have LabVIEW 8.6.

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 3 of 13
(3,470 Views)

(entity defined correctly, the signal X here is a push button of labview i.e latch when released). Works fine with simple button (switch when pressed) but does not work with PUSH BUTTON. LED remains off. Tried same code in spartan FPGA board and worked. 

 

process( clk, reset )
  begin
    if( reset = '1' ) then
      result <= (others=>'0');
      enable_out <= '0';
    elsif rising_edge(clk) then
      result <= x; -- result and enable_out follow input by 1 clock cycle
      if( enable_clr = '1' ) then
        enable_out <= '0';
      elsif( enable_in = '1' ) then
        enable_out <= '1';
      end if;
    end if;
end process;


0 Kudos
Message 4 of 13
(3,456 Views)

Could you upload the whole code with the headers? I don't know much about VHDL and I'm going to try to reproduce it on my end. However, I'll have to use the IP Integration Node, as the HDL Integration node is no longer supported as of LabVIEW FPGA 2010. 

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 5 of 13
(3,444 Views)

To be honest, the first thing I would check would be your hardware. Are you certain you didn't leave the switch floating? Also, go ahead and through up the rest of your code.

0 Kudos
Message 6 of 13
(3,437 Views)

library ieee;

use ieee.std_logic_1164.all;

 

 entity simple_led is

port (

clk, reset: in std_logic;

enable_in: in std_logic;

enable_out: out std_logic;

 

);

end simple_led;

 

architecture simple of simple_led is

 

process( clk, reset )
    begin
       if( reset = '1' ) then
       result <= (others=>'0');
    elsif rising_edge(clk) then
       if enable_in = '1' then -- use enable_in as a clock enable
          result <= x ; -- result follows the inputs by one clock cycle
       end if;
    end if;
end process;
enable_out <= enable_in;


0 Kudos
Message 7 of 13
(3,425 Views)

By the way, I just want any VHDL code inside HDL node to accept signals coming from push button. I tried doing the same thing by using LABVIEW blocks and functions and used boolean crossing to detect edge of signal coming from push button ( Also tried it with HDL node). 
But my VHDL code failed to do so. Either I need some routine in VHDL code which detects the edge, or some labview trick outside the HDL node that can help me out.

 

 


0 Kudos
Message 8 of 13
(3,424 Views)

Hello,

 

So there appears to be some syntax errors on your code. Initially you need to remove the ; from line 8 on enable_out: out std_logic;

Next, you the IP Integration node is complaining that you have an unexpected process on line 15 process( clk, reset ). Apparently, you have to use begin before AND process. Anyways, I don't know why you have to use sequential logic. You can have an LED light up as long as you push the button without using a clock. Just assign the output the value of the input, and that's it, put that in a loop, and that's it.

This code worked just fine for me, again, using the IP Integration Node.

 

library ieee;
use ieee.std_logic_1164.all;

entity simple_led is
port (
enable_in: in std_logic;
enable_out: out std_logic

);
end simple_led;

architecture simple of simple_led is
begin
process(enable_in) begin
enable_out <= enable_in;
end process;
end simple;

 

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 9 of 13
(3,415 Views)

This code is just a little part of FSM for vending machine. I can make SM for vending machine in labview in 5 minutes. But it will take me forever to write a VHDL code for same. 
Only part that creating problems is push button. Not able to detect edge. 


0 Kudos
Message 10 of 13
(3,403 Views)