English
Language : 

VMX1C1020 Datasheet, PDF (42/80 Pages) List of Unclassifed Manufacturers – Versa Mix 8051 Mixed-Signal MCU
VMX51C1020
The following formulas are used to calculate the
baud Rate, S1RELL and S1RELH values.
Serial 1
Baud Rate=
fclk__________
32 x (1024-S1REL)
Note: S1REL.9-0 = S1RELH.1-0 + S1RELL.7-0
S1REL = 1024 -
fclk__________
32 x Baud Rate
TABLE 77: SERIAL 1 BAUD RATE SAMPLE VALUES
Desired
S1REL @
Baud Rate
fclk= 11.0592
MHz
500.0 kbps
-
460.8 kbps
-
230.4 kbps
-
115.2 kbps
3FDh
57.6 kbps
3FAh
19.2 kbps
3EEh
9.6 kbps
3DCh
2.4 kbps
370h
1.2 kbps
2E0h
S1REL @
fclk= 14.746
MHz
-
3FFh
3FEh
3FCh
3F8h
3E8h
3D0h
34Fh
280h
Setting Up and Using UART1
In order to use UART1, the following operations
must be performed:
o Enable the UART1 Interface
o Set I/O Pad direction TX= output, RX=Input
o Enable Reception (if required)
o Configure the UART1 controller S1CON
Example of UART1 Setup and Use
The following are C code examples of UART1
configuration, serial byte transmission and
interrupt usage.
//----------------------------------------------------------------------------------------//
// UART1 CONFIG
//
// Configure the UART1 to operate in RS232 mode at 115200bps
// with a crystal of 14.7456MHz
//----------------------------------------------------------------------------------------//
void uart1Config(void)
{
P0PINCFG |= 0x04;
// pads for uart 1
DIGPWREN |= 0x02;
// enable uart1
S1RELL = 0xFC;
// Set com speed = 115200bps
S1RELH = 0x03;
S1CON = 0x90;
// Mode B, receive enable
}//end of uart1Config() function
//----------------------------------------------------------------------------------------//
// TXMIT1 -- Transmit one byte on the UART1
//----------------------------------------------------------------------------------------//
void txmit1( unsigned char charact){
S1BUF = charact;
USERFLAGS = S1CON;
while (!UART_TX_EMPTY) {USERFLAGS = S1CON;}
//Wait TX EMPTY flag
S1CON = S1CON & 0xFD;
//clear both R1I & T1I bits
}//end of txmit1() function
//----------------------------------------------------------------------------------------//
// Interrupt configuration
//---------------------------------------------------------------------------------------//
IEN0 |= 0x80;
IEN2 |= 0x01;
// Enable all interrupts
// Enable interrupt UART 1
//----------------------------------------------------------------------------------------//
// Interrupt function
//----------------------------------------------------------------------------------------//
void int_serial_1 (void) interrupt 16
{
IEN0 &= 0x7F;
// Disable all interrupts
/*------------------------*/
/*Interrupt code here*/
/*------------------------*/
if (S1CON&0x01==0x01)
{
S1CON &= 0xFE;
}
else
{
S1CON &= 0xFD;
}
IEN0 |= 0x80;}
// Clear RI (it comes
// before T1I)
// Clear T1I
// Enable all interrupts
}
}
/-----------------------------------------------------------------------
_________________________________________________________________________________________________
www.ramtron.com
page 42 of 80