If your controller is hooked up to a modem, a phone number may be dialed from the controller's keypad. This explanation is based on a sample application that is installed on your hard disk together with VisiLogic. To open this application, open the Help menu, click Examples, and then select Dialing via Vision Keypad.
When downloaded, this application:
Displays a blinking cursor on-screen. This aids the user in entering a phone number by pressing keys on the Vision keypad.
'Converts' the entered numbers to ASCII, then saves them, as they are entered, into a vector of registers that starts at MI 1011, the Phone Entry vector. One ASCII character is entered into the low byte of each register.
A Transpose function is linked to the vector starting at MI1011. Transpose copies the low byte of each register in that vector, and stores it into the consecutive bytes of a vector that starts at MI 1001, the Phone Number Vector. For example, Transpose can extract the low bytes from MI 1011,1012, 1013 & 1013 and store all 4 bytes into MI 1001 and 1002.
Displays the numbers as they are entered, via the HMI variable Display ASCII String, which displays the Phone Number vector starting at MI 1001.
The character Carriage Return (ASCII value 13) is required by the modem as the final character in the number to be dialed. When the user has finished entering the number and presses Enter, the Carriage Return value is stored as the final character in the vector that provides the phone number.
Finally, the number us dialed via a Dial FB. The FB dials the number contained in the vector of registers starting with MI 1001, Phone Number vector.
|
Note ♦ |
In order to understand how this application works, you must be familiar with the Vector: Fill (Offset) and Vector: Transpose functions. |
The application is based on the Wavecom GSM modem. The Vision-to-modem connection is via COM 2.
The net shown below is the first net of the main program module. When COM 2 is initialized, SB 82 Modem Initialized: COM 2 turns ON; this condition activates the Dial function in the next subroutine, Enter Phone Number.

The ASCII values for 'underscore' and 'blank space' are alternately stored into MI 1008 at .5 second intervals. The current value is copied into the Phone Entry vector starting at MI 1011, via a Vector: Fill Offset FB.
The offset value is provided by a counter that increments after every number entered. The offset values ensures that the cursor value is included as the last character in that vector.
Every time a value is entered, Vector: Transpose copies the low bytes of the Phone Entry vector, which contains the ASCII values, to the Phone Number vector starting at MI 1001.

When a key is pressed, its value is automatically stored into SI 6. In this application, whenever keys 0 to 9 are pressed, the value stored in SI 6 is 'converted' to an ASCII value by adding the constant value 8. The ASCII value can then be displayed. For example, if Key#4 is pressed, the value in SI 6 will be 44 (HEX 2C). Adding 8 'converts' the value to 52 (HEX 34), which is the ASCII value for 4. 4 can then be displayed on the screen.
|
Note ♦ |
MI 1010 is incremented whenever a legal value is entered. The incrementing value acts as a pointer, correctly placing entered numbers in the Phone Number vector. |

Using the incrementing value of MI 1010 as a pointer, the Fill Vector function places each 'converted' number into the correct register in the Phone Entry vector, starting at MI 1011, .
Via the Transpose function, the low byte of each register in the Phone Entry is copied into the Phone Number vector as shown in the figure below.

The Dial function is linked to the Phone Number vector starting with MI1001. This vector is also displayed on the controller's screen.
|
Note ♦ |
Since the Enter key is pressed when the user has finished entering the number, SB 53 is used as one of the Dial conditions, as is SB 82 Modem Initialized. |
SB 87 Modem connected is used to activate the Hangup function, and to display text on the controller screen.

This application contains 1 display with 3 variables.
Disconnected\Connected: Binary Text variable

Show the phone number: Display ASCII String
This variable is refreshed in the Ladder application via MB 1000 in Variable: ASCII String.

While the number is being entered, the text Save will be displayed. Once the number has been entered, the status of SB 87 Modem connected determines whether Dial or Hangup will be displayed.
