Pages: [1]   Go Down
Author Topic: How to send via GSM the GPGGA line in GPS Shield using MCU with 2 h/w uart?  (Read 957 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 HELP!! smiley-confuse
these r my boards:
GPS Shield             http://www.e-gizmo.com/KIT/gps%20shield.html
GSMGPRS Shield    http://www.e-gizmo.com/KIT/gsm%20shield.html
Gizduino+(Arduino) microcontroller with 2 h/w uart  http://www.e-gizmo.com/KIT/gizduino+%20164,324,644.html
« Last Edit: January 21, 2013, 09:33:12 am by IceScream » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49386
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Real links are more useful that text.

Where is your code to read from the GPS?
Where is your code that illustrates that you can send anything via the GSM shield? What do you want to send to?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used this code for GSM and microcontroller only,, and it works:

/*
  GSM Send Sketch for Arduino
 
  Initializes GSM Module and sends an SMS to recipient
 
  The circuit:
  *Arduino pin 0 (RX) - GSM Module (TX)
  *Arduino pin 1 (TX) - GSM Module (RX)
 
  Created 2010
  by Meann Zabanal
  Modified
  by John for GSM Shield testing
*/

char Rx_data[50];
unsigned char Rx_index = 0;
int i = 0;
char msg[160];
int sig;

void setup() {
  Serial.begin(9600);
 
  initGSM();
  send_msg("***********, "Hello");
}

void loop() {
  //none
}

void send_msg(char *number, char *msg)
{
  char at_cmgs_cmd[30] = {'\0'};
  char msg1[160] = {'\0'};
  char ctl_z = 0x1A;

  sprintf(msg1, "%s%c", msg, ctl_z);
  sprintf(at_cmgs_cmd, "AT+CMGS=\"%s\"\r\n",number);
 
  sendGSM(at_cmgs_cmd);
  delay(100);
  delay(100);
  delay(100);
  sendGSM(msg1);
  delay(100);
}

void sendGSM(char *string){
  Serial.write(string);
  delay(90);
}

void clearString(char *strArray) {
  int j;
  for (j = 100; j > 0; j--)
    strArray[j] = 0x00;
}

void send_cmd(char *at_cmd, char clr){
  char *stat = '\0';
  while(!stat){
    sendGSM(at_cmd);
    delay(90);
    readSerialString(Rx_data);
   
    stat = strstr(Rx_data, "OK");
  }
  if (clr){
    clearString(Rx_data);
    delay(200);
    stat = '\0';
  }
}

void initGSM(){
 
  send_cmd("AT\r\n",1);                 
//  send_cmd("ATE0\r\n",1); // Turn off automatic echo of the GSM Module   
   
  send_cmd("AT+CMGF=1\r\n",1);         // Set message format to text mode
  //Sucess
 
  Serial.println("Success");
   
  delay(1000);
  delay(1000);
  delay(1000);
}

void readSerialString (char *strArray) {
 
  if(!Serial.available()) {
    return;
  }
 
  while(Serial.available()) {
    strArray = Serial.read();
    i++;
  }
}

//----------------------------------------------------AND This is my code for GPS Shield and MCU(works)-------------------------------
void setup()
{
  Serial.begin(9600);
 
}

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


my problem is how to combine their code when i'm using 2 hardware uarts?? smiley-sad
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49386
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The GPS shield you are using allows you to select pins 0 and 1 or pins 2 and 3 for the serial port.

The GSM shield you are using allows the same selection.

That the Gizduino may have more than one hardware serial port is irrelevant as far as those two shields are concerned. Unless you do some pin bending.

You'll need to use SoftwareSerial to talk to one of the devices.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the Gizduino may have more than one hardware serial port is irrelevant as far as those two shields are concerned. Unless you do some pin bending.

yes sir... i bend pins Rx = 0 and Tx = 1 on my GPS Shield and wired them on my MCU lower pins Rx = 2  and Tx = 3...

my Gsm Module that is connected on pins Rx = 0 and Tx = 1 is parallelled in the middle of my microcontroller and my GPS shield sir smiley

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How to call gps and gsm in arduino using 2 uart sir?

void setup()
{
Serial.begin(9600); // gsm module?
Serial1.begin(9600); //gsp shield?
}

is this ok?
Logged

Pages: [1]   Go Up
Jump to: