Discuss PIC and electronic related things
Moderators: David Barker, Jerry Messina
-
be80be
- Registered User
- Posts: 90
- Joined: Mon Feb 23, 2009 2:15 am
- Location: tn
Post
by be80be » Mon Nov 26, 2012 2:44 am
In a for next loop you use bound to load the bytes of a const.
How would you do this
Code: Select all
dim load as byte
dim index as byte
Const X (2) as byte = (%10000000,%01000000)
load = (X (index))
Inc (index)
Make it work in a loop Like this
Code: Select all
For scan = 0 To Bound (row)
load = (X (index))
PORTB = X
I = (scan(row))
StartScan // a sub that shift's out I
Inc (index)
Next
-
David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
-
Contact:
Post
by David Barker » Mon Nov 26, 2012 9:50 am
I'm not sure what you mean - bound returns the upper (max) count of an array. Is this what you mean:
Code: Select all
For index = 0 To Bound (x)
load = X (index)
PORTB = load
Next
-
be80be
- Registered User
- Posts: 90
- Joined: Mon Feb 23, 2009 2:15 am
- Location: tn
Post
by be80be » Mon Nov 26, 2012 3:17 pm
I figured it out
Code: Select all
While true //Loop that's forever as long as it's true
I=0
scan=0
For index = 0 To Bound (data) //Picks byte to load
VarArray = row
DelayMS(10) // to see it happen
X = (data(index)) // This Loads byte into X
StartScan // This sends X to the TLC5916
I = VarArray(scan)
PORTA= I
scan = scan +1
DelayMS(10) // to see it happen
//Loop the const array data runs all byte
Next
Wend
End
I wanted to index two const in one fornext loop