Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

8051 assembler (compile error)

rodemmrodemm Member Posts: 44
I just started to program a small program for the AT89C2051 but I get an error at line 90 with the SETB instruction.

-- fragment of code --
MAIN: ;main program (on power up, program starts at this point)
ACALL INITIALIZE ;set up control registers
LOOP:
MOV A,0B6H ;P3.6 ;
JNZ UIT ; jump
AAN:
;MOV C, P1.7 ;
SETB 097H ; C ;pinnetje 1 hoog
JMP VERDER
UIT:
CLR 097H ;pinnetje 1 laag
VERDER:
AJMP LOOP ;go to LOOP(jump back to point labeled LOOP)
.END
-- end fragment of code --

Do you have any idea what might be wrong with the statement SETB, it should put a 1 on port 1.7

Comments

  • peretperet Member Posts: 69
    : Do you have any idea what might be wrong with the statement SETB, it should put a 1 on port 1.7

    Are you quite sure it's the SETB instruction? It's an unusual syntax - most people would write it as:
    SETB P1.7
    .. But if SETB 097H caused an error, so would CLR 097H later on.

    More likely the trouble is with the line:
    MOV A,0B6H
    .. as MOV of a single bit into a register isn't allowed.

    [code]
    ; -- fragment of code --
    MAIN: ;main program (on power up, program starts at this point)
    ACALL INITIALIZE ;set up control registers
    LOOP:
    MOV A,0B6H ;P3.6 ;
    JNZ UIT ; jump
    AAN:
    ;MOV C, P1.7 ;
    SETB 097H ; C ;pinnetje 1 hoog
    JMP VERDER
    UIT:
    CLR 097H ;pinnetje 1 laag
    VERDER:
    AJMP LOOP ;go to LOOP(jump back to LOOP)
    .END
    ; -- end fragment of code --
    [/code]


Sign In or Register to comment.