More Related Content
Similar to Interfacing UART with tms320C6745 (20)
More from Pantech ProLabs India Pvt Ltd (20)
Interfacing UART with tms320C6745
- 2. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
1) Introduction: Serial interface
(universal asynchronous
receiver transmitter : UART)
• RS232 standard and application,
e.g.
2
2
RS232 port
(UART)
RS232 port
(UART)
RS232 standard
3 wires
+10 V=‘0’=SPACE
-10V=‘1’=MARK
Pin2
Pin3
pin5
Pin3
Pin2
pin5
UART
- 3. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Universal asynchronous receiver
transmitter : UART
• RS232 is a serial communication standard
• Since it is asynchronous, no external clock is
needed, only 3 wires are required for the simplest
RS232 connection {GND, tx(transmit),
rx(receive)}
3
3
+10V=Logic
0=space
-10V= Logic
1=markExercise: Sketch Bit Patterns for character A and B
Start 0 1 2 3 4 5 6 7 stop
Bit 0 to 7 (least sig. bit first )
time
- 4. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
RS-232 Level Converter
• Convert TTL to RS232 and RS232 to TTL voltage levels.
The most commonly used RS-232 level converter is
MAX232 and MAX3232.
• This IC includes charge pump which can generate RS232
voltage levels (-10V and +10V) from 3.3V power supply. It
also includes two receiver and two transmitters and is
capable of full-duplex UART/USART communication.
• RS-232 communication enables point-to-point data transfer
- 5. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
Schematic Diagram to Interface With
UART
- 7. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
UART Transmit Program
#include "stdio.h"
#include "c6745.h"
#include "c6745_uart.h"
void main()
{
Int16 i;
Uint8 j=64;
UART_Handle uart0;
char message[]={"The C6745-UART is fine !nr"};
/* Initialize BSL */
C6745_init( );
/* Open Uart Handle */
uart0 = C6745_UART_open( 1, 9600 );
while(1)
{
for(i=0;i<27;i++)
{
while( C6745_UART_xmtReady( uart0 ) ); // Wait for uart_tx ready
C6745_UART_putChar( uart0, message[i] ); // Write 1 byte
}
}
}
- 8. Technology beyond the Dreams™ Copyright © 2014 Pantech Prolabs India Pvt Ltd.
UART Receive &Transmit
Program
#include "stdio.h"
#include "c6745.h"
#include "c6745_uart.h“
void main()
{
UART_Handle uart0;
char receive;
/* Initialize BSL */
C6745_init( );
/* Open Uart Handle */
uart0 = C6745_UART_open( 1, 9600 );
while(1)
{
while(((uart0->regs->LSR) & 0x1)==0);
receive = uart0->regs->THR;
while( C6745_UART_xmtReady( uart0 ) ); // Wait for uart_tx ready
C6745_UART_putChar( uart0, receive ); // Write 1 byte
}
}