Odd & Even Parity generater from sequence of data

Thread Starter

AMIT_GOHEL

Joined Jul 13, 2010
67
hello,

i've made program to generate odd & even parity from given bunch of data(but here i've taken only for hex numbers for ex)..
but it's not working...

Rich (BB code):
    ORG 00H
    COUNT EQU 2                        ;totel hex size/2 (IN DESIMAL)
    DB 11H
    DB 00H
    DB 33H
    DB 22H                ;data

    MOV A,#00H                        ;acc initialization
    MOV DPTR,#0000H                      ;dptr loaded with even data address
    MOV R1,COUNT                    ;counter
    CALL LOOP1
    MOV R3,A                         ;even parity
    MOV A,#00H                            ;acc initialization
    MOV DPTR,#0001H                     ;dptr loaded with odd data address
    MOV R1,COUNT                       ;counter
    CALL LOOP1
    MOV R4,A                         ;odd parity

LOOP1:
LOOP: MOV A,#00H
      MOVC A,@A+DPTR
      ADD A,R2
      MOV R2,A
      INC DPTR
      CLR C
      DJNZ R1,LOOP
      RET

END
i'm using keil 4 for debugging..

when try to debug it sticks at 0000h location ...

thanks in advance...
 

eblc1388

Joined Nov 28, 2008
1,542
You haven't setup any stack pointer prior to using the CALL/RET instruction and your program execution falls through to the LOOP subroutine code.

Rich (BB code):
    MOV DPTR,#0001H                     ;dptr loaded with odd data address
    MOV R1,COUNT                       ;counter
    CALL LOOP1
    MOV R4,A                         ;odd parity

        ;<<<--- what instruction to execute next ????
  
LOOP1:
LOOP: MOV A,#00H
      MOVC A,@A+DPTR
      ADD A,R2
      MOV R2,A
      INC DPTR
      CLR C
      DJNZ R1,LOOP
      RET
 
Top