+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Newbie level 6
    Points: 121, Level: 1

    Join Date
    Aug 2017
    Posts
    12
    Helped
    0 / 0
    Points
    121
    Level
    1

    LCD code for fpga virtex 6

    i want a vhdl code to use lcd of an fpga virtex 6 .
    could anyone help me and give me this code?
    thanks

    •   Alt6th November 2017, 12:39

      advertising

        
       

  2. #2
    Super Moderator
    Points: 27,672, Level: 40
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,318
    Helped
    1533 / 1533
    Points
    27,672
    Level
    40

    Re: lcd code for fpga virtex 6

    Quote Originally Posted by moonshine8995 View Post
    i want a vhdl code to use lcd of an fpga virtex 6 .
    could anyone help me and give me this code?
    thanks
    No, nobody can help, but you could help yourself by...
    a) using google to try and find some VHDL code to drive an LCD.
    b) post the code you wrote that doesn't work along with the LCD datasheet/part number/etc. and a question that we can answer.

    This forum is not intended for getting free code for all your projects. There are other sites devoted to obtaining IP, free or otherwise.



    •   Alt6th November 2017, 17:39

      advertising

        
       

  3. #3
    Newbie level 6
    Points: 121, Level: 1

    Join Date
    Aug 2017
    Posts
    12
    Helped
    0 / 0
    Points
    121
    Level
    1

    Re: lcd code for fpga virtex 6

    thank you.
    this is the code i find.
    it was a verilog code and i change it to vhdl.
    now i have some problem in converting it.
    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
    
    LIBRARY ieee;
    USE ieee.std_logic_1164.ALL;
    USE ieee.std_logic_unsigned.ALL;
    USE ieee.numeric_std.ALL;
     
    entity lcd is
     
       port(
            clk, RxD : in std_logic;
            LCD_RS, LCD_RW, LCD_E : inout std_logic;
            LCD_DataBus : out std_logic_vector(7 downto 0);
     
            RxD_data_ready :in std_logic;
            RxD_data : inout std_logic_vector(7 downto 0)
         );
    end lcd;
     
    architecture behav of lcd is
    signal count : integer;
    signal Received_Escape : std_logic;
    signal Received_Data : std_logic;
    signal LCD_instruction : std_logic;
    begin
    LCD_RW <= '0';
    LCD_DataBus <= RxD_data;
     
    Received_Escape <= (RxD_data_ready) and (RxD_data:='0');
    Received_Data <=(RxD_data_ready) and (RxD_data>0);
     
    process(clk) 
    begin
    if rising_edge(clk) then
    if(Received_Data='1') then 
    count <= count + 1;
    if(count>0) then
    count <= count + 1; 
    -- activate LCD_E for 6 clocks, so at 25MHz, that's 6x40ns=240ns
    end if;
    end if;
    end if;
    end process;
    process(clk)
    begin
    if rising_edge(clk) then
    if(LCD_E ='0')then
      LCD_E <= Received_Data;
    if (count/=6)then
      LCD_E <= std_logic_vector(to_unsigned(count, 1));
     
    --reg LCD_instruction;
    end if;
    end if;
    end if;
    end process;
    process (clk)
    begin
    if rising_edge(clk) then
     
    if(LCD_instruction='0')then
     LCD_instruction <= Received_Escape;
    if (count/=7)then
      LCD_instruction <= std_logic_vector(to_unsigned(count, 1));
    end if;
    end if;
    end if;
    end process;
    LCD_RS <= not(LCD_instruction);
     
    end behav;
    here are the vhdl code errors and i think if i correct these more errors will be found.
    and this is the verilog code i find :
    Code Verilog - [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
    
    module LCDmodule(clk, RxD, LCD_RS, LCD_RW, LCD_E, LCD_DataBus);
    input clk, RxD;
    output LCD_RS, LCD_RW, LCD_E;
    output [7:0] LCD_DataBus;
     
    wire RxD_data_ready;
    wire [7:0] RxD_data;
    async_receiver deserialer(.clk(clk), .RxD(RxD), .RxD_data_ready(RxD_data_ready), .RxD_data(RxD_data));
     
    assign LCD_RW = 0;
    assign LCD_DataBus = RxD_data;
     
    wire Received_Escape = RxD_data_ready & (RxD_data==0);
    wire Received_Data = RxD_data_ready & (RxD_data!=0);
     
    reg [2:0] count;
    always @(posedge clk) if(Received_Data | (count!=0)) count <= count + 1;
     
    // activate LCD_E for 6 clocks, so at 25MHz, that's 6x40ns=240ns
    reg LCD_E;
    always @(posedge clk)
    if(LCD_E==0)
      LCD_E <= Received_Data;
    else
      LCD_E <= (count!=6);
     
    reg LCD_instruction;
    always @(posedge clk)
    if(LCD_instruction==0)
      LCD_instruction <= Received_Escape;
    else
      LCD_instruction <= (count!=7);
     
    assign LCD_RS = ~LCD_instruction;
     
    endmodule

    - - - Updated - - -

    i forgo to attach the error.
    this is the error for line
    LCD_E <= std_logic_vector(to_unsigned(count, 1));
    and line
    LCD_instruction <= std_logic_vector(to_unsigned(count, 1));
    Type conversion (to ieee.std_logic_1164.STD_LOGIC_VECTOR) conflicts with expected type ieee.std_logic_1164.STD_LOGIC
    and these are the errors
    near ":=": (vcom-1576) expecting ')'.
    for line
    Received_Escape <= (RxD_data_ready) and (RxD_data:='0');
    and
    (vcom-1581) No feasible entries for infix operator 'and'.
    and
    Type error resolving infix expression "and" as type ieee.std_logic_1164.STD_LOGIC.
    for line
    Received_Data <=(RxD_data_ready) and (RxD_data>0);
    thanks for helping me.
    Last edited by ads-ee; 7th November 2017 at 16:48. Reason: change quote to syntax tags for easier reading



    •   Alt7th November 2017, 12:41

      advertising

        
       

  4. #4
    Advanced Member level 5
    Points: 34,868, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,388
    Helped
    1861 / 1861
    Points
    34,868
    Level
    45

    Re: lcd code for fpga virtex 6

    LCD_E is a std_logic, not a std_logic_vector. Hence you cannot assign a std_logic_vector to it.
    := is the variable assignment operator, not the equality (=) operator.

    Why are the LCD_ ports inout? if you need to read them internally, then create a local signal to do it. inout should really only be used for true inout ports, like tri-state buffer.
    RxD_Data does not need to be inout - just in



--[[ ]]--