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 support@ccsinfo.com

modem mystery

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







modem mystery
PostPosted: Thu Jul 17, 2003 11:14 am     Reply with quote

Hello,
I am having a strange problem trying to dial out with a modem. when I run the program, the modem picks up the phone (goes on-line), but then hangs up and it keeps doing this (not really at regular intervals). Now if I disconnect power to the pic, everything stops at you would expect, BUT if instead of disconnecting power, I connect my MPLAB ICD 2 programmer, the modem stays on-line and dials in successfully!

I thought it might be setting a flow control pin high or something, so I tried playing around with the values of RTS and CTS, but it didn't work.

My code is listed below.
Does anyone have any suggestions??

Thanks,
mle

#include "mylcd.h"
#include "1wire.h"
#include <string.h>

#define DegreeSymbol 223 //ascii code for degree symbol

#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#byte ADCON1 = 0X9F //The adcon1 register

/*----------FUNCTIONS-----------*/

/***************Main Program Starts Here*************/
void main(){

//Variables
char phone[8],line1[25];

/*----------configure all the ports-------*/
Set_Tris_A(0x00); //set port A to outputs
Set_Tris_B(0x33); //make RB5, RB4(BUTTONS),
//RB1 (DQin) and RB0(pulse in) inputs
Set_Tris_C(0xD7); //RC7, (Hserin), RC4(RTC),
//RC2, RC1, RC0 inputs
Set_Tris_D(0x00); //set port D to outputs
Set_Tris_E(0x00); //set port E to outputs

/*-----------set PIC registers------------*/
ADCON1=0b00001110;

//Flow control pins
Output_High(PIN_C2); //set CTS to high
Output_Low(PIN_C1); //set RTS to low


delay_us(500);
lcd_init();
lcd_clear();

strcpy(line1, "RS232test"); // copy string
lcd_puts(line1);
delay_ms(1000);
printf("ATDT4333870\%c\%c",10,13);
delay_ms(3000);

while(1);
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516104
Kevin Howell
Guest







Re: modem mystery
PostPosted: Thu Jul 17, 2003 12:00 pm     Reply with quote

:=Hello,
:=I am having a strange problem trying to dial out with a modem. when I run the program, the modem picks up the phone (goes on-line), but then hangs up and it keeps doing this (not really at regular intervals). Now if I disconnect power to the pic, everything stops at you would expect, BUT if instead of disconnecting power, I connect my MPLAB ICD 2 programmer, the modem stays on-line and dials in successfully!
:=
:=I thought it might be setting a flow control pin high or something, so I tried playing around with the values of RTS and CTS, but it didn't work.
:=
:=My code is listed below.
:=Does anyone have any suggestions??
:=
:=Thanks,
:=mle
:=
:=#include "mylcd.h"
:=#include "1wire.h"
:=#include <string.h>
:=
:=#define DegreeSymbol 223 //ascii code for degree symbol
:=
:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
:=
:=#byte ADCON1 = 0X9F //The adcon1 register
:=
:=/*----------FUNCTIONS-----------*/
:=
:=/***************Main Program Starts Here*************/
:=void main(){
:=
:=//Variables
:=char phone[8],line1[25];
:=
:=/*----------configure all the ports-------*/
:=Set_Tris_A(0x00); //set port A to outputs
:=Set_Tris_B(0x33); //make RB5, RB4(BUTTONS),
:= //RB1 (DQin) and RB0(pulse in) inputs
:=Set_Tris_C(0xD7); //RC7, (Hserin), RC4(RTC),
:= //RC2, RC1, RC0 inputs
:=Set_Tris_D(0x00); //set port D to outputs
:=Set_Tris_E(0x00); //set port E to outputs
:=
:=/*-----------set PIC registers------------*/
:=ADCON1=0b00001110;
:=
:=//Flow control pins
:=Output_High(PIN_C2); //set CTS to high
:=Output_Low(PIN_C1); //set RTS to low
:=
:=
:=delay_us(500);
:=lcd_init();
:=lcd_clear();
:=
:=strcpy(line1, "RS232test"); // copy string
:=lcd_puts(line1);
:=delay_ms(1000);
:=printf("ATDT4333870\%c\%c",10,13);
:=delay_ms(3000);
:=
:=while(1);
:=}

Search for "Modem" on the forum and you will find some info that might help (Look for my name - Kevin Howell). I tried the same and it worked for me. The modem has to be "woken up" before you send any commands to it. You basically toggle the DTR line before sending a command to the modem...I had the same problem and I posted the problem on the forum and got a very detailed message from another friendly forum contributor...
Don't know why the ICD2 makes a difference though...

Kevin
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516106
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