I am trying to tracing the signal at Schemetic Tracer in simvision(cadence).
But It's really hard to find for some signal which have direction.
Is there anyway to know the direction of port in Schemetic Tracer?
Yellow arrow on left of port name, pointing into box, input. Arrow on right of port name, output.
Related
New to VHDL, familiarizing myself with everything.
I got my FPGA to turn on an LED when the button is pressed (code below), but the button has to be held down for the LED to stay on. I would like the LED to turn and stay on when the button is pushed and released (and turned off when pressed again) but I'm confused on how this is done.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ButtonLED is Port (BUTTON: in STD_LOGIC:='1';
LED : out STD_LOGIC:='0');
end ButtonLED;
architecture Behavioral of ButtonLED is
begin
LED <= not BUTTON;
end Behavioral;
(Warning: I am not giving you the answer. I am only addressing your question on "how it is done")
The statement LED <= not BUTTON defines that the LED is directly connected to the BUTTON through an inverting element. Therefore, your LED will always follow the opposite current state of the BUTTON. If BUTTON is in high logic level, then LED will be set to a low logic level, and vice versa.
I would like the LED to turn and stay on when the button is pushed and released (and turned off when pressed again) but I'm confused on how this is done.
For implementing this feature you must be capable of (1) detecting whenever the button is pressed and released, and (2) to "save" the current state of your LED. Detecting the button "movement" is simply detecting a change in state from high to low, and low to high. As mentioned in the comments it is also important to insert a de-bouncer mechanism between your edge detector and the button. Since FPGA buttons are very sensitive, the de-bouncer will ensure that you won't interpret glitches/noises as an actual press. I advise you to check it out yourself, implementation a version with and without the de-bouncer. Depending on how you press your button you may see the LED toggling multiple times when your hardware doesn't filter the input.
Once you know how to detect when the button was pressed and released, you have to simply add a memory element that toggles every time your condition is met. Now, instead of using LED <= not BUTTON, you'll have an internal variable that will control the LED behavior (i.e., LED <= led_state). This internal variable can be controlled through a process that is sensitive to your edge detection "module". Moreover, this variable will ensure your LED state only changes when your condition is met (i.e., pressing and releasing the button), instead of following the BUTTON inverse state.
Hope this gives you a general overview of your solution.
I have the Xilinx Spartan6 and next VHDL code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity Switches_Leds is
Port (switch_0: in STD_LOGIC;
LED_0 : out STD_LOGIC);
end Switches_Leds;
architecture Behavioral of Switches_Leds is
begin
LED_0 <= switch_0;
end;
Here is my User constraint file:
NET "switch_0" LOC = C3;
NET "LED_0" LOC = P4;
My question is: Why the led is always is turned on, but it goes off if I click on button ?
I explain: I program my fpga - the led is turned on, I press the switch button - the led is turned off, I unpress the button - led goes on.
The inversion can happen in two places:
In the button.
In the LED.
It all depends on how they are connected. I made a diagram:
(Had to draw it as we do not have a schematic editor here as on the EE site)
If you look at the diagram: buttons can be connected in two ways. They can either generate a high when pushed or a low.
LEDs can also be connected in two ways: they can light up when the output is high or they can light up when the output is low.
That gives you four combinations from which two give an LED lighting up when the button is pushed and two give an LED which goes off when the button is pushed.
Is there any way to get mouse state (position, buttons states) using winapi in C++?
I don't want to use windows messages (WM_MOUSEMOVE, WM_LBUTTONDOWN, etc).
Thank you!
It sounds like you are looking for GetCursorInfo and GetKeyState. The latter you call with virtual key codes that specify the mouse button of interest.
If you only need cursor position, you can just use GetCursorPos(). Remember that both GetCursorInfo() and GetCursorPos() return screen coordinates. Use ScreenToClient() to convert to client area offsets.
Although the OP didn't want to use Windows Messages, I just wanted to mention something as a sidenote.
Something I found was that getting the cursor position as part of a message handler (for instance WM_SETCURSOR), most of the literature recommends using GetMessagePos() to retrieve the cursor's position at the time the message was sent. However, its the position before the mouse moved, not after. So the position returned 'lags' behind a pixel when trying to do mouseover detection over an area.
Right now I'm using the functions GetCaretPos() and GetGUIThreadInfo() to get the current keyboard cursor/caret coordinates. These work properly in applications like Notepad and Wordpad and return the correct coordinates, but in applications such as Firefox, Thunderbird, and others, the coordinates returned are always 0, 0, no matter where the keyboard cursor is.
I know it's not impossible to get the keyboard cursor/caret coordinates in these applications because when I use the Yahoo KeyKey IME in them, it pops-up a dialog right where the keyboard cursor is positioned.
Problem is, since KeyKey is not open source, I have no idea how it's doing it.
If anyone could point me in the right direction or knows the correct function(s) to use it'd be much appreciated!
Although I have a feeling that this isn't technically possible, it's worth asking anyways. Is it possible to turn on the Macbook Pro's keyboard backlights for individual keys? I am working on a piece of grid-based software which allows the user to navigate around by pressing any key on the keyboard to position the cursor at that point in the grid. It would be very cool if I could somehow just turn on the backlight for certain keys to give the user an easy way to see the current position of the cursor.
Is it even possible for an application to control the keyboard backlighting at all, let alone for individual keys?
Yes, on programs controlling the backlight.
iTunes visualizer that pusles keyboard backlighting to music:
http://www.youtube.com/watch?v=LUXLkwlF9e8
How to manually adjust (via plugin):
http://osxdaily.com/2006/11/30/how-to-manually-adjust-the-macbook-pro-keyboard-backlight/
Not sure on programs controlling individual keys, but as that would require additional hardware to be installed on Mac's part, i doubt it.
Well after trawling the webs, it looks like the answer to that is no. But I'd like to point out that each key does have its own key- a tiny little LED (same kind they use under phone keypad buttons). Also, I've seen some people saying that flashing these lights on and off repeatedly is bad for them. Bullshit- all digital electronics control light output from LED's by flashing on and off many many times a second. Read up on PWM on wikipedia or something..
Anyways just had to get that out there :)
Thanks,
Nic