2018 July REVIEW
Arduino TinySince RS232/485 Shield Serial Port Programming
Arduino TinySince RS232/485 Shield Sketch
by Gene Casanova, Senior Systems/Network/Internet Engineer
Working With An Arduino Duemilanove And A TinySine RS232/485 Shield.
The Arduino Duemilanove
A library named "SoftwareSerial" enables serial communication on any of the Duemilanove digital pins.
The Arduino software includes a serial monitor application enabling simple textual data to be sent to and from the Arduino system.
The Arduino Duemilanove systemboard has a number of facilities for communicating with a computer, another Arduino, other microcontrollers and devices with a serial port.
USB Serial Port
A "FTDI" FT232RL USB interface IC chip provided onboard provides serial communication through USB and FTDI drivers (included with Windows version of the Arduino software) provide a virtual "com" port to software on a USB-connected computer to an Durian systemboard.
USB Communications LEDs
The RX LED and TX LED on the systemboard will flash when data is being transmitted through the FTDI IC chip and USB connection to the USB-connected computer. The LEDs are used for serial communication on pins 0 and 1.
LED Pin 13
There is an onboard mounted LED connected to digital pin 13. When the pin is set to 'HIGH' value, the LED emits light, when the pin is set to 'LOW', the LED will not emit light.
Serial Communications Pin 0 & 1
The ATmega168 and ATmega328 microcontrollers, provide UART TTL (5V) serial communication ports; available on digital pins 0 (RX) and 1 (TX).
Universal Asynchronous Receiver/Transmitter (UART), a serial protocol. UART is one of the first and simplest protocols to transmit one bit at a time over a communciation path/link.
UART can be used for serial communication between computers/microcontrollers. It is asynchronous and enables simultaneous communication in both directions ("Full Deplex" commincations).
The TinySine RS232/485 Shield
TinySine RS232/485 Shield adds a RS232 serial port and a RS485 serial port to an Arduino systemboard. The onboard UART can be switched to be a RS232 or RS485 interface.
A DB9 female connector is provided for the RS232 interface. An industry standard RS485 terminal interface is provided onboard.
The shield provides a component soldering board prototyping area.
A mode of operation switch is provided: "UART" or "Soft serial" modes, and a switch for the interface type: RS485 or RS232. When the switch is set to "Soft Serial", programming can be uploaded to the Arduino Microcontroller or communicating can be done with soft serial and a program running on the Arduino systemboard. When switched to "UAR"T, the UART port becomes enabled to a process/program running on the Arduino systemboard.
TinySince RS2323 Port
Use the Arduino Serial library to add RS232 communications functionality. This library eliminates the need to manually set the TX enable and wait until transmission is complete to clear it.
The RS232 functionality can be used by adding a few control parameters to "Serial.begin". Send data in the usual manner.
Serial.print("something here..."); // DIR is automatically asserted.
C Source Code (Arduino "Sketch")
The "Ah Ha" moment; a higher level of personal enlightenment has been achieved.
/* Arduino C Source Code A "Sketch"; Basic Serial Communication Port Programming Foundation Creation. by Gene Casanova */ #include <SoftwareSerial.h> #define RS485_DIR_PIN 4 // standard Arduino pin numbering used here.
Use The Technology Wisely & Keep It Simple
Need More? Need Help? ........Software, Network, System & Data Center Builder & Developer | Development Services Available - Freelance Small Jobs; To Outsourced Long Term Service Provider Contract Labor Available.
CGI Computer Wares | EST 1979