Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/14/06 19:13
Read: times


 
#122217 - 8051 newbie serial IO
OK. I'm extremely new to embedded programming and am trying to learn as I go. I'm trying to get this simple program to work. It compiles fine and runs on my Silabs C8051f330 development kit,
but it doesn't seem to work, IE I've got hyperterminal connected to the db9 on the development board. When I type on the keyboard I don't get the expected echo. Here is the code. I suppose I must be missing something, but like I said, I'm really new. Thanks for any tips.

#include "c8051f330.h"
#include "stdio.h"

void main (void)
{

XBR0 = 0x01;
XBR1 = 0x40;
SCON0 = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
CKCON = 0x01;
TMOD = 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0x61; /* TH1: reload value for 2400 baud */
TR1 = 1; /* TR1: timer 1 run */
TI0 = 1; /* TI: set TI to send first char of UART */
IE=1;
while(1)
{

unsigned char aaa;
aaa = _getkey();
putchar(aaa);
}
}



List of 7 messages in thread
TopicAuthorDate
8051 newbie serial IO            01/01/70 00:00      
   STDIO            01/01/70 00:00      
      Well..            01/01/70 00:00      
         Try this            01/01/70 00:00      
            Thanks            01/01/70 00:00      
               In addition            01/01/70 00:00      
                  Helpful            01/01/70 00:00      

Back to Subject List