PDA

View Full Version : PORTA.PinNo = 1 ' problem



frank small
- 26th April 2004, 11:38
Hi,
Can anyone tell me what is wrong with this and how to get round it?
I am using VB to control the pins of a pic over a serial link and I am just testing at the moment
by turning on and off paticular pins
Test code is something like this

DIM PinNo AS BYTE
DIM PinState AS BIT

PinState = True
LET PinNo =5
If PinState = 1 then
PORTA.PinNo = 1 ' problem
else
PORTA.PinNo = 0 ' problem

The compiler has a problem with
PORTA.PinNo = 1 or PORTA.PinNo = 0
though no problem with
PORTA.5 = 1
Any suggestions please
Regards
Frank

Melanie
- 26th April 2004, 14:16
Portx.myvariable is not a valid PBP statement.

Please do a search for...

pin* AND addressing

...as this topic comes up regularly in various guises.

frank small
- 26th April 2004, 14:47
Many thanks ,Melanie
Regards
Frank

frank small
- 6th May 2004, 14:30
Hi Melanie
Looked at all the info as you suggested and it made sense
However I cannot get porta.0(x) = 1 to compile
Here is an example of one of my attempts
In other attempts I used [x] instead of (x) and in frustration
I declared Porta.0as an array but of course that did not work

'Configure
DEVICE = 16F877
XTAL = 20
'.................................
Dim x as byte
x=1
porta.0(x) = 1

What am I doing wrong?
Regards
Frank