Professional Documents
Culture Documents
January
Create additional virtual COM ports Fully emulate real rs232 connection 29th,
Go to virtual-serial-port.org 2017
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Schematic
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
Circuit Description
The above circuit when in a working state, will wait for a byte to be sent to it before it starts the analog conversion and sends
data back to the computer using the 8N1 serial format at 9600 BPS. The circuit is based on a CDP6402C or equivalent UART.
This, if you want to call it, is the brains of the operation and performs the conversion of Parallel data to a Serial format for
transmission. The Analog to Digital Conversion is done by the ADC0804, while the MAX232 is used to convert TTL/CMOS
voltage levels into RS-232 Voltage Levels. The 74HC4060 is a Oscillator/Divider which is used to generate the UART's Clock.
The Analog to Digital Converter (ADC0804) starts it's conversion when the UART's Data Received line becomes active. Many
people at this stage will say that this circuit cannot work! - The Data Received (DR) output is Active High, while the nWrite (WR)
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
input to the ADC is a Active Low. This circuit is quite correct. If we look at the ADC's operation, on a high to low transition of the
nWrite input the internal Successive Approximation and Shift Registers are reset. Provided the nWrite line remains in this state
the ADC will remain reset. The conversion process will start when a low to high transition is made on the nWrite input.
Therefore getting back to this circuit, the Data Received output will remain low while there is no data to be received, thus the
ADC will remain in the reset mode. When data is received by the UART, a low to high transition will result on the Data Received
line and thus on the connected nWrite pin of the ADC.
This low to high transition will cause the ADC to spring to life and make a digital conversion of the analog voltage on it's pins.
Once the conversion is finished, it's nINTR (Interrupt) line will become active low. This signal is then used to tell the UART to
send the data residing on it's Transmitter Buffer Register inputs (TBR8:TBR1). nINTR is also connected to the UART's Data
Received Reset so that the Data Received line will be reset. The circuit is then ready to repeat the entire process upon
receiving the next byte.
#include <dos.h>
#include <stdio.h>
#include <conio.h>
int bufferin = 0;
int bufferout = 0;
unsigned char ch;
char buffer[1025];
void main(void)
{
int c;
outportb(PORT1 + 1 , 0); /* Turn off interrupts - Port1 */
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
outportb(PORT1 + 1 , 0x01); /* Interrupt when data received */
do {
if (kbhit()){c = getch();
outportb(PORT1, c);}
} while (c !=27);
The above source code was copied from the example given in the Interfacing the Serial / RS232 Port. The only modifications
made was to change the Baud rate to 9600 BPS and include an optional line, shown below, to calculate the voltage present at
the ADC's pins.
printf("%f volts\n",(float)ch/256 * 5);}
The program can be modified to start the conversion at fixed intervals and to log the received result to file. This makes the above
circuit more useful, than it is currently presented.
Data Sheets
Data Sheets for all the I.C's used in this example can sought on-line from the Internet. This is a list of where the Author obtained
his data sheets from. Some semiconductors may be available from other manufacturers. The URL for the manufacturer's
homepage is given. You will need to search for the data sheet using their site's search engines.
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com
I.C's Name Part Number Link to Manufacturers Homepage
CMOS Universal Asynchronous Receiver/Transmitter (UART) CDP6402 Harris Semiconductor
RS-232 Level Converter MAX232 Maxim Integrated Products
8 Bit Analog to Digital Converter ADC0804 Harris Semiconductor
14 Stage Binary Counter 74HC4060 National Semiconductor
open in browser PRO version Are you a developer? Try out the HTML to PDF API pdfcrowd.com