PDA

View Full Version : Array of pins



The Master
- 1st December 2007, 22:01
Hi. Ive seen this in Darrel Taylor's hello world example on his site



LED1 VAR PORTB.1


Is it possible to do the same thing with an array?
EG


LED[1] VAR PORTB.1

Darrel Taylor
- 1st December 2007, 22:55
Maybe Bruce or Melanie or Sayzer can help.

Indexing Port Pins
http://www.picbasic.co.uk/forum/showthread.php?t=3753

_

The Master
- 1st December 2007, 23:44
Hmm. From reading that it doesnt look like i can do it the way i want. I could do what i want with a few if statements.

What i wanted to do


for x=0 to 15
if condition(x)=true then
high pins(x)
endif
next


What i will have to do


if condition(0)=true then
high porta.1
endif
if condition(1)=true then
high porta.4
endif
'etc

Darrel Taylor
- 1st December 2007, 23:53
Master, don't beat me.

But PLEASE try to read Bruce's post.
The answer really is there.
<br>

The Master
- 2nd December 2007, 00:08
Oh. Ill read it through again. It looked like something similar was happening but not exactly what i was after. Ill have another read though and see if i get it

The Master
- 2nd December 2007, 00:17
Sorry. I still dont quite understand. That thread seems to be about loading all the pins into an array. I want selected pins.

array(0) is porta.6
array(1) is portb.2
array(2) is porta.1

etc

The Master
- 2nd December 2007, 00:21
Just read Bruce's second post. He links to this thread (http://www.picbasic.co.uk/forum/showthread.php?t=4074) which seems to have what im looking for. Just making sense of it all now