[SOLVED] How to send at commands to uart of pic32

Status
Not open for further replies.

Dhruv@aks

Newbie level 6
Joined
Sep 4, 2014
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
93
Hi i am using uart of pic32 micro controller to send at commands to a sim900gsm device.
please suggest a way to do that.
 

connect the SIM900 to PIC32 UARTs plus a UART for PC communications


I am using the uart2rx and tx to connect to the pic32 but how do i connect this to the sim900 device.I am looking for the cicuit diagram for it or the connecting pin.
i can connect them seprately.But how do i send commands to the sim900 using pic32.
 

I am using the uart2rx and tx to connect to the pic32 but how do i connect this to the sim900 device.I am looking for the cicuit diagram for it or the connecting pin.
i can connect them seprately.But how do i send commands to the sim900 using pic32.
which PIC32 are u using?
for eaxmple connect the PC to UART2 and the modem to UART1
I have a PIC32MX575F512H PC Rx to pin 31 and Tx to pin 32 with modem (a WISMO228) Rx pin 51 and Tx pin 52
many of the moden PIC32s have Programmable Pin Select with means you can select the Tx and Rx pins at run tim (also makes PCB layout simpler)

simple code for the PC to communicate with the modem looks like
Code:
   UART1Init(115200);            
   UART2Init(115200);
   while(1)
           {
           if(UART2CharReady()) UART1PutChar(UART2GetChar());
           if(UART1CharReady()) UART2PutChar(UART1GetChar());
           }
it is a good idea to interrupt control the UART receivers with data into ring buffers or you mau loose data (in particular if the PC baudrate is less then the modem
 
Last edited:



I am using PIC32mx795F512l. To send the at commands to the Pic32 i use the fuction

while(!UARTTransmitterIsReady(UART2))
;
UARTSendDataByte(UART2, "AT Commands......");

What should i use??i found this fuction in an example
After sending to pic32 how do i further send it to sim900 gsm device from the pic32
 

what are you trying to do?
1. type commands at the PC transmitted to the modem via the PIC32 and see the response on the PC window - if so a simple program loop such as in my last post will do
2. send complete commands such as AT+CSQ from the PIC32 to the modem and then check the response from the modem

don't worry about the names of functions - they vary from implementation to implementation but do the basic operations, e.g. check if transmitter ready to send, send a characater, has a character been received, read a character, etc
 

Please mention the exact PIC32 you are using. I will write a mikroC PRO PIC32 code for you.
 

i think i found the solution.what i was trying to do was to connect the connect the pic32 to the modem and send at commands from pc through pic32 to get response from the gsm.
So thank you.Can you also help me make a menu program for Jhd204a screen using pic32 which when a button is pressed changes...??
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…