Hi,
How can I create a byte array that is capable of going 1 - 3096?
Thanks
Ron
V3 - Creating BYTE Array
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: V3 - Creating BYTE Array
Hi,
I am using 18F.....
How would I define an array 1 - 256?
Thank you,
Ron
I am using 18F.....
How would I define an array 1 - 256?
Thank you,
Ron
- 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
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel