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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/29/99 15:06
Read: times


 
#1104 - Keil ds80c320 serial port example
I am cannot get the second serial port to run from C51. I have run the code below from the keil site. The only output I can get is a "T". I am running on a DS80C320 at 33Mhz. I need help Please. Thank you

//
#include "stdio.h"
#include "ds80c320.h"


//-----------------------------------------------
char putchar (char c)
{
while (!TI_1); /* wait until transmitter ready */
TI_1 = 0;
SBUF1 = c; /* output character */
return (c);
}


//-----------------------------------------------
char _getkey (void)
{
char c;

while (!RI_1); /* wait for a character */
c = SBUF1;
RI_1 = 0; /* clear receive interrupt bit */

return (c);
}


//-----------------------------------------------
void main (void)
{
SCON1 = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
WDCON |= 0x80; /* SMOD_1: double baud rate bit */
TH1 = 0xf7; /* TH1: reload value for 19200 baud */
TR1 = 1; /* TR1: timer 1 run */
TI_1 = 1; /* TI: set TI to send first char of UART */

while (1)
{
printf ("Type a characterrn");
printf ("You entered '%c'rn", (unsigned char) _getkey ());
}
}
//-----------------------------------------------






List of 4 messages in thread
TopicAuthorDate
Keil ds80c320 serial port example            01/01/70 00:00      
RE: Keil ds80c320 serial port example            01/01/70 00:00      
RE: Keil ds80c320 serial port example            01/01/70 00:00      
RE: Header file errors            01/01/70 00:00      

Back to Subject List