Connect with us

Problem with UART SCC2691

Discussion in 'General Electronics' started by Terry, Feb 5, 2004.

  1. Terry

    Terry Guest

    Hi all,

    I am doing a project with a 8051 and SCC2691
    Can any body show me how to use a 8051 to send data to a pc with the SCC2691
    I have tried for almost 4 months but I still cannot make it.
    here is the simplified schematic

    http://www.ee.cuhk.edu.hk/~s017281/schematic6.gif


    Thank you
     
  2. Terry,

    Find the datasheet of this chip at:

    http://www.philipsmcu.com/acrobat/datasheets/SCC2691_2.pdf

    First make sure your timing is correct. Especially the bustiming is
    important.

    Second you have to initialise the chip. Check wether you can write data to
    the registers and read back. (Not all registers can be read back. Check the
    datasheet.)

    Try to send data. A resistor-led combination as sold to check serial lines
    is very usefull for it.

    petrus
     
  3. Terry

    Terry Guest

    Dear Petus,

    Thanks for your advices. Do you think that this programme can
    initialize the IC ? Please help me as I've tried for a long time.

    Thank you very much


    #include <sfr51.inc>
    ;------------------------------------------------
    LF EQU 0AH ;Line Feed
    CR EQU 0DH ;Carriage Return
    ;------------------------------------------------
    ORG 00H
    MOV SP,#60H
    ;------------------------------------------------
    BEGIN: LCALL I_LCD
    LCALL Clear_LCD
    ;------------------------------------------------
    CLR P2.1 ;enable read
    SETB P2.0 ;disable write
    ;------------------------------------------------
    CLR P2.4 ;A2=0
    SETB P2.3 ;A1=1
    CLR P2.2 ;A0=0
    MOV P1, #00110000B ;CR reset TX
    MOV P1, #00100000B ;CR reset RX
    MOV P1, #00011010B ;CR reset MR pointer,
    disable TX, RX
    ;------------------------------------------------
    CLR P2.4 ;A2=0
    CLR P2.3 ;A1=0
    CLR P2.2 ;A0=0
    MOV P1, #00010011B ;MR1 no parity, 8bits
    MOV P1, #00000111B ;MR2 normal, stop bit
    length 1
    ;------------------------------------------------
    CLR P2.4 ;A2=0
    CLR P2.3 ;A1=0
    SETB P2.2 ;A0=1
    MOV P1, #10111011B ;CSR 9600 baud
    ;------------------------------------------------
    SETB P2.4 ;A2=1
    CLR P2.3 ;A1=0
    CLR P2.2 ;A0=0
    MOV P1, #10111000B ;ACR 10111---
    ;------------------------------------------------
    CLR P2.4 ;A2=0
    SETB P2.3 ;A1=1
    CLR P2.2 ;A0=0
    MOV P1, #00000101B ;CR enable TX, RX
    ;------------------------------------------------
    CLR P2.4 ;A2=0
    SETB P2.3 ;A1=1
    SETB P2.2 ;A0=1
    ;------------------------------------------------
    MOV DPTR, #MESS1
    ;------------------------------------------------
    FILL: CLR A
    MOVC A, @A+DPTR
    CJNE A, #0, L1
    RET

    L1: MOV P1, A
    INC DPTR
    ;------------------------------------------------
    SETB P2.1 ;disable read
    CLR P2.0 ;enable write
    CLR P2.4 ;A2=0
    CLR P2.3 ;A1=0
    SETB P2.2 ;A0=1
    wait_uart: MOV B, P1
    JNB B.2,wait_uart
    ;------------------------------------------------
    ;------------------------------------------------
    CLR P2.1 ;enable read
    SETB P2.0 ;disable write
    CLR P2.4 ;A2=0
    SETB P2.3 ;A1=1
    SETB P2.2 ;A0=1
    ;------------------------------------------------
    SJMP FILL
    RET
    ;------------------------------------------------
    MESS1: DB "SCC2691_new_test;",LF,CR,0
    ;------------------------------------------------
    END
     
  4. Terry,

    Saw a reply but it was removed from the server before I could open it.
    (Newsserver of my provider is really bad, but it's the only
    broadbandprovider in this place so I have no choice.)

    petrus
     
  5. Tim Dicus

    Tim Dicus Guest

    Hi Terry,

    I think you are not using the write and read strobes correctly. If you wish to write, you need to do something like this:

    SETB P2.1 ;disable read strobe line
    SETB P2.0 ;disable write strobe line

    ;set destination address for byte 1
    CLR P2.4 ;A2=0
    SETB P2.3 ;A1=1
    CLR P2.2 ;A0=0

    MOV P1, #00110000B ;Move byte 1 to P1 register

    CLR P2.0 ;enable write strobe
    ;put delay here to meet write strobe timing requirements
    SETB P2.0 ;disable write strobe

    ;set destination address for byte 2
    CLR P2.4 ;A2=0
    SETB P2.3 ;A1=1
    CLR P2.2 ;A0=1

    MOV P1, #00100000B ;Move byte 2 data to P1

    CLR P2.0 ;enable write strobe
    ;put delay here to meet write strobe timing requirements
    SETB P2.0 ;disable write strobe

    ;end of example

    Reading is almost the same, except CLR the read strobe, wait a bit, then SET the read strobe, then retreive the data at P1.

    The addresses I used in the examples above are probably not correct. I used them as examples only. If I get a chance, I will take a
    look at the register setup on the UART.

    See if you can redo the code with the new read and write strobe controls and post it here. I'll help ya !^)

    Tim
     
  6. Terry

    Terry Guest

    hi petrus and tim,

    the ic works now.
    thank you very much for your kindly help !!



    Terry
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-