Plus I think an array should start with variable 0 not 1. So it would be 0 through 9.
Plus I think an array should start with variable 0 not 1. So it would be 0 through 9.
blainecf,
I am not sure this will work like you expect. When you declare an array variable, it is acually pointing to a series of consecutive RAM addresses. So later, when you use the variable, it goes to the address and uses the value currently at that address. What you are looking to do is create an array that is actually pointing to the addresses represented by the individual pins (which are not even consecutive).
After playing with it a little and looking at the .lst file, I don't know if this can be done in PBP. Once you have created the array, any further references to the array are modifying/reading the contents, not the address. The only info in the manual I see is assigning a label to a specifc pin. Which is handled using different ASM commands.
Maybe one of the real gurus could chime in here and set me straight if I'm wrong (Melanie? Darrel?). Or provide a workaround to do the job.
Hope to get a better answer,
Steve
See these
http://www.picbasic.co.uk/forum/showthread.php?t=3753
http://www.picbasic.co.uk/forum/showthread.php?t=544
and then ....
Paul Borgmeier
Salt Lake City, Utah
USA
Last edited by paul borgmeier; - 13th June 2006 at 20:02.
Although slightly contrived and uses more RAM - this does it.
Paul BorgmeierCode:Relay var Byte[4] x var byte i var byte Relay[1] = 14 'RB6 Relay[2] = 20 'RC4 Relay[3] = 26 'RD2 main: ' cycle through relays for i = 1 to 3 x = relay[i] porta.0[x]=1 PAUSE 1000 porta.0[x]=0 PAUSE 300 next i
Salt Lake City, Utah
USA
Bookmarks