| ??? 02/23/03 04:48 Read: times |
#39816 - serial port Hello World problem |
Hi all...
I'm running an Atmel AT89C52 at 11.059Mhz and I have it wired up to a Max232, and that's pretty much it. I'm trying to get it to output "HELLO WORLD " to my computer's serial port, but something's not quite right, and it's driving me crazy. "ougga¿Qa[gw¿¿" -- I get this "HELLO WORLD " -- I want this Now, I figure I must have the speed (300 baud) working right, because I get the exact same text over and over again, and it's the same length as the string I'm sending, and there's a one-to-one correlation between the characters expected and the characters received. So I think there must be something else wrong with the stop/start bits or something like that. I've tried a bunch of different things, and I can't quite get it, and I didn't find the answer searching the archives. On the computer, I'm using HyperTerminal with these settings: 300 baud 8/N/1 and no flow control and ANSI Here's the code I'm using: .org 0x0000 mov TMOD, #20H ;T1 is mode2 mov TH1, #-96 ; 300 baud mov SCON, #50H ;8b, 1stop, 1start, REN enabled setb TR1 ;start timer T1 clr TI ;clear the "transmitted" bit hello: mov SBUF, #'H' ;gimme an H! acall wait ;wait until the letter is sent mov SBUF, #'E' acall wait mov SBUF, #'L' acall wait mov SBUF, #'L' acall wait mov SBUF, #'O' acall wait mov SBUF, #' ' ;space acall wait mov SBUF, #'W' acall wait mov SBUF, #'O' acall wait mov SBUF, #'R' acall wait mov SBUF, #'L' acall wait mov SBUF, #'D' acall wait mov SBUF, #' ' ;space acall wait mov SBUF, #' ' ;space acall wait ajmp hello ;say it again wait: JNB TI, wait clr TI ret |
| Topic | Author | Date |
| serial port Hello World problem | 01/01/70 00:00 | |
| RE: serial port Hello World problem | 01/01/70 00:00 | |
| It will work now | 01/01/70 00:00 | |
| fixed -- serial port Hello World problem | 01/01/70 00:00 | |
| Also try 9600 + baud | 01/01/70 00:00 | |
RE: Also try 9600 + baud | 01/01/70 00:00 |



