PDA

View Full Version : Clearing info in an array



JohnP
- 17th February 2009, 08:14
:confused:Is there a way to clear data in an array with one instruction? I get tired of spending code space and time on creating a loop to clear the array cells one at a time.

John P

mister_e
- 17th February 2009, 16:22
How many different array you have?

JohnP
- 17th February 2009, 18:03
Currently in my program I am creating the first array of only 8 bytes (x255), but that will expand depending on ease of operation and speed. I'd like to be able to clear the the whole 8 byte array with one command.

I thought that where the array

DPA var byte [8]

was used that I'd be able to clear the whole array by using

DPA = 0

but that doesn't work.

John P
Virginia Beach, Virginia USA

Melanie
- 17th February 2009, 18:36
Doesn't the CLEAR command (manual section 5.8) work for you?

That will ZAP everything... otherwise it's a FOR...NEXT loop if you want to be pickky.