PDA

View Full Version : Arrays and Constants



Badger
- 3rd March 2013, 15:34
Hi everyone,

Is there a way to use a constant to define the size of your array? eg:

DEV CON 60
LED VAR BYTE[WS]

It compiles, but throws up a syntax error (Haven't tested in the program yet)

Thanks.

HenrikOlsson
- 3rd March 2013, 16:16
Hi,
That IS the way to do it.
But you can't name the constant DEV and then use WS in the array declaration.... You need to use a constant that actually have been declared.

WS CON 60
LED VAR BYTE[WS]


/Henrik.

Badger
- 3rd March 2013, 18:40
Thanks, yep that was just a typo.

I'll have a go now I'm back with the project.

Badger
- 3rd March 2013, 19:29
Simple problem in the end.

WS CON 60
LED VAR BYTE[WS]

Has to be above anything that uses it. If you don't it will compile O.K. but you will see a syntax error afterwards, and will not work.

Badger...