It should be possible for important data to move to and from different digital devices. On computers, this can be achieved by either copying the data to an external drive and physically carrying it or by transmitting the data automatically via the serial or communications ports. It is generally safer to transmit data automatically from one device to another through serial communications ports. This can be achieved by writing a script to automate the process and by including commands to write and read to and from serial ports.
- Skill level:
Other People Are Reading
Things you need
- List of serial ports on your system(s)
Identify the naming conventions for your serial ports. Before a script can be written, it is necessary to identify the standard names used for serial ports on your system(s). On Windows computers using Disk Operating Systems (DOS), most serial communications ports are named using the convention COM1, COM2 and COM3, but on Unix-type systems, serial ports are usually named similar to a directory structure, such as /dev/ttys1, /dev/ttys2 and so on.
Learn or use the appropriate scripting language. Before a serial port can be accessed via a script, it is necessary to use the available language to achieve the task. On DOS systems, this can be achieved via the batch scripting language, but in Unix this is achieved via shell scripts.
Send data to the communications port via the correct command. When data has been processed and is ready to send via a serial port, it needs a suitable command to achieve the task. For example, on DOS systems writing to serial port COM1, the command "echo Hello > COM1" sends "Hello" to the communications port identified as COM1. On Unix systems, the command "echo Hello > /dev/ttys1" sends "Hello" to the serial port identified as /dev/ttys1.
Tips and warnings
- In addition to standard output, it is also possible to output error messages to the serial port. This is achieved by a modification of the standard commands using a different parameter.
- The standard scripting languages are only one method of writing to serial ports. However, any language having access to the serial ports and operating system can be used, such as Java and C++.
- It is sometimes necessary to have a separate program to read the data coming from the serial port, otherwise the program may "hang."
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for