PDA

View Full Version : Port pin variables



electroken
- 1st January 2011, 17:09
Why does this not work in PicBasic Pro?? I'm using a Pic16f870

for j=0 to 7
portb.j=1
pause 100
portb.j=0
next j

also,
high portb.j
does not work

I get a "Bad Variable Modifier" error at each portb program line

thanks

Jerson
- 1st January 2011, 17:25
This thread has the answer
http://www.picbasic.co.uk/forum/showthread.php?t=544&pagenumber=

electroken
- 5th January 2011, 16:58
this will compile ok....portb[x] and portb(x) compiles ok too, but it does nothing to activate the port.
So I guess the question is, how do you use a variable on a port?

aratti
- 5th January 2011, 17:23
So I guess the question is, how do you use a variable on a port?

Try this way, it will compile and work as well.

for j=0 to 7
portb0.[j]=1
pause 100
portb0.[j]=0
next j

Cheers

Al.