multiple ports ===> one symbol?

# Thread: multiple ports ===> one symbol?

1. ## multiple ports ===> one symbol?

does this work

___

symbol rout = porta.0: porta.1

___

desired effect = when adressing ROUT , exact change on two givin ports rather then one
example
___
rout = 1
___

desired effect
a.0 goes high
a.1 goes high
Last edited by PICMAN; - 6th March 2005 at 00:18.

2. Did you find this post helpful? |
NOP. If you want to set PORTA.0 & PORTA.1 to 1

PORTA=PORTA | 3

where | is a bitwise OR

to CLEAR the same pins

PORTA=PORTA & \$FC

3. Did you find this post helpful? |
am i to understand
bitwise = 1100 0000 to set port a.0 and a.1

i am not familiar with term bitwise,

whats the 3 do ?

is this what you meant

porta=porta 11000000 3.

is there a comand in picbasic manual i can refrance for examples , ie look up pulsin , and get syntax explained

i can also SYMBOL them both seprate and activate them in one line as follows.

__
symbol a.0 = FLTS
symbol a.1 = RLTS

'next code line jumps to activating
flts: rlts = 1
'or is it corect this way
flts = 1 : rlts = 1
___

4. Did you find this post helpful? |
O.k. let's make it simple
when you define a byte(8 bits) in binary like this
a=%00000011

it set the bit 0 and 1 to 1. It's the same as a=3 in decimal

bitwise operation
working with bits in a byte or ar word sized variable...

a=%00000011

PORTA=%11111100

so if you do a bitwise OR ( or |) operation with PORTA and a

PORTA | a

the result will be %11111111

in your case you don't want to affect the other pins. If you want to set A.0 and A.1 of PORTA
PORTA=PORTA | %00000011
OR
PORTA=PORTA | 3

case you want to clear A.0 and A.1 you must use btwise AND
PORTA=PORTA & &11111100 'in binary
OR
OR
PORTA=PORTA & 252 ' in decimal

Do you know how logical operation works? If not, the fast way to learn is to run 'calc' in windows. Select the scientic view and Voila... you'll be able to test your bitwise operations. OR see this link

Yeah Ralph... i know (inside joke here)

you'll find all those bitwise operator at the begining of your PBP manual.

You can also use symbol for that... i prefer use VAR... i'm coming old and i have my old method.

Code:
```TRISA=0 'set PORTA as output to all pins
FLTS VAR PORTA.0
RLTS VAR PORTA.1

FLTS=1 ' set PORTA.0 to 1
RLTS=1 ' set PORTA.1 to 1```

5. Did you find this post helpful? |
ok now i understand that perfectly, thnx man,

theres no need to trisa is there,, 2 ports on port a are input for pulsin, but i like your VAR solution, i hear SYMBOL is not wise to get into habbit of using

"its hard to understand the story if you only read 2/3 of the book"
hehe the pros and cons of reverse engenering