DS89C450 serial data transfer

Do you have a question? Post it now! No Registration Necessary

Threaded View

I am having serial port communications problems. Below is
the simple code in the DS89C450 MCU that I am trying to get to
work properly. It is a simple routine to receive data via the
serial port at 38400baud. I am trying to receive 65536 bytes. It
allways drops some of the data like it is falling behind the
serial stream. Most the time the 1st 1000 bytes seem fine then
one is missed and the data in memory is short a byte. This
happens many times after the 1st 1k bytes. I am using Visual C++
6.0 as my pc software to send data from the pc to the DS89C450. I
did find that I had to buffer the ALE line to the latches for
more reliability. Do I need to buffer the WR & RD also or add
pull-ups on other pins? According to the data sheet the
Address/Data lines dont need pull-ups if thats all there used
for. My MCU circuit is very simple and uses 1-DS89C450MNL,
2-74F573 latches for address, 1-IS62C1024AL-35 Ram, 1-74HCT32
used as a buffer for ALE, 1-MAX233CPP Rs232. I have A16 tied low
on Ram chip. If I insert a 1ms delay between characters sent by
the pc, it works fine. But that defeats the speed-up in
communications. I can verify that data is missing by dumping the memory
contents with another routine in the micro to send the last 256 bytes of
Out of 65536 bytes there is 7 bytes missing.

This is the code inside the DS89C450 MCU running at 29.491mhz

          pcon   equ 87h               ;address of PCON register
          scon1  equ 0c0h              ;address of SCON1 register
          sbuf1  equ 0c1h              ;address of SBUF1 register
          wdcon  equ 0d8h              ;address of WDCON register
          ckcon  equ 8eh               ;location of clock control
          org   0000h
          ljmp  start

          org   100h                   ;allways start ROM program at 0100h
   start: mov   scon,#50h              ;set serial port 0 to mode 1 with rec
          mov   tmod,#20h              ;set timer 1 as auto-reload 8-bit
          mov   th1,#0feh              ;baud rate equals 38400b at 29.491mhz
          mov   ie,#80h                ;do not enable serial interupt
          mov   tcon,#40h              ;start timer 1
          setb  ea                     ;global enable interrupts
          setb  p3.6                   ;set pull-up on WR
          setb  p3.7                   ;set pull-up on RD
          clr   ri                     ;ensure that receive interupt flag is
          clr   ti

    loop: jnb   ri,loop
          mov   a,sbuf
          clr   ri
          cjne  a,#01h,chka            ;01 = get job data from pc
          ljmp  getst
    chka: ljmp  loop

; ***** Get track / sector data from PC *****
   getst: clr   p1.0                   ;set RomA16 false
          clr   p1.4                   ;set RamA16 true
          setb  p1.2                   ;disable ROM
          clr   p1.3                   ;enable RAM
          mov   r1,#00h
          mov   dptr,#0000h
  getst1: mov   r2,#00h
  getst2: jnb   ri,getst1              ;wait for char from pc
          mov   a,sbuf
          clr   ri
          movx  @dptr,a
          inc   dptr
          djnz  r2,getst2
          djnz  r1,getst1              ;get 65536d bytes ff x ff
          ljmp  loop

Re: DS89C450 serial data transfer

Quoted text here. Click to load it

Most likely is you need a pullup pack on P0
No ALE buffer is required, or /Rd /Wr

Re: DS89C450 serial data transfer

Quoted text here. Click to load it
I think if it were an issue with P0 pullups the data would just be wrong in
some places.
Data is actually missing completely. I send 10000bytes and only 9997 are

Re: DS89C450 serial data transfer

Quoted text here. Click to load it
I don't think it is going to work properly without P0 pullups. It may or may
not fix his problem....but it has to be done.

Site Timeline