Home » questions » microcontroller 89C52 programming problem?

microcontroller 89C52 programming problem?

2006-08-04 14:48:12, Category: Programming & Design
I’m programming the ATMEL 89C52 using its assembly language and I have a problem making part of a program... I want to compare two values stored in two different registers, say R0 and R1 and I want to make a program that would do the function of: CJNE R0,R1,HERE I tried putting one of the two values in the accumulator A but it didn't work as I’m still getting "unknown instruction" error each time I run the assembler please help CJNE A,R0,HERE didn't work either

Answers

  1. vazk

    On 2006-08-05 06:11:44


    first move data in acc to B reg' and then use command "CJNE A,DIRECT,HERE " instead of "CJNE R0,R1,HERE". already you know that DIRECT is direct address of SFR reg'. here direct address of R0 (bank0) is 00h so,you can program as CJNE A,00h,HERE byeeeeeeeeeeeee.........
  2. justme

    On 2006-08-05 07:03:59


    did you put A in the right place in the instruction? A should be first. MOV A,R0 CJNE A,R1,HERE instead of CJNE R1,A,HERE