Re: Is it allowed to change pin reference within a subroutine?
owout PortB.0[Dindex],1,[$CC,$44]
owout PortB.0[Dindex],1,[$CC,$BE]
owin PortB.0[Dindex],0,[STR Dta\9]
won't fly
OWOUT Pin
, Mode,[Item...]{,Label}
Pin may be a constant, 0 - 15, or a variable that contains a number 0 15 (e.g. B0) or a pin name (e.g. PORTA.0).
pin mapping is a bit vague in tne book
pin 0 is maybe porta.0 pin 15 might be portb.7 I think it can vary from chip to chip too
there is reference to it somewhere in the basic_stamp compatability notes , but I can no longer find it
so
mypin=13
owin mypin,[STR Dta\9] is a legal construct
from the book
7.6.5 Applying Offsets to Bits within a Variable or Register
The array mechanism in PBP offers a solution. An offset enclosed in brackets may
be written after the bit number:
PORTB.0[x] = 1 ' Set RBx high
The actual effect of this is to add the value of x to the numeric bit number.
x = 2
PORTB.4[x] = 1 ' Set bit(4+x) high. In this case, bit-6 is set.
NOTE THAT
PBP COMMANDS WON'T ACCEPT THIS SYNTAX for command parameters. This method can only be used in expressions and with direct register
access. You CANNOT write:
HIGH PORTB.0[x] ' COMPILE ERROR
COUNT PORTB.0[x], 100, y ' COMPILE ERROR
Warning I'm not a teacher
Bookmarks