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());
}
When i compile above code, got following errors
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:399: error: 'PCICR' was not declared in this scope
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:402: error: 'PCMSK2' was not declared in this scope
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:402: error: 'PCMSK0' was not declared in this scope
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:402: error: 'PCMSK1' was not declared in this scope
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:417: error: 'PCMSK2' was not declared in this scope
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:417: error: 'PCMSK0' was not declared in this scope
C:\arduino-1.0.5-r2\libraries\SoftwareSerial\SoftwareSerial.cpp:417: error: 'PCMSK1' was not declared in this scope
The ATmega8 is/was one of the official supported chips, but it is old. A number of libraries do no longer work with it.
Perhaps there is a software serial library that does support the ATmega8, but I could not find it.
Can you get an Arduino board with the ATmega328p ? or a Leonardo board ?
What do you need the serial communication for ?
I want to interface my RF ID reader reader to Arduino board and at a time in serial monitor. so i need to serial pins. Is there any option to use same pin for the both purposes, but i don't want buy any new one..............?
Thanks for your kind co-operation. I am poor in English. Any wrongs forgive me and try to understand my problem
Use RX to read the RFID, the signal should override the signal from the computer.
Use TX to write to the serial monitor on the computer(as it is).
If you set the serial port to 2400 for the RFID, als the serial monitor on the computer should be set to 2400 baud.
To upload a sketch, you have to remove the wire from the RFID to the RX pin.
There is software serial code available for the ATmega8. But I don't know how reliable they are.
Atmel has a document: "AVR304: Half Duplex Interrupt Driven Software UART"
Someone has made changes to make it work for the ATmega8: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=86097