Show Posts
Pages: [1]
1  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 12:34:56 pm
pin 3 (software 'tx') connected to hardware 'rx'
pin 2 (software 'rx') connected to hardware 'tx'
2  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 12:14:41 pm
I printed the variable to verify. But i could obtain garbage values only.
Serial.print(c); Check this code below:

#include<NewSoftSerial.h>
NewSoftSerial mySerial(2,3);
 
char c;

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop()
{
  Serial.Print('A');
  delay(1000);
  if (mySerial.available() > 0)
  {
    c=mySerial.Read();
    delay(1000);
  }
Serial.print(c);
}

Here in the serial monitor i got output as shown below:
A <a rectangular symbol> A <a rectangular symbol> ........
3  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 11:54:21 am
Software pin 'tx' (pin 3) is shorted to hardware 'rx' and Software pin 'rx' (pin 2) is shorted to hardware 'tx'
4  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 11:50:43 am
#include<NewSoftSerial.h>
NewSoftSerial mySerial(2,3);
 
char c;

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop()
{
  Serial.Print("Key1");
  delay(1000);
  if (mySerial.available() > 0)
  {
    c=mySerial.Read();
    delay(1000);
  }
Serial.print(c);
}

I could observe garbage values only. I tried with a single character, as well. That is, Serial.print('A'), instead of Serial.print("key1"). Still, i couldn't get the desired result.
5  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 11:32:38 am
#include<NewSoftSerial.h>
NewSoftSerial mySerial(2,3);
 
char c;

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop()
{
  Serial.Print("Key1");
  delay(1000);
  if (mySerial.available() > 0)
  {
    c=mySerial.Read();
  }
}

This is the code i compiled. But couldn't receive data "key1" to the variable c.
Could you check the output in your hardware, once shorting the pins i mentioned?
6  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 11:05:23 am
Serial.myprint() was a mistake. Actual syntax is mySerial.print().

I could compile my code.

What i expect is to receive those 4 characters "key1" through the software 'rx' pin, to a variable c, once it has been transmitted over the hardware 'tx'.
7  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 09:33:01 am
The reason why i wanted to use HardwareSerial.h was to use UART.Read().
I am using the same arduino board as the sender and receiver.
Sender is the hardware 'tx' pin.
Receiver is any of the port pin of arduino.

program:

#include<NewSoftSerial.h> // for software serial pins
NewSoftSerial mySerial(2,3); // sets port pin 2 as software 'rx' and pin 3 as software 'tx'
char c;
void setup()
{
Serial.begin(9600); //sets baud rate for hardware UART
mySerial.begin(9600); //sets baud rate for oftware UART
}
void loop()
{
Serial.Print("Key1"); //data sent via hardware 'tx' pin
delay(1000);
if(mySerial.available()>0)
  {
   c=mySerial.Read(); //data read via software 'rx' pin
   delay(1000);
  }
}
 
I shorted the harware 'tx' and software 'rx' pins; also the harware 'rx' and software 'tx' pins. But this code did not work. I even tried the other way around. That is, transmit via software 'tx' and receive via harware 'rx'. But that too did not work. The code for this arrangement is here:

void loop()
{
Serial.myPrint("Key1"); //data sent via software 'tx' pin
delay(1000);
if(Serial.available()>0)
  {
   c=Serial.Read(); //data read via hardware 'rx' pin
   delay(1000);
  }
}
 
8  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 09:00:50 am
UART.Read()-I have only seen it. Still i can't use it.
I am using 9600 baud rate both for software and hardware serial.

Assume this scenario. In my program i am using a keypad. There are 12 keys. Once a key is pressed, a serial data corresponding to that key is transmitted. Say, for example, if first key is pressed data "Key1" is transmitted. (using Serial.Print("Key1")smiley-wink I need this data to be collected in a variable, after its transmission,through a port pin of arduino. This is the flow: A key is pressed--> Data corresponding to that key is transmitted--> Collect this data to a variable, through a port pin of arduino.

This is what i am trying to accomplish. I am using software serial to make port pin of arduino collect serial data.
9  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 08:01:47 am
 @robtillaart & @tuxduino: I am using ubuntu 11. I downloaded and installed arduino 0022 using the 'software centre' of ubuntu. Installation takes place automatically once the download is done.
The problem i faced was that i couldn't include the header file HardwareSerial.h in my program and hence i couldn't invoke the function UART.Read() (which i came across in a forum long time ago).
My requirement, in short, is to collect a serial data into a variable. By using "if (Serial.available() > 0) x = Serial.read()", we can collect data into variable x, only if we type the required string within the "Serial Monitor" of arduino. What i am trying is, to transmit a data, for example, "Serial.myPrint("arduino");", which will be transmitted via the 'tx' pin 3(which is set as my software 'tx' pin; pin 2 is the software 'rx') and collect the same into a variable, via the 'rx' pin of arduino. I have shorted the 'tx' pin of arduino with the software 'rx' pin 2 and 'rx' pin of arduino with the software 'tx' pin 3.
As i mentioned, if we use "x=UART.Read()", i can read and collect a data being received by the 'rx' pin of arduino.
10  Development / Other Software Development / Re: HarwareSerial.h on: January 12, 2013, 12:22:55 am
@ tuxduino: I need to collect the serial data from the UART directly to a variable, through a software serial port. To do that, i found that the library HardwareSerial.h contains a function UART.Read(), which very well serves this purpose. But unfortunately i don't have this header file.

@ robtillaar: couldn't find it over there.
11  Development / Other Software Development / HarwareSerial.h on: January 11, 2013, 09:48:04 am
Somebody mail me the library file HardwareSerial.h (including HardwareSerial.h,HardwareSerial.cpp & keyword.txt).
bhairumaaman@gmail.com
Pages: [1]