Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to clear the characters from the display

Status
Not open for further replies.

michalisce

Newbie level 3
Joined
Dec 22, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
Hello,
I am using Nexys 2 board and VHDL language, I've already designed the vga controller 640x480, the PS2 interface for the keyboard,i am using a RAM block with 12-bit address and 8-bit of data
and a font rom. I know that RAM does not support reset, i have a reset btn that resets the counters for the lines that i want to write the keyboard's characters. The problem is that by pressing the reset btn along with the counters i need to clear the previous characters from the display.

if i'am correct i need to send to the specific ram addresses the character 'space'.

...

Code VHDL - [expand]
1
2
3
ram_addr_2 <= (pixel_y(9 downto 4)) & (pixel_x(8 downto 3)); -- the address that goes to the ram block
                    
rom_addr_out <= char_addr & row_addr; -- the font's address


...

any ideas how to clear the line of characters by pressing the bnt?
thanx
 
Last edited by a moderator:

You will need to make the reset button action initialise the RAM to all zeros, or all spaces, or whatever. This might involve a state machine (or some extra states in your existing state machine) that counts through each RAM address and writes to it.
 
thank you for the replay,

I use a counter controller where i have 2 counters one each line. It starts and by pressing the enter key the counter changes to the 2nd line. i don't use state machine for the counters.

also i have the graphics module where all the garphics take place:

if i use a process :


Code VHDL - [expand]
1
2
3
4
process(counter_value,reset_btn,char_addr,row_addr)
   begin
      if counter_value = unsigned'("001010001000") then  --the counter is at line 10, position 8
           if reset_btn = '1' then


---ADVISE---
or this has to work along with the clk to do one at a time???

can you pls provide an example because I am really confused with this?

thanx
 
Last edited by a moderator:

How are you writing to the RAM at the moment? You could adapt that process to act when reset is pressed, rather than just when a PS/2 keyboard key is pressed, or whatever.

Remember that there's no general way to do this - anything we suggest without seeing your entire code base will probably be confusing. You really just want to add a new action that responds to the reset and proceeds to write spaces to the entire RAM, before returning to the normal behaviour.
 

thank you again,

this is the RAM counter controller state machine, I've manage to include backspace operation, it works. How can I modify this to match to what i need?


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
entity COUNT_RAM_CNTR is
    port ( clk : in std_logic;
             reset : in std_logic;
             kb_backspace : in std_logic;
             kb_data_ready : in std_logic;
             kb_ack : out std_logic;
             counter_inc : out std_logic;
             counter_dec : out std_logic;
             ram_wr_en : out std_logic
            );
end COUNT_RAM_CNTR;
 
architecture arch of COUNT_RAM_CNTR is
 
type state_type is (idle,kb_save,kb_clear,kb_clear2);
 
signal state_reg : state_type;
signal state_next : state_type;
 
begin
 
    process(clk,reset)
        begin
            if reset = '1' then
                state_reg <= idle;
            elsif (clk'event and clk = '1') then
                state_reg <= state_next;
            end if;
    end process;
    
    process(state_reg,kb_data_ready,kb_backspace)
        begin
            state_next <= state_reg;
            
            case state_reg is 
                
                when idle =>
                    if kb_data_ready = '1' then
                        if kb_backspace = '1' then
                            state_next <= kb_clear;
                        else
                            state_next <= kb_save;
                        end if;
                    end if;
                    
                when kb_clear =>
                    state_next <= kb_clear2;
                
                when kb_clear2 => 
                    state_next <= idle;
                
                when kb_save =>
                    state_next <= idle;
                
                when others =>
                
            end case;
    end process;
    
    -- output
    process(state_reg,kb_data_ready)
        begin
            kb_ack <= '0';
            counter_inc <= '0';
            counter_dec <= '0';
            ram_wr_en <= '0';
            
            case state_reg is
            
                when idle =>
                
                when kb_save =>
                    kb_ack <= '1';
                    counter_inc <= '1';
                    ram_wr_en <= '1';
                    
                when kb_clear =>            
                    counter_dec <= '1'; 
                    
                when kb_clear2 => 
                    kb_ack <= '1';
                    ram_wr_en <= '1';
                
                when others =>
            end case;
    end process;
end arch;



---------- Post added at 13:44 ---------- Previous post was at 12:36 ----------

thank you joelby for your help!

I solved it and it works, a minor addition to the state machine and some changes to the counters and thats it!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top