Hello all,
Am trying to implement code to send SMS and make a Call (for testing only) using this PIC16F19176 with a GSM module: GA6-B.
Heres the arduino code:
// ---------------------------------------------------------------------------
// Example Support of GOOUUU TECH IOT-GA6-B Gprs Gsm Module
// ---------------------------------------------------------------------------
#include <SoftwareSerial.h>
#define GSM_RX 2 // Arduino pin 2 to URX
#define GSM_TX 3 // Arduino pin 3 to URX
SoftwareSerial sim(GSM_RX, GSM_TX); //
// The GSM
String number = "07905582XXX"; //-> change with your number
void setup() {
Serial.begin(9600); // GPS on 0,1 pin
Serial.println("System Started...");
sim.begin(115200);
delay(1000);
Serial.println("Communicating GSM/GPS.....");
sms(); //send sms
call(); //call to us
}
void loop() {
//do your code
} //loop
//-----------GSM Function ---------------------------------------------------------
void sms()
{
Serial.println ("Sending Message");
sim.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000);
Serial.println ("Set SMS Number");
sim.println("AT+CMGS=\"" + number + "\"\r"); //Mobile phone number to send message
delay(1000);
String SMS = "Sample SMS is sending....."; //sms content
sim.println(SMS);
delay(100);
sim.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
void call() {
sim.print (F("ATD"));
sim.print (number);
sim.print (F(";\r\n"));
}
And here relevant part of my code (not working):
--
include pps
pps_control_lock(FALSE)
RC6PPS = PPS_TX1 -- TX1 re-assigned to C6 (default)
RX1PPS = PPS_RC7 -- C7 re-assigned to RX1 (default)
pps_control_lock(TRUE)
--
--
--
-- ok, now setup serial
--const serial_hw_baudrate = 999_000
-- (115_200 / 256_000 / 512_000 já testados com sucesso)
--
-- Include and initialize serial hardware library.
const serial_hw_baudrate = 115200
--const serial_hw_baudrate = 9600
alias pin_TX_direction is pin_C6_direction -- Transmit pin.
alias pin_RX_direction is pin_C7_direction -- Receive pin.
include serial_hardware
serial_hw_init()
--
-- output library
include print
--
include delay
--
const byte AT1[] = "ATD"
const byte AT2[] = "XXXMyNumberXXX"
const byte AT3[] = ";"
--
forever loop
--
led = OFF
delay_1ms(10_000)
--
led = ON
print_string(serial_hw_data,AT1)
print_string(serial_hw_data,AT2)
print_string(serial_hw_data,AT3)
--print_crlf(serial_hw_data)
delay_1ms(5_000)
--
end loop
Testing only with a CALL making. No success so far.
AT commands are sent (received and read in computer)
Any help will be great.
Thank you very much.
Best Regards,
Filipe Santos.