RS-485 Breakout

From Geeetech Wiki
Revision as of 09:11, 14 January 2013 by Admin (talk | contribs) (Usage)

Jump to: navigation, search

Overview

This is a breakout board for the RS-485 transceiver IC, which will convert a UART serial signal to RS-485. This chip is a half-duplex transceiver, so it can only communicate one way at a time, but it can reach transmission speeds of up to 2.5Mbps. This board requires a very low amount of power and can operate from a single +5VDC supply.

This breakout board includes the SP3485 RS-485 transceiver, filter capacitor. We've broken out the RS-485 output to three different connections: (1) an RJ-45 connector, (2) a 3-pin 3.55mm screw terminal, and (3) a 3-pin 0.1" pitch header


Features

  • Fully equipped with SP3485 RS-485 transceiver and supporting components
  • Operates from a single +5V supply
  • Interoperable with +5.0V logic
  • RS-485 input/output broken out to RJ-45 connector, 3.5mm screw terminal, and 0.1" pitch header
  • Driver/Receiver Enable connected to RTS line
  • -7V to +12V Common-Mode Input Voltage Range
  • Allows up to 32 transceivers on the serial bus
  • Driver Output Short-Circuit Protection

Usage

Here is an example below illustrates how to transimit and receive data via RS-485 signal.

RS485 Transmitter

int EN = 2;
void setup()
{
 pinMode(EN, OUTPUT);
 Serial.begin(19200);
}
void loop()
{
// send data 
 digitalWrite(EN, HIGH);/
 Serial.print('A');
 Serial.print('B');
 delay(1000);
}


RS485 Receiver

int ledPin = 13;
int EN = 2;
int val;
void setup()
{
 pinMode(ledPin, OUTPUT);
 pinMode(EN, OUTPUT);
 Serial.begin(19200);
}
void loop()
{
 // receive data
digitalWrite(EN, LOW);//使能接收
val = Serial.read();
 if (-1 != val) {
   if ('A' == val) {
     digitalWrite(ledPin, HIGH);
     delay(500);
     digitalWrite(ledPin, LOW);
     delay(500);
   }
 }
}