pin5= b0 (40X /18X difference ?)

dworboys

New Member
should the following code set pin5 to whatever bit1 is ?

b1=b0&$02/2
pin5=b1

why does the command seem to work on a 40X chip but produces a unknown symbol syntax error on a 18X chip ?
the same command using either pin0,1,2,6,7 seems to work on both chip types but pin3,4,5 all bomb out with an unknown symbol syntax error on an 18X. I'm using editor V5.0.7.

David

 
 

hippy

Ex-Staff (retired)
The code does do what you want ( but would be much simpler written as "pin5=bit1" ).

The issue of "pin5" is that "pin" variable names only exist if there is an input which can be referenced by that pin name, and on the 18 range there isn't.

The workround is to use "outpin5".

Edited by - hippy on 07/12/2006 01:40:25
 

dworboys

New Member
thanks for the explanation of the 18X/40X difference and the use of outpin instead of pin. I should have twigged to this.

I understand that outpinX=bitY is a simplier way of expressing it however my actual code at one place calls for a variable on the right side of the expression eg. outpin4 below

mem_led_update:
'b0=pins
b3=1
for b1=0 to 7
outpin1=bit8 'set address bits
outpin2=bit9
outpin3=bit10

outpin4=b0&$b3/b3 'set data bit

low portc 0 'clock latch
high portc 0

b3=b3*2

next b1
return

David

 
 
Top