logo
background
 Home and Links
 Your PC and Security
 Server NAS
 Wargames
 Astronomy
 PhotoStory
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>
[Using the serial port] [USB / serial hybrid]

Using the serial port

As we will see later, one of the 'problems' with the Printer Port is that at least 8 data and +2 control 'pins' are required - and if we want to use standard micro-controllers (eg PIC) dedicating 10 pins to i/o leaves very few for actual data acquisition control.

What we want, of course, is a minimum pin count serial comms approach (but without the mega-complexity of USB). So, what about the PC serial port ?

Well, the RS232 port on a modern motherboard can handle at least 1.5 Mbits/s, however in Windows Device Manager / Port Settings you will quickly discover you are limited to a lot less than this.
 
All** PC's support at least 115,200 bits/s, however if you are lucky you will be offered 128,000, 230,400 or even 460,800.
 
The problem is Windows interrupt latency (which is typically 3-5mS (or slower), with a fast limit of 1mS).
 
The typical motherboard has a 16-byte FIFO and a maximum usable speed of 115.2 kbit/s.
 
A PCI/e card based Serial Port (using the 16C950 UART, which has a 128x11 bit receiver FIFO) might run at up to 3 Mbit/s, however even with the best Windows 1mS latency limit this means 921,600 bps (some cards limit at 460,800 pbs)
 
**A typical laptop's serial port will be intended to support dial-up modems - and these never exceeded 56k bps, so that's all you may get.
 
NB. At the higher data rates, the (single ended) serial cable length must be kept 'short' (in other words, you may have to build your device straight onto the serial port plug)

[top]

USB / serial hybrid

Since (in theory) you should be able to get up to 8Mbps out of a PIC, the PC 1Mbps serial input becomes the limiting factor. However much faster serial protocols exist (eg. RS485 = 10Mbps) - and these can be supported via USB

The basic RS232 USB dongle will support Serial Port speeds well in excess of 1Mbits/s (1,228,800 bps) - but watch out - some are limited to 230,400 bps or lower (128,000 is not uncommon) and the claimed speeds are often not sustainable past the end of the USB data buffer (which may be USB1.1 = 64 bytes)
 
 

One limitation is the USB specification, which means the PC is the 'controller' i.e. the PC has to 'poll' the USB device and collect or send a packet. Windows is apparently able to 'poll' USB devices 1,000 times a second (1mS). This means the PC can 'collect' no more than 1,000 data packets from the device.

In USB 1.1, the data block size was 64 bytes (which is where the max. transfer rate of 64,000 bytes comes from).
 
In USB 2.0, data blocks up to 4kbytes are supported, so (at least in theory) up to 4mbs should be possible (note - the USB data transfer block size is not the same as the Windows driver (software) buffer).

A USB RS485 (differential line) Serial dongle can be found for less than £1 (eBay, from China, which is way less than the UK cost of the chips inside !) and will typically support at least '1Mbs' (actually, that's more likely 921,600 baud).

Next up, for £1.28p, you can get a CP2102 chip based 'module' (eBay, China) that will support USB 2.0 and a serial rate of 1.5mbs.
 
These modules are easy to re-house within your own project and will save you the time and effort of developing your own USB code

A final option is a 'stand-alone' FT232R USB to serial UART chip, which is capable of 1M baud (RS232 single ended) or 3M baud (in RS422/485 differential mode).

Of course your ADC signal capture system then needs to actually deliver it's data at this rate - and your average PIC (PIC16F877) tops out at 250,000 baud (which is about 25kBytes/s and way less than the PIC's own built in ADC (50k 10bit samples/sec)). The PIC16F887 is even worse (it tops out at 115,200 baud)

Next subject :- PoE cable - (for Telescope)

[top]