551 301 02

 

 

 

PD 664 Configuration

The PD 664 can be used for sending and receiving SMS messages, as well as a gateway for P-NET communication via GPRS.

 

Configuring the PD 664 for sending and receiving SMS messages

 

The following equipment must be available:

 

Hardware

·         One or more PD 664 devices, including Base Module BM 010.

·         One antenna for each PD 664 device.

·         One SIM card for each PD 664 device.

·         A PC having a P-NET interface

e.g. to a PD 60x DPI (via Ethernet or RS232 I/F), a PD 3950 (via a USB port, or a PD 3930 (via the parallel port).

 

Software

·         A PC with VIGO 5.7 or higher installed.

·         A Workspace in VIGO, where a project including the PD 664 must be selected.

 

When the above has been satisfied, each PD 664 can be configured in the following way:

 

Hardware installation

 

1)    Install the SIM card in the PD 664.

2)    Install the PD 664 in the BM 010 Base Module.

3)    Connect the P-NET interface to the Base Module, either by using the terminals on the base module, or by mounting another module next to the PD 664 where P-NET communication can take place via the optical fibres in the base modules (P-NET Light-Link).

4)    Connect the antenna to the antenna connector, and power up the device.

5)    After power up, the Green ON LED will be ON and the Red Error LED may also be ON. This is normal initial behaviour for the module, where this error is typically caused by a missing or incorrect PIN code.

 

Software configuration

 

1)    Start VIGO and select the PD 664 node in the project.

2)    Use the ‘Set P-NET Node Address’ utility to set the node address and Number of masters for the P-NET port.  

3)    Use either the ‘Monitor’ available in the right mouse menu or the value field in VIGO View, to set Service.WriteEnable = True.

4)    Select the variable GPRS.PINCode in the MIB, and enter the PIN code for the inserted SIM Card. As soon as a valid PIN code has been entered, the Red Error LED will switch OFF.

5)    Set Service.WriteEnable = False.

6)    To ensure that the module is operational, is it advisable for the signal strength to be inspected before the module is ready for use. The value for GPRS.SignalStrength.Actual must be higher than 10. If the signal strength is lower than 10 it may be necessary to change to location of the antenna.      

 

7)    The module should now be ready to use  as an SMS Gateway.

 

 

 

 

PD 664 SMS Gateway -  Sending a Message

1)    The PD 664 sends a SMS for each element transferred to the buffer: SMSOutputBuffer.

 

2)    The variable SMSOutputBuffer is a record that consist of the two fields:

PhoneNo and Message.

 

3)    The SMSOutputBuffer can be easilybe accessed by the use of a Process-Pascal program running in a process controller / DPI, or by the use of a VIGO.pro object in conjunction with the OLE2 Automation interface in VIGO.

 

4)    When an element is written to SMSOutputBuffer, a message is sent to the phone number defined in the record. After transmission, or if the transmission fails, the SMS is deleted from SMSOutputBuffer. Note: Since this register is stored in volatile RAM, it will be cleared after power off and reset.

 

5)    The variable Statistics.SentSMS is incremented every time the PD 664 sends a SMS. Note: Since this register is stored in volatile RAM, it will be cleared after power off and reset.

 

6)    SMSOutputStatus, When an SMS is sent, the service centre returns a reference number. StatusIDNo is set to -1, when a message has been written to the SMSOutputBuffer. When MessageReferenceNo is not the value -1 and StatusIDNo remains at -1, the SMS has been sent without any problems.

 

Process Pascal example:

Procedure SendSMS(Message: TMessage; PhoneNumber: TPhoneNumber);

Var

  SMSOutput: SMSOutput_Type;

 

Begin

  SMSOutput.PhoneNo:= PhoneNumber;

  SMSOutput.Message:= Message;

  If not BufferFull(SMSGateway.SMS.SMSOutputBuffer) Then

  Begin

    SMSGateway.SMS.SMSOutputBuffer:= SMSOutput; 

    SendSMS_Flag := False; (* Global Flag *) 

  End;

End; 

 

TASK SendSMSMessage;

BEGIN

  SendSMS_Flag := False;

  Loop

    If SendSMS_Flag Then

    Begin

      SendSMS(Message,PhoneNumber); 

    End;

    ChangeTask;

  End;

END;

 

 

PD 664 SMS Gateway -  Receiving a Message

1)    A SMS message can, for example, be sent from a cellular phone to the PD 664 GPRS Interface module.

 

2)    All SMS messages are received in the SMSInputBuffer.

 

3)    The variable SMSInputBuffer is a record that consist of the four fields:

Type, TimeData, PhoneNo and Message

 

4)    The SMSInputBuffer can be easily be accessed by the use of a Process-Pascal program running in a process controller / DPI, or by the use of a VIGO.pro object in conjunction with the OLE2 Automation interface in VIGO.

 

5)    If the SMS is a normal text message, the value for Type is Zero. If the SMS Status report is enabled, the module will receive status reports, and these reports can be recognized by the value of the variable Type being equal to one.

 

6)    The variable Statistics.ReceivedSMS is incremented every time the PD 664 receives a SMS. Note: Since this register is stored in volatile RAM, it will be cleared after power off and reset.

 

Process Pascal example:

Procedure ReceiveSMS();

BEGIN

  If not BufferEmpty(SMSGateway.SMS.SMSInputBuffer) Then

  Begin

    ReceivedMessage:= SMSGateway.SMS.SMSInputBuffer;  (* Read SMSInputBuffer *)

  End;

END;

 

TASK ReceiveSMSMessages TIMEDINTERRUPT: 1.0;

BEGIN

  Loop

     ReceiveSMS();

     ChangeTask;

  End;

END;

 

 
Status report

1)    Enabling the SMS Status reports flag configures the module to request SMS status reports from the service centre. The status reports are received in the SMSInputBuffer.

 

2)    If a status report is received, the message holds two numbers separated by a comma. The first number is the message reference number. The second number is the message status code. The value of the status code will be in the range 0-255 and the interpretation of the status code can be found by the use of this link:

 status code.

 

 

PD 664 SMS Gateway, Watchdog configuration

1)    In this example Service.WDPreset is set to the value –1.0.

 

To ensure that a specific master continues to regularly communicate with the module, WDPreset could initially be set by that master to a negative number (e.g. -1). WDTimer can be updated in Process-Pascal by the use of, for example, a CyclicTask or TIMEDINTERRUPT to ensure that WDTimer is kept positive.

 

Process Pascal example:

Procedure WDConfig();

BEGIN

  SMSGateway.Service.WriteEnable := True;

  SMSGateway.Service.WDPreset := -1.0;

  SMSGateway.SMS.WatchdogSMSConfiguration.PhoneNo := PhoneNo;  

  SMSGateway.SMS.WatchdogSMSConfiguration.WDText := WDText;   

  SMSGateway.SMS.WatchdogSMSConfiguration.WDEnable := WDEnable;

  SMSGateway.Service.WriteEnable := False;

END;

 

TASK PD664_Watchdog TIMEDINTERRUPT: 2.0;

BEGIN

  WDConfig();

  Loop

    SMSGateway.Service.WDTimer := 10.0;

    ChangeTask

  End;

END;

 

 

2)    Service.WDPreset is set to a positive value, for example, 2.0 sec. 

WDTimer is automatically preset with the value from WDPreset, either each time the device is called via P-NET, or following a power-up or device reset. If the WDTimer reaches zero before it is preset again, the Watchdog_Error flag will be set, and an SMS will be sent.

 

PD 664 SMS Gateway, Watchdog

1)    In the event that this update is missed, for example because of an error in this master, the WDTimer will reach zero before it is preset again, whereupon the SMS.ChError.Act[11], Watchdog_Error flag will be set, and an SMS will be sent and the Red Error LED turned ON. The Act Watchdog Error flag will be cleared and the Red Error LED turned OFF as soon as WDTimer contains a positive value.

 

2)    Stop all communication to the PD 664 GPRS and as soon as the WDTimer reaches zero SMS.ChError.Act[11], Watchdog_Error flag will be set, and an SMS will be sent and the Red Error LED turned ON. If the PhoneNo field is empty, no SMS will be sent, if a valid PhoneNo is present and WDText is empty an empty SMS will be sent.

 

Related topics

Configuring the PD 664 as a gateway for P-NET communication via GPRS