Passing AT commands to the PL2303 GPRS library

Hi,

I have been using the PL2303 GPRS library for sending commands to the modem and receiving the replies via serial input and output. Now I want to send commands by just passing the AT commands in the code to the function and get the reply on the serial output. The code from the library is given below

 uint8_t rcode;
       
       /* reading the keyboard */
       if(Serial.available()) {
         uint8_t data= Serial.read();
       
         /* sending to the phone */
         rcode = Pl.SndData(1, &data);

In the command line uint8_t data= Serial.read(); I want to skip the serial read and pass the string value such as AT ot AT+CREG to the Pl.SndData function. Any idea how I can do that by using uint8_t because when i try char it gives me error because all the pointers and variables in the library have been defined as uint8_t

BR,
Vik

You mean like uint8_t myCommand [] = "AT ot AT+CREG "; ?

uint8_t data= Serial.read();

[\code] 

I want to pass string value of "AT" to the variable data which i was otherwise passing it from the serial input.

You simply can't fit three bytes into one.

Why don't you tell us what you're trying to do, not how you think it should be done?

Well I have used the below mentioned functions to convert the string to uint8. These lines have been provided by Oleg in his ADK example

const char* recv = "Received: ";
rcode = adk.SndData( strlen( recv ), (uint8_t *)recv );

And this actually is working for me :slight_smile:

Case Closed !