V3 - Creating BYTE Array

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times

V3 - Creating BYTE Array

Post by Ron »

Hi,

How can I create a byte array that is capable of going 1 - 3096?

Thanks

Ron

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: V3 - Creating BYTE Array

Post by Benj »

Hello Ron,

AVR's, PIC24's, dsPIC's and ARM devices can have arrays up to any size providing they have enough ram to complete the array. PIC16 and PIC18 devices can have a maximum array size of 256 bytes due to their archetecture. You can create multiple arrays in a PIC and then use a overall switching technique to switch between arrays. However you would need a lot of arrays to cover the 3096, 13 to be exact.

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times

Re: V3 - Creating BYTE Array

Post by Ron »

Hi,

I am using 18F.....

How would I define an array 1 - 256?

Thank you,

Ron

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: V3 - Creating BYTE Array

Post by Benj »

Hello Ron,

In flowcode you would create a byte variable and after the variable name you would type square brackets containing the array size.

eg

byte0[256]
byte1[256]
byte2[256]
...

The bytes inside the array are addressed from 0 to the array size minus 1 in this case 255 giving you 256 memory locations.

eg

byte0[0] = variable.
variable = byte0[255]

You can then switch between the arrays by using divide and find the position in the array by using mod.

e.g.
address = 1350

array = address / 256
location = address mod 256

if (array = 0)
value = byte0[location]
if (array = 1)
value = byte1[location]
if (array = 2)
value = byte2[location]
...
etc

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times

Re: V3 - Creating BYTE Array

Post by Ron »

Hello Ben,

Thank you..... :)

Ron

Post Reply