DatasheetsPDF.com

AN555

Microchip

Software Implementation of Asynchronous Serial I/O


AN555
AN555

PDF File AN555 PDF File


Description
M AN555 Software Implementation of Asynchronous Serial I/O Author: Code Update: Amar Palacherla Microchip Technology Scott Fink Microchip Technology Inc.
INTRODUCTION PIC16CXXX microcontrollers from Microchip Technology, Inc.
, high-performance, EPROM-based 8-bit microcontrollers.
Some of the members of this series (like the PIC16C71 and PIC16C84) do not have an on-chip hardware asynchronous serial port.
This application note describes the interrupt driven software implementation of Asynchronous Serial I/O (Half Duplex RS-232 Communications) using PIC16CXXX microcontrollers.
These microcontrollers can operate at very high speeds with a minimum of 250 ns cycle time (with input clock frequency of 16 MHz).
To test the RS-232 routines, a simple Digital Voltmeter (DVM)/Analog Data Acquisition System has been implemented using a PIC16C71, in which, upon reception of a command from host (IBM PC-AT®), an 8-bit value of the selected A/D channel is transmitted back to the host.
IMPLEMENTATION A half duplex, interrupt driven, software implementation of RS-232 communications, using a PIC16C71, is described in detail below.
The transmit pin used in the example code is RB7 and the receive pin is connected to the RA4/T0CKI pin (Figure 2).
Of course these pins are connected with appropriate voltage translation to/from RS-232/CMOS levels.
Schematics describe the voltage translation in the hardware section of this application note.
Transmit Mode Transmit mode is quite straight-forward to implement in software using interrupts.
Once input clock frequency and baud rate are known, the number of clock cycles per bit can be computed.
The on-chip Timer0 timer with its prescaler can be used to generate an interrupt on TMR0 overflow.
This TMR0 overflow interrupt can be used as timing to send each bit.
The Input clock frequency (_ClkIn) and Baud Rate (_BaudRate) are programmable by the user and the TMR0 time-out value (the period for each bit) is computed at assembly time.
Whether the presc...



Similar Datasheet


@ 2014 :: Datasheetspdf.com :: Semiconductors datasheet search & download site. (Privacy Policy & Contact)