Very basic help please

Russlk

New Member
In my program, the statement: let portb = h is flagged as an error. Port b is an output, why can't I program it the same as portc? My program:
REM INITIAL CONDITIONS
#picaxe 28x1
LET PINS = %00000000 REM MAKE ALL OUTPUTS LOW
LET DIRSC = %11111111 REM MAKE PORT C ALL OUTPUTS
LET PINSC = %00000000 REM MAKE ALL OUTPUTS LOW
SYMBOL H = B1
SYMBOL M = B0

START:

FOR H = 1 TO 12 REM HOUR LOOP
FOR M = 1 TO 12 REM MINUTE LOOP
IF PORTA pin0 = 1 then GOSUB SETMIN REM TOGGLE SWITCH TO SET MINUTES
IF PORTA pin1 = 1 then GOSUB SETHR REM TOGGLE SWITCH TO SET HOUR
LINE1: PAUSE 60000 REM PAUSE 1 MINUTE
IF PORTA pin2 =1 THEN LINE3 REM THIS MAKES A ONE MINUTE ADJUSTMENT
' TO INCREMENT THE MIN. LED EARLIER
PAUSE 60000 REM PAUSE 1 MINUTE
LINE3: PAUSE 30000 REM PAUSE 30 SECONDS
LET PORTC = M REM INCREMENT THE MINUTE LED
PAUSE 60000
IF PORTA pin2 = 1 then PAUSE 60000 REM THIS MAKES A ONE MINUTE ADJUSTMENT
' TO INCREMENT THE MIN. LED LATER
PAUSE 60000
PAUSE 30000
NEXT M
LET PORTB = H REM INCREMENT THE HOUR LED
NEXT H
GOTO START REM REPEAT FOR ANOTHER 12 HOURS
 

westaust55

Moderator
Russlk,

Firstly welcome to the PICAXE forum.

Svejk has given you the solution.

Port B is the standard ouput port for the 28X1 and thus there is no need (or ability) to refer to that group of output pins as port B
Have a look at page 113 of the PICAXE manual 2 (V6.9). It is ether pins or pinc

Set/clear all outputs on the main output port (let pins = ). <=== This port B by default
Set/clear all outputs on portc (let pinsc =)
 
Last edited:

BCJKiwi

Senior Member
Good point Westy,

However, why the inconsistency?
Have previously suggested to Technical that they 'retrofit' PE to the X2 family port.pin syntax for all chips as an optional syntax.
Similarly a retrofit of a consistent handling of the pins/pinc/portX as an optional syntax would avoid the repeat questions and frustration to users of these areas for confusion.
 
Top