Detection of two rising edges

Discussion in 'VHDL' started by Dileptor, Nov 24, 2010.

  1. Dileptor

    Dileptor

    Joined:
    Nov 24, 2010
    Messages:
    1
    Hi everyone,

    I'm sure you have heard similar question from many other vhdl beginners however I couldn't find a solution to my problem anywhere. Here's the troublesome code:
    Code (Text):
    PROCESS(clock, reset, ready)
            variable countInit: INTEGER range initcode'Low to initcode'High:=0;
            variable count: INTEGER range 0 to MAX_LINE_INDEX:=0;
            variable IsLine2 : boolean :=false;
        BEGIN
            IF(Reset = '1') THEN
                countInit := initcode'Low; count:=0; IsLine2:=false;
                state <= Init_en_high;
            ELSIF(clock'EVENT AND clock = '1') THEN
                CASE state IS
                -- LCD initialization sequence
                -- The LCD_DATA is written to the LCD at the falling edge of the E line
                -- therefore we need to toggle the E line for each data write
                WHEN Init_en_high =>
                    LCD_DATA <= initcode(countInit);
                    LCD_EN <= '1';  -- EN=1;
                    LCD_RS <= '0';  -- RS=0; an instruction
                    state <= Init_en_low;
                WHEN Init_en_low =>
                    LCD_EN <= '0';  -- set EN=0;
                    IF countInit = initcode'HIGH THEN
                        state <= WriteCharacter_en_high;
                    ELSE
                        countInit := countInit + 1;
                        state <= Init_en_high;
                    END IF;
                   
                -- write 1st line text
                WHEN WriteCharacter_en_high =>
                    if (rising_edge(ready)) then
                        LCD_DATA <= LCD_CHAR; --send data      
                        LCD_EN <= '1';  -- EN=1;
                        LCD_RS <= '1';  -- RS=1; data
                        state <= WriteCharacter_en_low;
                    end if;
                   
                   
       
                WHEN WriteCharacter_en_low =>
                    --check_led3<='1';
                    LCD_EN <= '0';  -- EN=0; toggle EN
                    IF (not IsLine2) and (count=MAX_LINE_INDEX)
                            then state <= GoToLine2_en_high; --jsme na konci prvniho radku
                    elsif IsLine2    and (count=MAX_LINE_INDEX)
                            then state <= End_en_high;  -- end of the second line
                    ELSE count := count + 1;
                         state <= WriteCharacter_en_high; --back to writing
                    end if;
                   
                -- move cursor to second line of display
                WHEN GoToLine2_en_high =>
                                        --
                    LCD_DATA <= x"C0";  -- x"CO" is address of 1st position on 2nd line,                                   
                    LCD_EN <= '1';  -- EN=1;
                    LCD_RS <= '0';  -- RS=0; an instruction
                    state <= GoToLine2_en_low;

                WHEN GoToLine2_en_low =>
                    LCD_EN <= '0';  -- EN=0; toggle EN
                    ---state <= WriteCharacter_en_high;
                    count:=0;
                    IsLine2:=true;
                    state <= WriteCharacter_en_high; --back to writing mode

                WHEN End_en_high =>
                    countInit:=6;
                    count:=0;
                    IsLine2:=false;
                    --LCD_EN <= '1';    -- EN=1;
                    --LCD_RS <= '0';    -- RS=0; an instruction
                    state <= Init_en_high;

                WHEN OTHERS =>
                    LCD_EN <= '0';  -- set EN=0;
                    state <= Stop;
                END CASE;
            END IF;
        END PROCESS;
    The error message i get during compilation is :
    Error (10821): HDL error at LCD_Text.vhd(50): can't infer register for "state.WriteCharacter_en_low" because its behavior does not match any supported register model

    (the code is basically i finite state machine that manages LCD display)

    I suppose the problem lies with the "WriteCharacter_en_high" state. I know I can't detect rising edges of two different clocks in one process. I've tried many workarounds too, but nothing seems to work.

    How do I do this? I would really appreciate any kind of suggestion or help.
     
    Dileptor, Nov 24, 2010
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john

    Rising edge of the clock

    john, Nov 25, 2004, in forum: VHDL
    Replies:
    9
    Views:
    9,095
  2. ALuPin

    Rising, falling edge

    ALuPin, Apr 21, 2005, in forum: VHDL
    Replies:
    0
    Views:
    7,186
    ALuPin
    Apr 21, 2005
  3. =?Utf-8?B?U2FlaWQ=?=

    Postback is not rising

    =?Utf-8?B?U2FlaWQ=?=, Aug 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    477
  4. python_eager

    error rising while connecting oracle 9i

    python_eager, Jan 5, 2006, in forum: Python
    Replies:
    2
    Views:
    477
    wittempj@hotmail.com
    Jan 7, 2006
  5. Amit
    Replies:
    2
    Views:
    492
    Ahmed Samieh
    Jun 4, 2007
Loading...

Share This Page