Forum Discussion
Altera_Forum
Honored Contributor
14 years agoarray of ascii
Hello everyone
I have a question about the following piece of codeIEEE.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 advance3 Replies
- Altera_Forum
Honored Contributor
what's the error?
- Altera_Forum
Honored Contributor
--- Quote Start --- Hello everyone I have a question about the following piece of code
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 --- Quote End --- 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 JenningsIEEE.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 - Altera_Forum
Honored Contributor
--- Quote Start --- Hello everyone I have a question about the following piece of code
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 --- Quote End --- 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.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