Interface a number of serial items using the built-in 8051 UART

Discussion in 'The Lounge' started by Amberrr, Mar 21, 2018.

  1. Amberrr

    Amberrr New Member

    Mar 21, 2018
    Likes Received:
    Trophy Points:
    I'm trying to interface a number of serial items using the built-in 8051 UART. I used the 74HC138 to output clocks to devices and 74HC251 to collect inputs.

    I am able to manipulate the output of the shift register pictured at the top-right but I have trouble interfacing with the ISD1700 series chip. When I attempted to execute the init command to the ISD1700, the error flag is always set (which it shouldn't be).

    This is the code I use to initialize the soundcard:
      mov BUFOUT,#1h ;init device
      mov BUFOUT+1,#0h
      mov A,#2h  ;2-byte init command
      mov P1,#0h ;address for sound
      clr P3.5   ;enable receiver
      setb P3.7  ;enable transmit
      setb REN   ;enable receiver internally
      ;use serial mode 0 (shift register mode. 307200bps)
      clr SM0
      clr SM1
      mov R7,A       ;A = # bytes to process
      mov R0,#BUFOUT ;set buffers to start
      mov R1,#BUFIN
    clr TI       ;clear transmit status
    mov SBUF,@R0 ;send byte starting with command byte
    clr RI       ;clear receive (Reception starts at this point or next clock?)
    jnb TI,$     ;stall until byte is transmitted (byte should receive in background?)
    mov A,#07Fh  ;Setup a 127 clock timeout
      dec A
    jz srcvtimeout2 ;jump=timeout occurred
    jnb RI,srcvtmr2 ;or stall until byte received
    mov @R1,SBUF ;Store whatever we got regardless of timeout status
    inc R1       ;and increment both pointers
    inc R0
      djnz R7,tx2    ;repeat process for all bytes
      clr REN        ;disable internal receiver
      clr P3.7       ;disable transmitter
      setb P3.5      ;disable receiver
    and when I want to power it down (reset), I change the 1h in the first line to 7h (for reset).

    But the statuses aren't correct.

    The only couple of things that come to my mind are that my timing of data reception in software is off, or the internal pull-up resistor on the 8051 RXD (data) line is weak (or should be pulled down?) or the timing of sending commands is wrong?

    I'm using an AT89C4051's( serial mode 0 (shift register mode) with a clock speed of 3.6Mhz (micro is attached to another micro's ALE line with its clock speed at 22Mhz), so I couldn't really increase the processing speed here.

    So what am I doing wrong here?

    P.S. I did make the SOUND_SELECT line low before sending each command and made it high again after the command was fully sent.
  2. mollydyer

    mollydyer Senior Member

    May 29, 2017
    Likes Received:
    Trophy Points:
    I wanna say it's spam, but... da faq?

Share This Page