picaxe 28X1

sub-bg

New Member
I am currently building my university project
which is suppose to read the information gained from a 1490 compass and
send the information (which is a digital output) back to a picaxe 28x1 then ,by using LEDs, always show south.
I want to connect the compass to the input pins on the chip but i don't seem to be getting the right output from the chip.

At the moment I have written the progam ,as shown below.Its supposed to read whether pin7 is high or low and depending on that output six should be high.

The compass has 4 digital outputs one for each direction but at the moment I am only testing one direction.

-----------------------------------------
dirsc =%00000000 'should declare all port c as inputs
main:

if pin7=0 then label_11 ' reads the output frm the compass

low 6


label_11: high 6
goto main
-----------------------------------------------
Do I have to define port C (actual pins 15 to 18) as inputs???

No matter what I do output 6 is ALWAYS high.

Many Thanks ...
 

eclectic

Moderator
Add another
goto main

Code:
#picaxe 28x1

dirsc =%00000000 'should declare all port c as inputs
main:

if pin7=0 then label_11 ' reads the output frm the compass

low 6

goto main ; *****

label_11: high 6
goto main
Try the "before" and "after" in the simulator,
and see the difference.
e
 

Peter M

Senior Member
yes as eclectic says

at the moment your code may send pin 6 low
then on the next line it is sent high again.
then goes back and asks the question again.

remember your code will drop to the next line in the sequence, regardless of labels unless it is told to do otherwise.

so it was probably flicking off you just couldn't see it!
 

westaust55

Moderator
28X1 portC

@sub-bg,

The 28X1 by default on power-up or reset has the 8 pins for portC all set as inputs , so unless you have otherwise previously changed them the line:
dirsc =%00000000 'should declare all port c as inputs​
is redundant.
 
Top