Results 1 to 4 of 4

Thread: array of ascii

  1. #1
    Join Date
    Mar 2012
    Posts
    5
    Rep Power
    1

    Default array of ascii

    Hello everyone

    I have a question about the following piece of code

    Code:
    IEEE.STD_LOGIC_UNSIGNED.ALL
    |
    |
    |
    ARCHITECTURE FSMD OF lcd_driver IS
      SUBTYPE ascii IS STD_LOGIC_VECTOR(7 DOWNTO 0);
      TYPE charArray IS array(1 to 6) OF ascii;
      SHARED VARIABLE line1: charArray := (x"31",x"32",x"33",x"34",x"35",x"36");
    |
    |
    |
    BEGIN
    When i try to change on of the values in line1 array by using: line1(1) := x"20"; i get an error
    Enybody know what i did wrong ?

    Thanks in advance

  2. #2
    Join Date
    Oct 2008
    Posts
    3,614
    Rep Power
    1

    Default Re: array of ascii

    what's the error?

  3. #3
    Join Date
    Aug 2006
    Posts
    116
    Rep Power
    1

    Default Re: array of ascii

    Quote Originally Posted by galardo View Post
    Hello everyone

    I have a question about the following piece of code

    Code:
    IEEE.STD_LOGIC_UNSIGNED.ALL
    |
    |
    |
    ARCHITECTURE FSMD OF lcd_driver IS
      SUBTYPE ascii IS STD_LOGIC_VECTOR(7 DOWNTO 0);
      TYPE charArray IS array(1 to 6) OF ascii;
      SHARED VARIABLE line1: charArray := (x"31",x"32",x"33",x"34",x"35",x"36");
    |
    |
    |
    BEGIN
    When i try to change on of the values in line1 array by using: line1(1) := x"20"; i get an error
    Enybody know what i did wrong ?

    Thanks in advance
    Line1 is defied to be an array (1 to 6), but what you posted only initialized line1(1) in the declaration. When you define an initial value for an array, you have to define all of the elements. Later on, (i.e. not where the variable is declared), you can set one element.

    Kevin Jennings

  4. #4
    Join Date
    Jun 2007
    Location
    B-Hoegaarden
    Posts
    751
    Rep Power
    1

    Default Re: array of ascii

    Quote Originally Posted by galardo View Post
    Hello everyone

    I have a question about the following piece of code

    Code:
    IEEE.STD_LOGIC_UNSIGNED.ALL
    |
    |
    |
    ARCHITECTURE FSMD OF lcd_driver IS
      SUBTYPE ascii IS STD_LOGIC_VECTOR(7 DOWNTO 0);
      TYPE charArray IS array(1 to 6) OF ascii;
      SHARED VARIABLE line1: charArray := (x"31",x"32",x"33",x"34",x"35",x"36");
    |
    |
    |
    BEGIN
    When i try to change on of the values in line1 array by using: line1(1) := x"20"; i get an error
    Enybody know what i did wrong ?

    Thanks in advance
    Shared variables are tricky/risky.
    You may achieve the same by moving the instantiation of 'line1' as a (normal) variable inside the process where you are using it.
    If we could see more of your code, we could give better help.

Similar Threads

  1. Need a fast way to insert ascii charts to Code
    By mackrants in forum General Software Forum
    Replies: 2
    Last Post: January 19th, 2012, 11:35 AM
  2. PCB part symbols - why not ASCII?
    By leon_heller in forum General Altera Discussion
    Replies: 0
    Last Post: July 5th, 2011, 04:25 AM
  3. C CODE Integer as ASCII to printf string...HELP!!!
    By vincoldes in forum General Software Forum
    Replies: 7
    Last Post: April 27th, 2011, 12:27 AM
  4. ASCII rom initialization
    By slk in forum FPGA, Hardcopy, and CPLD Discussion
    Replies: 1
    Last Post: May 26th, 2010, 07:06 AM
  5. Convert .OLB to ASCII .MIN format for import into PCB design package that isn't OrCad
    By pcramaeqco in forum Quartus II and EDA Tools Discussion
    Replies: 0
    Last Post: April 28th, 2010, 06:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •