Author Topic: Modem connection  (Read 15824 times)

peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Modem connection
« on: September 20, 2006, 01:26:26 PM »
Hi There,
I?ve got at T100MD888 Plc connected to a  Fargo Maestro GSM Modem. Communication is one way ? From PLc through Modem-to-modem-to-PC-running-Trilogi server
The PLC dials a predefined modem number and  when connected it dumps some of the content of the DM variable. I use the modem script from Trilogy
This has been working fine for a month now. The PLC dials the number every night at 0315 and dumps the DM variable ( approx DM[1] to DM[1500]  to a text file and sends a short email.
BUT twice the PLC has dialed the number without connecting and NOT hung UP.
That means the modem has been on for several hours and only hung up when the prepaid SIM card ran out of money.
When I go to the PLC everything looks fine - data is in DM. So i Change the PLC RTC to 0313 and two minutes later the connection is made, Data dumped, email sent and RTC syncronised with the Server through a trilogy script. but what went wrong ?
I am not sure where to look for the error. Does anybody have a modified version of the modem script that works better?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Modem connection
« Reply #1 on: September 20, 2006, 03:27:13 PM »
If the GSM modem is not connected to the PC modem, it shouldn't be consuming the air-time right? Normally if you dial a remote modem and if there is no connection you are not charged.

If the airtime indeed ran out, then more likely it is because the PLC has properly connected to the remote modem and perform its task, but then when the PLC subsequently sent a disconnect command to the modem, it was not picked up by the modem and therefore the modem was not disconnected.

The PLC's serial port does not support certain modem signal such as DCD, DTR, DSR so it doesn't know if the modem is still connected. This mean that in your software you need to check if a connection exist by checking the message returned from the modem (such as "CONNECT" message) or from the TLServer (such as the "OK" message). What you may have to do is to check if the modem send any message if it successfully disconnect from the remote modem. Then the PLC program should monitor for this message and if it did not receive the message after attempting to disconnect the modem, then the PLC should re-attempt to  disconnect the modem.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Re:Modem connection
« Reply #2 on: September 28, 2006, 04:44:55 AM »
Thanks for the suggestions. The error, however,   was once again to be found 15 inches from the screen...

I made a divide by zero error in the mail I send out so the mail stops half way. The error only occurs in very seldom cases but never the less it happens and I had forgotten to check for it.

will probably be back soon with other questions. Once again thanks for the prompt support

/Peter

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Modem connection
« Reply #3 on: September 28, 2006, 05:31:09 AM »
You are welcome!

There are quite a number of our users interesting in interfacing the T100MD+ PLC to the GSM modem or to send SMS. When you have the time and would like to share your experience using the GSM modem (make and model etc of the modem that you successful used) please post some of your thoughts at the following thread:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=301

Thanking you in advance!
« Last Edit: September 28, 2006, 05:31:47 AM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

jwcalderon

  • Newbie
  • Posts: 4
  • I'm a llama!
    • View Profile
Re:Modem connection
« Reply #4 on: September 28, 2006, 02:28:32 PM »
Hi,

Please tell me the cable config to connect de PLC and the modem. I try to connect a T100MD+ with a Enfora GSM and the modem not respond when i send a AT command.

Thanks for your help.

peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Re:Modem connection
« Reply #5 on: September 29, 2006, 12:52:46 AM »
This  is my connection but I doubt if it helps

PLC                                Modem DB15
2     --------BLUE-------------- 2   

3      --------GREEN-------------6

                                     |---- 7
           |-----8

4     -------Gray-----------------9

Try setting up a cable that communicates between an PC and MODem with EG Hyperterminal. That means you understand the cabling.

What does the modem require/use  DSR-DTR? RTS-CTS? if either of them are nedeed then you will have to shortcircuit them on the modem side like I have done with pin 7-8
Your cable should look something like this

PLC                          Modem
TX ---------------------- RX
RX ---------------------- TX
GND --------------------  GND
                              |-- DSR
                              |-- DTR

And in some cases also
                              |-- CTS
                              |-- RTS

good luck

Peter

jwcalderon

  • Newbie
  • Posts: 4
  • I'm a llama!
    • View Profile
Re:Modem connection
« Reply #6 on: September 30, 2006, 08:02:52 AM »
peterh_DK, thanks for you response.

In depth, the problem is the following :

I have a  T100MD+ with the rs232 functional (i probe with a V92 US Robotics Modem and is OK), this port is DCE and the rs232 of the Enfora is too DCE, then the type of cable its most be cross over, i probe with a lot of cable config, for example :

both port are 9 pin female.

Figure 11-1. Null modem cable with full status and handshaking (Aprobada por enfora)

                    Conector                                Conector
                    9 Pines                                 9 pines

Signal ground    5   ---------------    5    Signal ground
Receive data     2   ---------------    3    Transmit data
Transmit data   3    ---------------    2    Receive data
Ready to send   7   ---------------    8    Clear to send
Clear to send    8    ---------------    7    Ready to send
Data terminal ready    4  ----+----    1    Data carrier detect
                                            |
                                           +----    6    Data set ready
Data carrier detect    1    ----+----    4    Data terminal ready
                                            |
     Data set ready    6    -----+

or

Figure 11-2. Variation on null modem cable with full status and handshaking

      Signal ground ---------------------- Signal ground
       Receive data ---------------------- Transmit data
      Transmit data ---------------------- Receive data
      Ready to send ---------------------- Clear to send
      Clear to send ---------------------- Ready to send
Data terminal ready ----+----------------- Data carrier detect
                                    |
     Data set ready ----+
                                                     +---- Data set ready
                                                      |
Data carrier detect ----+------------+---- Data terminal ready

    Ring indication -- not connected

                          not connected -- Ring indication

or

2   ---   3
3   ---   2
4   ---   4 and 6
5   ---   5
            7 with 8
            8 with 7

or

2   ---   3
3   ---   2
4   ---   6
5   ---   5
6   ---   4

when send the AT command (ATZ for example) the modem not respond nothig (OK or ERROR nothing).

Please can you tell me the pinout config of the DB 15 port (then maybe i can make a association and build another type of cable).

One more thing, the configuration of PLC and modem port is :

Spped :  9600
Data Bits :     8
Parity : None
Stop Bits :    1
Flow Control :  None

Thanks very much








peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Re:Modem connection
« Reply #7 on: October 01, 2006, 07:55:38 AM »
This is what it looks like
                                        SUB D 15 Modem
2    --------BLUE-------------- 2   TX

3      --------GREEN-------------6 RX

                                    |---- 7 DSR
                                    |-----8 DTR

5   -------Gray-----------------9  GND

You say your speed is 9600 but are you positive this speed has also been set on the Modem?

HTH

Peter
« Last Edit: October 20, 2006, 11:32:19 PM by peterh_DK »

jwcalderon

  • Newbie
  • Posts: 4
  • I'm a llama!
    • View Profile
Re:Modem connection
« Reply #8 on: October 02, 2006, 02:06:45 PM »
Hi Peterh_DK,

When i connect the modem with a PC (Using Hyperterminal), the connection is sucessfull and then i can send sms messages :

AT+CMGF=1[Enter]                 +CMGF=1 - set modem in
                                                text mode (=0 modo PDU)
AT+CMGS="#_mobil"[Enter]     Send SMS (^Z equals StrgZ).
>Message^Z          


Hyperterminal settings :

Spped :  9600
Data Bits :    8
Parity : None
Stop Bits :    1
Flow Control :  None

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Modem connection
« Reply #9 on: October 02, 2006, 07:35:30 PM »
The PC's RS232 port is male DB9
The PLC's RS232 port is female DB9

So if your cable (I assume is female DB9) works with the PC, then you need a male-to-male cross over cable to connect that to the PLC with the following pins:

   2 - 3
   3 - 2
   5 - 5
 
The PLC actually only needs 2,3 and 5 and doesn't need the other signals but if your modem need those signal in order to work then you will still need to short them such that 7,8 are shorted, and also 4, 6 are shorted.

After that, try to verify if the PLC can activate the GSM modem to do something simple, such as dial a phone number. If it can, then proceed to the next step.

Note that in order to program in TBASIC to send the quotation character (") to the modem, you need to use the CHR$(34) to construct the string:

To send: AT+CMGS="#_mobil"[Enter]    

PRINT #1, "AT+CMGS="+CHR$(34)+"#_mobil"+CHR$(34)

Email: support@triplc.com
Tel: 1-877-TRI-PLCS