04-14-2013 12:47 PM
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.
Solved! Go to Solution.
04-14-2013 01:21 PM - edited 04-14-2013 01:26 PM
hi
try use labview 2012 its best than old version for hdl node
regards
m.s
04-15-2013 12:23 PM
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.
04-16-2013 11:40 AM
(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;
04-16-2013 03:37 PM
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.
04-16-2013 04:16 PM
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.
04-17-2013 10:04 AM
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;
04-17-2013 10:08 AM
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.
04-17-2013 04:20 PM
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;
04-18-2013 06:07 AM
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.