PDA

View Full Version : syntax advice



ilteris
- 17th October 2005, 01:40
I am just wondering how I can do couple of things on picbasic pro. Please follow the comments below.

TRISB = 1
TRISC = 0
i var byte ' generic i var to count
leds var byte[8] 'declaration of array

i = 0
while i < 8
leds[i] var portc.i
' I am just trying to set the array elements reference output pins
' like if I call leds[2] for example it should spit out portb.2
' is this possible in pic basic pro within a for loop?
i = i + 1
wend

main:
while i < 8
'here I am trying to make them go high
'am I on the right track?
high leds[i]
i = i + 1
pause 1000
wend

' should I just use i var in here as well, or should I declare another variable?
while i < 8
low leds[i]
pause 1000
i = i + 1
wend


goto main










thanks for your suggestions.
iltertis

Darrel Taylor
- 17th October 2005, 08:46
Hi iltertis,

Melanie's done a couple of post's that should help you out.

Bits, Bytes Words and Arrays
http://www.picbasic.co.uk/forum/showthread.php?t=544

pins in arrays?
http://www.picbasic.co.uk/forum/showthread.php?t=1517
<br>