Shop OBEX P1 Docs P2 Docs Learn Events
error message code example — Parallax Forums

error message code example

ArchiverArchiver Posts: 46,084
edited 2004-01-31 23:57 in General Discussion
hi guys, here is the code which produced the" end of line error". the
error appeared on line #2 after 'reset counter via MCR register, the
character CS=0, popped up as the problem. this is based on an example
posted about two weeks ago.
thanks, mark

'{$STAMP BS2}
'LS7166 TRYOUT 1/29/04
'REVISION HISTORY;

'VARIABLES
ENC_COUNT VAR Word 'WORD to hold encoder count ls bytes
ENC_COUNTHI VAR Byte 'BYTE to hold encount ms byte

'PIN ASSIGNMENTS

'Set initial STAMP2 I/O conditions
DIRS = $0F00 'I/O pins 0-7, 8-11 OUT
OUTC = $F 'LS7166 CD=1, WR=1, RD=1, CS=1(0 true)

'Setup LS7166 initial conditions
RESET:
DIRL = $FF 'LS7166 bus = output
'Set OCCR count control register
OUTL = $80 'count normal binary
OUTC = $C 'CD=1, RD=1, WR=0, CS=0
OUTC = $F 'CD=1, RD=1 WR=1 CS=1
'Set QR register
OUTL = $C3 'quadrature X4 mode
OUTC = $C 'CD=1, RD=1, WR=0, CS=0
OUTC = $F 'CD=1, RD=1, WR=1, CS=1
'Set ICR input control register
OUTL = $48 'enable A & B inputs
OUTC = $C 'CD=1, RD=1, WR=0, CS=0
OUTC = $F 'CD=1, RD=1, WR=1, CS=1
'Reset counter via MCR register
OUTL = $04 'reset counter
OUTC = $C 'CD=1, RD=1, WR=0, CS=0
OUTC = $F 'CD=1, RD=1, WR=1, CS=1

'Main program loop
LOOP:
GOSUB READ_ENCODER

GOTO LOOP

'SUBROUTINES
'Reset address pointer and transfer count to OUTPUT LATCH
DIRL = $FF 'bus is output
OUTL = $3 'reset OL address pointer, transfer CNTR to OL
OUTC = $C 'CD=1, RD=1, WR=0, CS=0
OUTC = $7 'CD=0, RD=1, WR=1, CS=1
'Read encoder
DIRL = $00 'bus is input
OUTC = $2 'CD=0, RD=0, WR=1, CS=0
'Read encoder
DIRL = $00 'bus is input
OUTC = $2 'CD=0, RD=0, WR=1, CS=0

ENCODER_COUNT.LOWBYTE = INL 'Read ls byte of
encoder
OUTC = $6 'CD=0, RD=1, WR=1, CS=0
OUTC = $2 'CD=0, RD=0, WR=1, CS=0

ENCODER_COUNT.HIGHBYTE = INL 'Read mid byte of encoder
OUTC = $6 'CD=0, RD=1, WR=1, CS=0
OUTC = $2 'CD=0, RD=0, WR=1, CS=0

ENCODER_COUNTHI = INL 'Read
high byte of encoder
OUTC = $6 'CD=0, RD=1, WR=1, CS=0
OUTC = $7 'CD=0, RD=1, WR=1, CS=1

RETURN

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-01-31 23:16
    At 10:20 PM 1/31/04 +0000, lakewood5982003 wrote:
    >hi guys, here is the code which produced the" end of line error". the
    >error appeared on line #2 after 'reset counter via MCR register, the
    >character CS=0, popped up as the problem. this is based on an example
    >posted about two weeks ago.
    >thanks, mark

    Mark -

    You have at least two undefined variables which I've noted below. They probably
    should be referencing ENC_COUNT not ENCODER_COUNT .

    Regards,

    Bruce Bates


    >'{$STAMP BS2}
    >'LS7166 TRYOUT 1/29/04
    >'REVISION HISTORY;
    >
    >'VARIABLES
    >ENC_COUNT VAR Word 'WORD to hold encoder count ls bytes
    >ENC_COUNTHI VAR Byte 'BYTE to hold encount ms byte
    >
    >'PIN ASSIGNMENTS
    >
    >'Set initial STAMP2 I/O conditions
    >DIRS = $0F00 'I/O pins 0-7, 8-11 OUT
    >OUTC = $F 'LS7166 CD=1, WR=1, RD=1, CS=1(0 true)
    >
    >'Setup LS7166 initial conditions
    > RESET:
    > DIRL = $FF 'LS7166 bus = output
    > 'Set OCCR count control register
    > OUTL = $80 'count normal binary
    > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > OUTC = $F 'CD=1, RD=1 WR=1 CS=1
    > 'Set QR register
    > OUTL = $C3 'quadrature X4 mode
    > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    > 'Set ICR input control register
    > OUTL = $48 'enable A & B inputs
    > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    > 'Reset counter via MCR register
    > OUTL = $04 'reset counter
    > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    >
    >'Main program loop
    > LOOP:
    > GOSUB READ_ENCODER
    >
    > GOTO LOOP
    >
    >'SUBROUTINES
    > 'Reset address pointer and transfer count to OUTPUT LATCH
    > DIRL = $FF 'bus is output
    > OUTL = $3 'reset OL address pointer, transfer CNTR to OL
    > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > OUTC = $7 'CD=0, RD=1, WR=1, CS=1
    > 'Read encoder
    > DIRL = $00 'bus is input
    > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    > 'Read encoder
    > DIRL = $00 'bus is input
    > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    >
    >ENCODER_COUNT.LOWBYTE = INL 'Read ls byte of **<=== UNDEFINED VARIABLE
    >encoder
    > OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    >
    >ENCODER_COUNT.HIGHBYTE = INL 'Read mid byte of encoder **<=== UNDEFINED
    VARIABLE
    > OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    >
    >ENCODER_COUNTHI = INL 'Read
    >high byte of encoder
    > OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    > OUTC = $7 'CD=0, RD=1, WR=1, CS=1
    >
    >RETURN
    >
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    >Yahoo! Groups Links
    >
    >To visit your group on the web, go to:
    > http://groups.yahoo.com/group/basicstamps/
    >
    >To unsubscribe from this group, send an email to:
    > basicstamps-unsubscribe@yahoogroups.com
    >
    >Your use of Yahoo! Groups is subject to:
    > http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-31 23:57
    Hi Mark,

    Your subroutine(s) also has (have) no label(s).

    I modified your code by changing the undifined variable Bruce noticed
    and I put in a label for the subroutine.

    The result is shown below and it compiles without error, on my system.

    Good luck,

    Klaus


    '{$STAMP BS2}
    'LS7166 TRYOUT 1/29/04
    'REVISION HISTORY;

    'VARIABLES
    ENC_COUNT VAR Word 'WORD to hold encoder count ls bytes
    ENC_COUNTHI VAR Byte 'BYTE to hold encount ms byte

    'PIN ASSIGNMENTS

    'Set initial STAMP2 I/O conditions
    DIRS = $0F00 'I/O pins 0-7, 8-11 OUT
    OUTC = $F 'LS7166 CD=1, WR=1, RD=1, CS=1(0 true)

    'Setup LS7166 initial conditions
    RESET:
    DIRL = $FF 'LS7166 bus = output
    'Set OCCR count control register
    OUTL = $80 'count normal binary
    OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    OUTC = $F 'CD=1, RD=1 WR=1 CS=1
    'Set QR register
    OUTL = $C3 'quadrature X4 mode
    OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    'Set ICR input control register
    OUTL = $48 'enable A & B inputs
    OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    'Reset counter via MCR register
    OUTL = $04 'reset counter
    OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    OUTC = $F 'CD=1, RD=1, WR=1, CS=1

    'Main program loop
    LOOP:
    GOSUB READ_ENCODER

    GOTO LOOP

    'SUBROUTINES
    READ_ENCODER:
    'Reset address pointer and transfer count to OUTPUT LATCH
    DIRL = $FF 'bus is output
    OUTL = $3 'reset OL address pointer, transfer CNTR to OL
    OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    OUTC = $7 'CD=0, RD=1, WR=1, CS=1
    'Read encoder
    DIRL = $00 'bus is input
    OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    'Read encoder
    DIRL = $00 'bus is input
    OUTC = $2 'CD=0, RD=0, WR=1, CS=0

    ENC_COUNT.LOWBYTE = INL 'Read ls byte of
    encoder
    OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    OUTC = $2 'CD=0, RD=0, WR=1, CS=0

    ENC_COUNT.HIGHBYTE = INL 'Read mid byte of encoder
    OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    OUTC = $2 'CD=0, RD=0, WR=1, CS=0

    ENC_COUNTHI = INL 'Read
    'HIGH Byte of encoder
    OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    OUTC = $7 'CD=0, RD=1, WR=1, CS=1

    RETURN--- In basicstamps@yahoogroups.com, Bruce Bates <bvbates@u...>
    wrote:
    > At 10:20 PM 1/31/04 +0000, lakewood5982003 wrote:
    > >hi guys, here is the code which produced the" end of line error".
    the
    > >error appeared on line #2 after 'reset counter via MCR register,
    the
    > >character CS=0, popped up as the problem. this is based on an
    example
    > >posted about two weeks ago.
    > >thanks, mark
    >
    > Mark -
    >
    > You have at least two undefined variables which I've noted below.
    They probably
    > should be referencing ENC_COUNT not ENCODER_COUNT .
    >
    > Regards,
    >
    > Bruce Bates
    >
    >
    > >'{$STAMP BS2}
    > >'LS7166 TRYOUT 1/29/04
    > >'REVISION HISTORY;
    > >
    > >'VARIABLES
    > >ENC_COUNT VAR Word 'WORD to hold encoder count ls
    bytes
    > >ENC_COUNTHI VAR Byte 'BYTE to hold encount ms byte
    > >
    > >'PIN ASSIGNMENTS
    > >
    > >'Set initial STAMP2 I/O conditions
    > >DIRS = $0F00 'I/O pins 0-7, 8-11 OUT
    > >OUTC = $F 'LS7166 CD=1, WR=1, RD=1, CS=1(0 true)
    > >
    > >'Setup LS7166 initial conditions
    > > RESET:
    > > DIRL = $FF 'LS7166 bus = output
    > > 'Set OCCR count control register
    > > OUTL = $80 'count normal binary
    > > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > > OUTC = $F 'CD=1, RD=1 WR=1 CS=1
    > > 'Set QR register
    > > OUTL = $C3 'quadrature X4 mode
    > > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > > OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    > > 'Set ICR input control register
    > > OUTL = $48 'enable A & B inputs
    > > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > > OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    > > 'Reset counter via MCR register
    > > OUTL = $04 'reset counter
    > > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > > OUTC = $F 'CD=1, RD=1, WR=1, CS=1
    > >
    > >'Main program loop
    > > LOOP:
    > > GOSUB READ_ENCODER
    > >
    > > GOTO LOOP
    > >
    > >'SUBROUTINES
    > > 'Reset address pointer and transfer count to OUTPUT LATCH
    > > DIRL = $FF 'bus is output
    > > OUTL = $3 'reset OL address pointer, transfer CNTR
    to OL
    > > OUTC = $C 'CD=1, RD=1, WR=0, CS=0
    > > OUTC = $7 'CD=0, RD=1, WR=1, CS=1
    > > 'Read encoder
    > > DIRL = $00 'bus is input
    > > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    > > 'Read encoder
    > > DIRL = $00 'bus is input
    > > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    > >
    > >ENCODER_COUNT.LOWBYTE = INL 'Read ls byte of **<===
    UNDEFINED VARIABLE
    > >encoder
    > > OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    > > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    > >
    > >ENCODER_COUNT.HIGHBYTE = INL 'Read mid byte of encoder **<===
    UNDEFINED VARIABLE
    > > OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    > > OUTC = $2 'CD=0, RD=0, WR=1, CS=0
    > >
    > >ENCODER_COUNTHI =
    INL 'Read
    > >high byte of encoder
    > > OUTC = $6 'CD=0, RD=1, WR=1, CS=0
    > > OUTC = $7 'CD=0, RD=1, WR=1, CS=1
    > >
    > >RETURN
    > >
    > >
    > >
    > >To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > >from the same email address that you subscribed. Text in the
    Subject and Body of the message will be ignored.
    > >
    > >
    > >Yahoo! Groups Links
    > >
    > >To visit your group on the web, go to:
    > > http://groups.yahoo.com/group/basicstamps/
    > >
    > >To unsubscribe from this group, send an email to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > >
    > >Your use of Yahoo! Groups is subject to:
    > > http://docs.yahoo.com/info/terms/
Sign In or Register to comment.