how to implement DIM AS CODE
hello,
i am trying to write code for my 5*5*5 led cube. this is a test setup before i start building my 8*8*8 RGB led cube to avoid any errors in the final project.
i am of course using shift register to extend the amount of outputs, however the electronics itself are not the problem since i am struggeling with the code.
i already did get the shout command working and also used array's bud the downside of that is that they are stored as variabels.
so i was looking for a method to store the data in the flash memory of the pic, i found the following command: DIM ...... AS CODE in the documentation.
it is able to do exactly what i want. bud the documentation doesn't tell me how to implement it. i would like to store 8bit values, so it should look a bid like this:
%10000000
%11000000
%11100000
i want to store data tables that the program needs to walk trough one by one. the problem is how can i write this kind of data table to the flash memory with the DIM .... AS CODE command?
thanks in advance
Re: how to implement DIM AS CODE
DIM is BASIC, this forum is for PIC BASIC.
From the manual:
Quote:
4.5. Arrays
Variable arrays can be created in a similar manner to variables.
Label VAR Size[Number of elements]
Label is any identifier, excluding keywords, as described above. Size is BIT, BYTE or WORD. Number of elements is how many array locations is desired. Some examples of creating arrays are:
sharks var byte[10]
fish var bit[8]
Robert
Re: how to implement DIM AS CODE
Re: how to implement DIM AS CODE
thanks for the response. i didn't know there was a diffrence to be honest. is there a big difference between the two?
Re: how to implement DIM AS CODE
Can't say, I'm not familiar with Proton.
But BASIC is BASIC so it can't be very different.
Re: how to implement DIM AS CODE
That would be a lookup table in PBP.
Re: how to implement DIM AS CODE
and you’d generate patterns like that on the fly
Code:
pattern var byte
i var byte
displayram var byte[8]
pattern = %11111111
for i = 0 to 7
pattern = pattern << 1
displayram[7-i] = pattern
next i