- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.. Can anyone guide me in creating a state machine for LCD controller. Input is keyboard, and when a key is pressed it is shown on LCD, and the next key pressed is shown on LCD next to the first key pressed. This is what I got so far, but this one doesn't work properly. What is essential for building a FSM for this purpose?
Im using DE2 and Quartus. type statetype is (POS0, POS1, POS2, POS3, POS4, POS5, POS6, POS7, POS8, POS9, POS10, POS11, POS12, POS13, POS14, POS15); signal statepos, nextstate: statetype; process(clk, wEn) variable count : integer range 0 to 3; begin if (clk'event and clk='1') then if (wEn='1') then count := count + 1; if (count = 3) then statepos <= nextstate; count := 0; end if; end if; end if; end process; -- next state logic process (statepos, lcdcharcode) begin case statepos is when POS0 => charRAM(0) <= lcdcharcode; nextstate <= POS1; when POS1 => charRAM(1) <= lcdcharcode; nextstate <= POS2; when POS2 => charRAM(2) <= lcdcharcode; nextstate <= POS3; when POS3 => charRAM(3) <= lcdcharcode; nextstate <= POS4; when POS4 => charRAM(4) <= lcdcharcode; nextstate <= POS5; when POS5 => charRAM(5) <= lcdcharcode; nextstate <= POS6; when POS6 => charRAM(6) <= lcdcharcode; nextstate <= POS7; when POS7 => charRAM(7) <= lcdcharcode; nextstate <= POS8; when POS8 => charRAM(8) <= lcdcharcode; nextstate <= POS9; when POS9 => charRAM(9) <= lcdcharcode; nextstate <= POS10; when POS10 => charRAM(10) <= lcdcharcode; nextstate <= POS11; when POS11 => charRAM(11) <= lcdcharcode; nextstate <= POS12; when POS12 => charRAM(12) <= lcdcharcode; nextstate <= POS13; when POS13 => charRAM(13) <= lcdcharcode; nextstate <= POS14; when POS14 => charRAM(14) <= lcdcharcode; nextstate <= POS15; when POS15 => charRAM(15) <= lcdcharcode; nextstate <= POS0; when others => nextstate <= POS0; end case; end process;Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please do net multipost your question.
I don't see any key input in your module. Besides, the code could be replaced by a simple counter. Do you really need to store all characters in a RAM? What kind of LCD is it?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page