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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [xilinx_diligent_s3board/] [software/] [ta_uart/] [swuart.s] - Diff between revs 28 and 143

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

Rev 28 Rev 143
Line 1... Line 1...
 
 
#include "hardware.h"
#include "hardware.h"
 
 
;variables
;variables
.data
.data
        .comm   rxdata,1,1              ;char var
        .comm   rxdata,1,1              ;char var
        .comm   rxshift,1,1             ;char var
        .comm   rxshift,1,1             ;char var
        .comm   rxbit,2,2               ;short var, aligned
        .comm   rxbit,2,2               ;short var, aligned
 
 
.text
.text
 
 
interrupt(TIMERA0_VECTOR)               ;register interrupt vector
vector_0x0012:
 
;interrupt(TIMERA0_VECTOR)               ;register interrupt vector
;interrupt handler to receive as Timer_A UART
;interrupt handler to receive as Timer_A UART
.global ccr0                            ;place a label afterwards so
.global ccr0                            ;place a label afterwards so
ccr0:                                   ;that it is used in the listing
ccr0:                                   ;that it is used in the listing
        add     rxbit, r0
        add     &rxbit, r0
        jmp     .Lrxstart               ;start bit
        jmp     .Lrxstart               ;start bit
        jmp     .Lrxdatabit             ;D0
        jmp     .Lrxdatabit             ;D0
        jmp     .Lrxdatabit             ;D1
        jmp     .Lrxdatabit             ;D1
        jmp     .Lrxdatabit             ;D2
        jmp     .Lrxdatabit             ;D2
        jmp     .Lrxdatabit             ;D3
        jmp     .Lrxdatabit             ;D3
Line 23... Line 25...
        jmp     .Lrxdatabit             ;D6
        jmp     .Lrxdatabit             ;D6
;        jmp     .Lrxlastbit             ;D7 that one is following anyway
;        jmp     .Lrxlastbit             ;D7 that one is following anyway
 
 
.Lrxlastbit:                            ;last bit, handle byte
.Lrxlastbit:                            ;last bit, handle byte
        bit     #SCCI, &CCTL0           ;read last bit
        bit     #SCCI, &CCTL0           ;read last bit
        rrc.b   rxshift                 ;and save it
        rrc.b   &rxshift                 ;and save it
        clr     rxbit                   ;reset state
        clr     &rxbit                   ;reset state
        mov     #CCIE|CAP|CM_2|CCIS_1|SCS, &CCTL0   ;restore capture mode
        mov     #CCIE|CAP|CM_2|CCIS_1|SCS, &CCTL0   ;restore capture mode
        mov.b   rxshift, rxdata         ;copy received data
        mov.b   &rxshift, &rxdata         ;copy received data
        bic     #CPUOFF|OSCOFF|SCG0|SCG1, 0(r1) ;exit all lowpower modes
        bic     #CPUOFF|OSCOFF|SCG0|SCG1, 0(r1) ;exit all lowpower modes
        ;here you might do other things too, like setting a flag
        ;here you might do other things too, like setting a flag
        ;that the wakeup comes from the Timer_A UART. however
        ;that the wakeup comes from the Timer_A UART. however
        ;it should not take longer than one bit time, otherwise
        ;it should not take longer than one bit time, otherwise
        ;charcetrs will be lost.
        ;charcetrs will be lost.
        reti
        reti
 
 
.Lrxstart:                              ;startbit, init
.Lrxstart:                              ;startbit, init
        clr     rxshift                 ;clear input buffer
        clr     &rxshift                 ;clear input buffer
        add     #(BAUD/2), &CCR0        ;startbit + 1.5 bits -> first bit
        add     #(BAUD/2), &CCR0        ;startbit + 1.5 bits -> first bit
        mov     #CCIE|CCIS_1|SCS, &CCTL0;set compare mode, sample bits
        mov     #CCIE|CCIS_1|SCS, &CCTL0;set compare mode, sample bits
        jmp     .Lrxex                  ;set state,...
        jmp     .Lrxex                  ;set state,...
 
 
.Lrxdatabit:                            ;save databit
.Lrxdatabit:                            ;save databit
        bit     #SCCI, &CCTL0           ;measure databit
        bit     #SCCI, &CCTL0           ;measure databit
        rrc.b   rxshift                 ;rotate in databit
        rrc.b   &rxshift                 ;rotate in databit
 
 
.Lrxex: add     #BAUD, &CCR0            ;one bit delay
.Lrxex: add     #BAUD, &CCR0            ;one bit delay
        incd    rxbit                   ;setup next state
        incd    &rxbit                   ;setup next state
        reti
        reti
 
 
; void serPutc(char)
; void serPutc(char)
;use an other Capture/Compare than for receiving (full duplex).
;use an other Capture/Compare than for receiving (full duplex).
;this one is without interrupts and OUTMOD, because only
;this one is without interrupts and OUTMOD, because only

powered by: WebSVN 2.1.0

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