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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/04/11 15:11
Read: 646 times


 
#184548 - C code
Responding to: Michael Karas's previous message
Thanks for replays, but I'm totally new in c51 and luck of asm experience. So I prefer easy UART0 "C" example, how to use uart with internal baud rate generator:


void main (void) 
{
	   SCON = 0x50;		/* uart in mode 1 (8 bit), REN=1 */
	   BDRCON &=0xEC;		/* BRR=0; SRC=0; */
	   BDRCON |=0x0C;		/* TBCK=1;RBCK=1; SPD=0 */
	   BRL=0xFD;		/* 9600 Bds at 11.059MHz */
	 	ES = 1;		/* Enable serial interrupt	*/
		EA = 1;		/* Enable global interrupt */
	   BDRCON |=0x10;		/* Baud rate generator run*/
   while(1);
}		


void serial_IT(void) interrupt 4 
{...}

void serial_IT(void) interrupt 10 
{...}


 



Is the 2nd uart require another baud source ? and additionally I should run 2-nd uart by adding smth like this:




Tha problem of Keil is that it has not true header description (like this): http://www.keil.com/dd/chip/3986.htm 

There it was told to use "at89c51xd2.h" for AT89C51RE2, but I can't find there BDRCON_1 register (for ex, 0xBCh in PDF, snd uart) and some other. Anyway, I have most newest v4.22 of Keil.


List of 12 messages in thread
TopicAuthorDate
Both UARTs simultaneous works      Alex Volk      11/04/11 08:16      
   yes      Erik Malund      11/04/11 09:49      
      Both with Queues      Michael Karas      11/04/11 12:50      
         C code      Alex Volk      11/04/11 15:11      
         Or C      Neil Kurzman      11/04/11 16:54      
            No simultaneous work      Alex Volk      11/04/11 21:09      
               The Example is for one UART      Neil Kurzman      11/04/11 22:03      
               Duplicate or Generalise      Andy Neil      11/05/11 04:45      
   at89c51RE2      Alex Volk      11/08/11 23:48      
      Start a new thread      Andy Neil      11/09/11 00:08      
         The same      Alex Volk      11/09/11 05:19      
            but not same problem      Erik Malund      11/09/11 06:30      

Back to Subject List