CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC 18F8722 and Modem connection via rs232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ujjwal19



Joined: 01 Mar 2008
Posts: 3

View user's profile Send private message

PIC 18F8722 and Modem connection via rs232
PostPosted: Mon Mar 31, 2008 9:21 am     Reply with quote

Hi,
My PIC is communication to the PC and the MODEM is communicating to the PC individually via rs232. I get a response as "OK" or "ERROR" from the modem when i send a command "AT" to the modem from the PIC using rs232.

But i am not able to get the response when i connect the PIC and the Modem together. I have taken care of the handshaking signals and the cross over cable issues. Am using both the RS232 in the PIC, one to send the command to the PIC and the other to monitor the response coming back from the PIC.

i have a simple test code as follows. Could anyone please suggest me what i am doing wrong and help me with the code, since PIC and Modem is not communicating at all. Here i am just trying to capture the "O" or the "E". The modem baud rate and other settings and the PIC settings are set all same.
Code:
#include <18f8722.h>
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)


#use rs232 (baud=19200, xmit=PIN_C6, rcv=PIN_C7, stream=PORT1)
#use rs232 (baud=19200, xmit=PIN_G1, rcv=PIN_G2, stream=PORT2)

void main() {
  char response;
     
   setup_timer_0(RTCC_INTERNAL);
   while(TRUE) {
      fputc(0x41,PORT2); //A in Hex
      fputc(0x54,PORT2); //T in Hex
      fputc(0x0D,PORT2); //Carriage return
     
      response=fgetc(PORT2);
     
      fputc(response,PORT1);
   }
}

Thank you very much.

Regards,
Ujjwal
Matro
Guest







PostPosted: Mon Mar 31, 2008 9:30 am     Reply with quote

Are you fully sure of your hardware (especially that RX and TX lines are not inverted)?
Did you check that baudrate, parity, stop bit length were the same on both sides?
Are the voltage levels compatible?

Matro.
ujjwal19



Joined: 01 Mar 2008
Posts: 3

View user's profile Send private message

PostPosted: Mon Mar 31, 2008 10:52 am     Reply with quote

thanks a lot for the reply. Yes, i did check the Rx and Tx and they are not inverted. Also the parity , baudrate and the stop bit lengths are same.
Since the pIC and Modem were communicating with the PC individually via the RS 232 so i thought the voltage levels will be fine. But will check that once.

Do u think my code is fine or is something wrong there??

Thanks a lot.

regards
ujjwal
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group