OpenCores
URL https://opencores.org/ocsvn/8051/8051/trunk

Subversion Repositories 8051

[/] [8051/] [trunk/] [asm/] [serial_test.asm] - Diff between revs 51 and 131

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 51 Rev 131
Line 5... Line 5...
; r3 - receive test
; r3 - receive test
; r4 - pcon
; r4 - pcon
;
;
        ajmp start;
        ajmp start;
 
 
        .org 03h        ;external interrupt 0
        org 03h         ;external interrupt 0
        reti;
        reti;
 
 
        .org 0bh        ;t/c 0 interrupt
        org 0bh         ;t/c 0 interrupt
        setb p3.1       ;
        setb p3.1       ;
        clr p3.1        ;
        clr p3.1        ;
        reti;
        reti;
 
 
        .org 13h        ;external interrupt 1
        org 13h         ;external interrupt 1
        reti;
        reti;
 
 
        .org 1bh        ;t/c 1 interrupt
        org 1bh         ;t/c 1 interrupt
        reti;
        reti;
 
 
        .org 23h        ;serial interface interrupt
        org 23h         ;serial interface interrupt
        clr scon.4              ;
        clr scon.4              ;
        clr scon.0              ;
        clr scon.0              ;
        clr scon.1              ;
        clr scon.1              ;
  inc b         ;
  inc b         ;
        reti;
        reti;
Line 33... Line 33...
wait:
wait:
        mov a,b         ;
        mov a,b         ;
        jz wait         ;
        jz wait         ;
        ret             ;
        ret             ;
 
 
 
wait_txd:
 
        movx a, @r0             ;
 
        jnb acc.1, wait_txd     ;
 
        ret             ;
 
 
 
 
        nop;
        nop;
        nop;
        nop;
 
 
test_txd:
test_txd:
        clr c           ;
        clr c           ;
Line 77... Line 83...
;
;
        mov scon, #000h ; mode 0
        mov scon, #000h ; mode 0
        mov b,#000h     ;
        mov b,#000h     ;
        mov a, #010h    ;
        mov a, #010h    ;
        mov r2, #06ch   ;
        mov r2, #06ch   ;
        movx @r0, a     ;
 
        mov sbuf, r2    ; transmit 6c
        mov sbuf, r2    ; transmit 6c
 
        movx @r0, a     ;
        acall wait      ;
        acall wait      ;
        acall test_txd  ;
        acall test_txd  ;
        mov c, p3.0     ;
        mov c, p3.0     ;
        jnc error       ;
        jnc error       ;
;
;
Line 154... Line 160...
        mov r3, a               ;
        mov r3, a               ;
        setb tcon.4             ;
        setb tcon.4             ;
        setb tcon.6             ;
        setb tcon.6             ;
        movx @r1, a             ;
        movx @r1, a             ;
        acall wait              ;
        acall wait              ;
 
        acall wait_txd          ;
 
 
        clr tcon.4              ;
        clr tcon.4              ;
        clr tcon.6              ;
        clr tcon.6              ;
        acall test_rxd          ;
        acall test_rxd          ;
        mov 7fh, #005h          ; error 5
        mov 7fh, #005h          ; error 5
        mov c, scon.2           ;
        mov c, scon.2           ;
        jnc error               ;
        jnc error               ;
 
 
 
 
 
 
;
;
; transmit / receive
; transmit / receive
;
;
        mov b,#000h             ;
        mov b,#000h             ;
        mov ie, #082h           ;
        mov ie, #082h           ;
Line 314... Line 325...
        mov r3, a               ;
        mov r3, a               ;
        movx @r1, a             ;
        movx @r1, a             ;
        setb tcon.4             ;
        setb tcon.4             ;
        setb tcon.6             ;
        setb tcon.6             ;
        acall wait              ;
        acall wait              ;
 
        acall wait_txd          ;
 
 
        clr tcon.4              ;
        clr tcon.4              ;
        clr tcon.6              ;
        clr tcon.6              ;
        acall test_rxd          ;
        acall test_rxd          ;
        mov 7fh, #011h          ; error 11
        mov 7fh, #011h          ; error 11
        mov c, scon.2           ;
        mov c, scon.2           ;
Line 350... Line 363...
        acall test_rxd          ;
        acall test_rxd          ;
        clr scon.1              ;
        clr scon.1              ;
        clr scon.0              ;
        clr scon.0              ;
        mov 7fh, #014h          ; error 14
        mov 7fh, #014h          ; error 14
        mov c, scon.2           ;
        mov c, scon.2           ;
        jc error1               ;
        jc error2               ;
        movx a, @r0             ;
        movx a, @r0             ;
        subb a, #0d7h           ;
        subb a, #0d7h           ;
 
 
 
done:
        mov p0, #03h            ;
        mov p0, #03h            ;
 
        ajmp done               ;
 
 
 
error2:
 
        ljmp error              ;
 
 
 
 
 
        end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.