From: Spehro Pefhany
Subject: Re: Max232 and 8051 drivin' me crazy
References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com>
X-Newsreader: Forte Agent 1.92/32.572
Date: Fri, 27 Dec 2002 12:56:48 GMT
NNTP-Posting-Date: Fri, 27 Dec 2002 07:56:48 EST
On Fri, 27 Dec 2002 17:29:21 +1100, the renowned "Michael Culley"
>> Ja, try unplugging the 8032 and look at the MAX outputs with a meter,
>> jumper the inputs to 0/5V, output should be the inverted level-shifted
>> version. Check that +/-V are +/-9 or whatever at the chip.
>For 5V in I get -9.46 Volts out, for 0V in I get 9.32 out, is this about
>> Put a
>> 'scope on the 8032 Txd output pin and make sure that *something* is
>> happening (is /EA pulled low?).
>I wish I had one, I could really tell what is going on then. I know the
>circuit works because I ran a program on it to slowly toggle some of the
>pins of the 8051 and that worked. When I put a volt meter on Txd it jumps
>around from anywhere between 0 and 5V, so it must be doing something.
Okay, crude, but I've used that method when desperate.
>seams to me that it is jumping around too slowly though, if it was running
>at 2400baud I would have thought it would give a fairly steady voltage of,
>say, 2.5Volts. EA is pulled low.
>> Also, your program is not a loop, so chances are it produces, at
>> best, one character when the reset is lifted. I have not looked at it
>> further than that.
>You may have misread it?
Perhaps, see why in the changes to that part below
Okay I've added some comments and made a couple of changes.
(note that power-up values in most SFRs are 0x00).
; *warning* untested code
; we have a 12 MHz crystal
.org 0000h ; cold start
mov scon, #40h ; set 8-bit UART mode 1
; recieve off
mov tmod, #20h ; timer 1 autoreload
anl pcon,#7fh ; clear SMOD if not already
mov th1,#0f3h ; set baud rate to 2403 baud
setb tr1 ; start timer 1
xmit: mov sbuf,#041h ; send an 'A'
wait: jbc ti,wait ; wait until TI flag is set
clr ti ; TI must be reset by software
sjmp xmit ; loop forever
"it's the network..." "The Journey is the reward"
firstname.lastname@example.org Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com