Go Down

Topic: Problem with Software Serial Library? (Read 1 time) previous topic - next topic

Logeswari12

Hi,

 I have been trying to compile this example code from arduino 1.0.6 ide
Code: [Select]
/*
  Software serial multple serial test
 
 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.
 
 The circuit:
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)
 
 Note:
 Not all pins on the Mega and Mega 2560 support change interrupts,
 so only the following can be used for RX:
 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
 
 Not all pins on the Leonardo support change interrupts,
 so only the following can be used for RX:
 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
 
 created back in the mists of time
 modified 25 May 2012
 by Tom Igoe
 based on Mikal Hart's example
 
 This example code is in the public domain.
 
 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() 
{
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}


But it doesn't compile the error it shows is like
Quote
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:399: error: 'PCICR' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:402: error: 'PCMSK2' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:402: error: 'PCMSK0' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:402: error: 'PCMSK1' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:417: error: 'PCMSK2' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:417: error: 'PCMSK0' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:417: error: 'PCMSK1' was not declared in this scope
Not only this, even if I try to code any other program using software serial library error is of same manner, tried restarting the pc, tried uninstalling and installing the arduino ide, tried with arduino 1.0.5, but of no avail, any help would be a great relief.

Thanks

robtillaart

did you have the right board selected?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Logeswari12


Logeswari12

Finally got the answer, code doesn't compile when i choose Arduino NG or older w Atmega 8, it compiles only when you choose Arduino Uno,

I wonder why in the world, that this ide doesn't compile when we choose a incompatible board.

Anyways, Thanks a ton

johnwasser

Finally got the answer, code doesn't compile when i choose Arduino NG or older w Atmega 8, it compiles only when you choose Arduino Uno,

I wonder why in the world, that this ide doesn't compile when we choose a incompatible board.
Does the ATmega8 processor even support the necessary Pin Change interrupts?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp
See who has no social life: https://forum.arduino.cc/index.php?action=stats :)

Go Up