| ??? 11/04/11 21:11 Read: times |
#184548 - C code Responding to: ???'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. |
| Topic | Author | Date |
| Both UARTs simultaneous works | 01/01/70 00:00 | |
| yes | 01/01/70 00:00 | |
| Both with Queues | 01/01/70 00:00 | |
| C code | 01/01/70 00:00 | |
| Or C | 01/01/70 00:00 | |
| No simultaneous work | 01/01/70 00:00 | |
| The Example is for one UART | 01/01/70 00:00 | |
| Duplicate or Generalise | 01/01/70 00:00 | |
| at89c51RE2 | 01/01/70 00:00 | |
| Start a new thread | 01/01/70 00:00 | |
| The same | 01/01/70 00:00 | |
but not same problem | 01/01/70 00:00 |



