mylim

SCI problem

Discussion created by mylim on Jul 9, 2007
Latest reply on Jul 29, 2007 by bigmac
Hi, i wrote my code as below; but somehow when i single step thru i can't see my the data i sending out loaded in the data register.
I' using the SCI to drive a sipex SP485.
I inititalise the SCI as ;
4807baud
SCI2BDH = $00
SCI2BDL = $1A
SCI2C1    = $40
SCI2C1    = $2C
SCI2C3    = $00
 
Code:
;--------------------;TX485 Routine;--------------------tx485       bset   RS485EN2,PTCD            bset   SCI2C2_TE,SCI2C2            jsr    idelay            jsr    idelay            clr    TXCHK            lda    TXADRtx485a      brclr  SCI2S1_TDRE,SCI2S1,tx485a            sta    SCI2D            add    TXCHK            sta    TXCHK            rts  ;--------------------;TX Data;--------------------txdata      lda    CARDADR            sta    TXADR                         jsr    tx485            lda    #$3C            jsr    tx485a            lda    #$07            jsr    tx485a            lda    #$07            jsr    tx485a            lda    #$07            jsr    tx485a            lda    #$07            jsr    tx485a            lda    TXCHK            and    #$7F            jsr    tx485atxdata2     brclr  SCI2S1_TC,SCI2S1,txdata2            jsr    idelayh            bclr   RS485EN2,PTCD

 
When i try to read SCI2D, it doesnt tally with the data i loaded.
Are there something wrong at my 'tx485a'?
Please advise.
Thanks.


Message Edited by mingyee on 2007-07-09 06:17 PM

Outcomes