This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UART Communication help

Hi all,

I'm in the process of trying to add a UART interface to an existing program. I have initialized the UART port successfully (as far as I can tell), and before the meat of my program, I have it set in an infinite loop. In this loop, I just have two lines.

//This is my initialization of UART connection
GP1CON = 0x011;// Setup tx & rx pins on P1.0 and P1.1

// Setting up UART at 9600bps (CD=0)
COMCON0 = 0x80; // Setting DLAB
COMDIV0 = 0x88;
COMDIV1 = 0x00;
COMCON0 = 0x07; // Clearing DLAB
//This is my loop
while(1)
{ achar = getchar(); putchar(achar);
}

getchar and putchar are defined in serial.c that I pulled from ADuC7026 examples.

I'm just trying to test the communication by waiting for a character from the terminal and then spitting that same character back to the terminal. Unfortunately, I do not at all get the same character back. I really don't know how this works, and I'm trying to figure all of this out. I think it might be a problem with how I'm configuring my terminal, but I can't find a combination of settings that will make it spit out the correct character. I wrote down a set of keys pressed and their associated character thrown back at me.

Input/output
q/~
w/
e/~
r/x
t/~
y/~
u
i/x
o
p/x
a/x
s/f
d/f
f/f
g/~
h/'
j/'
k/
l/f
z/x
x/x
c/f
v/~
b/'
n/f
m/

etc

The blanks indicate that the terminal did not respond to those keys. I just went back to play with it again, and now I'm getting a bunch of symbols, mu's, and alpha's. If someone could just point me in the right direction here, that would be great. I don't really understand how the two machine communicate with each other in terms of hex/binary/ascii. Is this the source of my problem? Thanks in advance.

-Larry

0