View previous topic :: View next topic |
Author |
Message |
Marky
Joined: 04 Jan 2004 Posts: 3
|
Embedded Internet Kit: PC dials up to PIC |
Posted: Sun Jan 04, 2004 2:24 am |
|
|
Hallo all,
i have the embedded internet kit and some problems with it. I want to do the following:
There is a PC in one location and the Internet board in another location. The PC should dialup a connection over the phoneline (not to a provider) to the PIC board. The PIC should listening on the line and realizing the incoming call. The PIC should than unhook an answer with a data sequence. If the connection is made the PC sends data to the PIC and ends the connection. That's it.
I hope someone has a resolution of my problem.
Many many thanks.
Hopefully
Marky |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Sun Jan 04, 2004 11:28 am |
|
|
So you are saying that you want a PIC with a Modem attached to a POTS line (POTS = Plain Old Telephone System).
PC dials out (ATDT5551212 for example) and the PIC's Modem is configured to autoanswer and negotiate a connection.
Once the connection is negotiated the PIC is supposed to send back an acknowledgement. If the PC recognizes the ACK it is supposed to send a little data to the PIC and then the PIC modem is supposed to go back "on-hook"?
No Internet protocols involved here, just a modem-to-modem connection over phone lines?
If this is the case I would search the old postings for phases like MODEM and PHONE LINE. I have done this in the past but for a commercial application so I can't give specifics on how it was done. The biggest issue was the configuration strings for the PIC's modem. Other than that it was just an exercise in writing code for the PIC's UART and decoding data streams.
PIC Code Outline:
1) Initialize I/O, timers, UART etc for PIC
2) Send initialization string(s) to modem. Each string must be answered by the modem correctly before the next string is sent. We had a total of three strings. All the configuration codes could have been put into one string but by using 3 it was a little easier to debug since we could tell which groups of codes we had set wrong.
3) DUMP THE RECEIVE BUFFER OF THE PIC AND MODEM
4) Wait for the phone to ring! If this is all the PIC is doing then it could be a simple polled loop on KBHIT. But if you are asking the PIC to do other things, look into using the UART receive interrupt and a software receive buffer.
5) Decode incoming data from modem and PC
6) Respond appropriately
7) Back to #3 _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Marky
Joined: 04 Jan 2004 Posts: 3
|
|
Posted: Thu Jan 08, 2004 1:24 am |
|
|
Hallo Rob,
thank you very much for the fast answer. But I have a few questions about modem-to-modem connection. Hope you can help me.
The situation:
----------------
My friend is calling my PIC-Board with the Hyperterminal software. He has a analog modem.
My telephone rings and the PIC-Board-Modem autoanswers after 1 ring (AT-command "s0=1").
I'm monitoring the PIC with Hyperterminal. The PIC-Software on PIC-Board I wrote is configured to send each button (pressed in hyperterminal) from the PIC-modem to the POTS.
Now the problem:
If I press any key in hyperterminal the modem ends the connection and answers with "NO CARRIER".
Is this a problem of initializing the PIC-modem or the modem of my friend?
Or is it a HW-problem?
I hope you can help me.
the hopefull Marky |
|
|
Marky
Joined: 04 Jan 2004 Posts: 3
|
Problems |
Posted: Thu Jan 08, 2004 5:48 am |
|
|
rwyoung wrote: | So you are saying that you want a PIC with a Modem attached to a POTS line (POTS = Plain Old Telephone System).
PC dials out (ATDT5551212 for example) and the PIC's Modem is configured to autoanswer and negotiate a connection.
Once the connection is negotiated the PIC is supposed to send back an acknowledgement. If the PC recognizes the ACK it is supposed to send a little data to the PIC and then the PIC modem is supposed to go back "on-hook"?
No Internet protocols involved here, just a modem-to-modem connection over phone lines?
If this is the case I would search the old postings for phases like MODEM and PHONE LINE. I have done this in the past but for a commercial application so I can't give specifics on how it was done. The biggest issue was the configuration strings for the PIC's modem. Other than that it was just an exercise in writing code for the PIC's UART and decoding data streams.
PIC Code Outline:
1) Initialize I/O, timers, UART etc for PIC
2) Send initialization string(s) to modem. Each string must be answered by the modem correctly before the next string is sent. We had a total of three strings. All the configuration codes could have been put into one string but by using 3 it was a little easier to debug since we could tell which groups of codes we had set wrong.
3) DUMP THE RECEIVE BUFFER OF THE PIC AND MODEM
4) Wait for the phone to ring! If this is all the PIC is doing then it could be a simple polled loop on KBHIT. But if you are asking the PIC to do other things, look into using the UART receive interrupt and a software receive buffer.
5) Decode incoming data from modem and PC
6) Respond appropriately
7) Back to #3 |
Hallo Rob,
thank you very much for the fast answer. But I have a few questions about modem-to-modem connection. Hope you can help me.
The situation:
----------------
My friend is calling my PIC-Board with the Hyperterminal software. He has a analog modem.
My telephone rings and the PIC-Board-Modem autoanswers after 1 ring (AT-command "s0=1").
I'm monitoring the PIC with Hyperterminal. The PIC-Software on PIC-Board I wrote is configured to send each button (pressed in hyperterminal) from the PIC-modem to the POTS.
Now the problem:
If I press any key in hyperterminal the modem ends the connection and answers with "NO CARRIER".
Is this a problem of initializing the PIC-modem or the modem of my friend?
Or is it a HW-problem?
I hope you can help me.
the hopefull Marky |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Thu Jan 08, 2004 8:49 am |
|
|
Marky,
I can't say from your description what is happening but I would attack the problem by simplifying your system. Test and verify small portions first then start putting them together into the larger configuration.
What I would try to do is simplify the set up first. Instead of using the modems between the two systems, do it all on your desk with a serial line between PC #1 and Hyperterm (that represents your friend's PC accross town). From PC #1 use a null modem cable to your PIC-board without its modem. You may need to build or hack in some MAX232 drivers. This eliminates the modem initialization issues at both ends. Then you would monitor your PIC-board through its second serial port (I'm not clear on your setup but you implied you could talk to your PIC-board via Hyperterm in PC #2).
Now you can comment out all the modem initialization code for your PIC-board and just test how it is passing characters back and forth. Once you are happy with that then you can start to test the modem stuff.
Other issues I've delt with in modems is the proper driving of the CTS/DTR lines. Some modems can survive just fine with a simple 3 wire (GND, TX, RX) connection and others must have some degree of hardware handshake.
In the last project I did with modems, the initialzation strings were pretty complicated and arrived at after lots of fiddling around. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
|