        org     0000h
        jmp     0050h
	
	$MOD51GB
PWMSON  equ     R2

;        org     803bh
;        jmp     A2D_ISR

        org     0030h
        db      21h,2dh,3bh,48h,56h,62h

        org     0050h
main:   mov     P1,#0FFh        ;initialize port 1
        mov     PWMSON,#015h    ;turn sonar to 90 right
        mov     CCAP0h,PWMSON   ;load PWM register with PW value
;        call    PCA_INIT        ;initlialize the PWM

        mov     ACON,#010h      ;enable A2D operation
;        mov     IEA,#080h      ;enable the A2D interrupt
;        setB    EA             ;enable all interrupts
;        call    lngDelay
;        call    lngDelay
;        call    lngDelay
;        call    lngDelay

        mov     DPTR,#0030h
        mov     R1, #06h

son_cyc:
        call    son_out
        movx    A,@DPTR
        mov     CCAP0h,A
        inc     DPTR
        djnz    R1, son_cyc



        jmp     main


son_out:
        ret
              

        end
