You are on page 1of 12

Page 1

EB647-80-1
E-Blocks Mobile
Comms Bundle

E-Blocks Mobile Communications Bundle

Cover Page

Copyright 2010 Matrix Multimedia Limited


Page 2

EB647-80-1
Flowcode E-Blocks Mobile
Comms Bundle
Installing Flowcode
Instruction for installing Flowcode can be found inside the installation booklet located inside the
Flowcode DVD case.

Before starting with the course it is recommended to update your version of Flowcode to the lat-
est released version. This allows for the latest bug fixes and components to run on your ma-
chine. The latest version of Flowcode can be found by visiting the Matrix Multimedia website
and clicking on the Flowcode page.

http://www.matrixmultimedia.com/Flowcode3a-X.php

Getting Started with Flowcode


There is a free online course available for helping with getting started with learning Flowcode.
This course covers basic principals through to designing your own programs and programming
the devices. It is recommended that you take time to go through this course before proceeding
with the bundle exercises to give you a better grasp of what the Flowcode program is doing.

The online course is available from the learning centre on our website or by visiting the following
address:

http://www.matrixmultimedia.com/lc_microcontroller.php

Flowcode Examples
A number of pre-made example files are available for download from the main Flowcode page
on the Matrix Multimedia website. These files are also located on the Flowcode CD. Before the
example files can be used you must first copy them into a folder on your hard drive.

The example programs referenced in this bundle can be found at the following web address:
http://www.matrixmultimedia.com/lc_bundle_manuals.php

Or by clicking the bundle manuals link from the Learning Centre area of our website.

Flowcode Help
There is a help file available that covers all the main features of Flowcode. This help file can be
accessed by clicking the question mark icon in the main Flowcode toolbar or alternatively click-
ing the help menu and selecting contents.

There are also help files available for each and every component in Flowcode which explain the
functionality of the component and the component macros. The component help files can be
found by selecting the component on the panel and the clicking the Help button in the properties
toolbar.

General Support
Support for frequently encountered problems can be found online on our FAQ’s site.
Our online forums can also be used as a general discussion area or for help or advice.

Copyright 2010 Matrix Multimedia Limited


Page 3

EB647-80-1
Wiring & Testing E-Blocks Mobile
Comms Bundle
To setup your E-Blocks for use with the
example programs you must perform
the following actions:

• Remove the 16F88 Device from


the EB006;
• Insert the 16F877A into the
EB006;
• Connect up the E-Blocks as
shown on the right.
• The RS232, and LCD E-Blocks all
need to be connected to the +V on
the EB006 via single core wire.
• The GSM modem has its own
power supply which will also need
to be connected.
• The GSM modem also requires a
standard pay and go SIM card.

Before you can begin you must install the driver for the EB006 using the ELSAM CD or by
visiting the Matrix Multimedia website: http://www.matrixmultimedia.com

The system can be tested by compiling and


sending one of the example programs to
the hardware. This is done by opening one
of the example files in Flowcode and then
clicking the compile to chip button.

The example Flowcode files contain a cor-


rect configuration so you will not have to
modify the configuration to allow them to
run on the hardware.

Any program you create from scratch will


have to be configured as shown on the left.
The configuration is specified by clicking
the Chip -> Configure menu icon Flowcode
and then if you need more options click the
switch to expert config screen button.

Example file 1 is a good test file as it allows


a text message to be sent using the GSM
modem. This confirms that the GSM mo-
dem is working with your SIM card and
also that your SIM card has credit. Please
note that the SIM card must be pay and go.

Copyright 2010 Matrix Multimedia Limited


Page 4

EB647-80-1
RS232 Component E-Blocks Mobile
Comms Bundle
The Flowcode RS232 component can be added to your program by finding the component in
the Comms section of the Flowcode component toolbar.

RS232 Component Icon

Once the component has been added to your program you will find that the RS232 component
icon has been added to your panel.

The RS232 component


properties page is laid out
as shown on the left.

The GSM modem requires


hardware flow control to al-
low the data to wait until the
microcontroller is available
to process the incoming
data.

A hardware UART is recom-


mended as this allows for
hardware buffering of the
incoming data. The software
UART can be used if your
hardware UART is unavail-
able.

The GSM modem requires a


baud of 9600 for communi-
cations to work correctly.

The RS232 functionality is called in Flowcode by using a component macro icon.

The functions available are as follows:

• Send Char— Transmits a single 8-bit byte over the serial connection.

• Send String— Transmits a number of 8-bit bytes in one transaction.

• Receive Char— Checks to see if a single incoming byte is available. Returns the data if it
is available or 255 if no data was available.

• Receive String—Checks to see if a number of incoming bytes are available. Returns the
data if it is available or a blank string if no data was available.

Copyright 2010 Matrix Multimedia Limited


Page 5

EB647-80-1
Example 1 E-Blocks Mobile
Comms Bundle
The component macro functions that go with the Flowcode RFID component may not all be suit-
able for your RFID device. Please refer to this list to see if a particular function is available for
the device you are using.

The recipient mobile phone number is specified at the start of the


program by initializing an array of byte variables with the numeric
data.

The text content of the message is specified next in the program.


The array must be large enough to allow for the complete con-
tents of the message to be initialized. The number 32 represents
an ASCII space character and the number 0 represents a string
termination. A line feed would be a number 10 and a carriage
return would be a number 13.

The GSM modem uses a command terminology known as


AT commands. The AT commands always start with the
characters “A” and “T” to bring the remote device to atten-
tion. Sending a number 13 to represent a carriage return has
the effect of allowing the AT command to be executed on the
GSM modem. Here we simply send the command “AT”. If
the command was successful then we should receive an OK
back from the modem using the GSM_RCEVE macro. The
GSM_DELAY macro simply allows for a delay in between
commands.

Copyright 2010 Matrix Multimedia Limited


Page 6

EB647-80-1
Example 1 E-Blocks Mobile
Comms Bundle

Example 1 starts up the GSM modem by sending some basic AT commands and collecting the
response. The INIT_GSM macro is responsible for issuing the following start up commands.

The first command is a simple AT which is used to ensure that the modem is present and com-
municating correctly.

Next we send the command AT+CSMP which is responsible for defining the text mode parame-
ter.

The AT+CSDH command controls the default header in text mode.

The AT+CMFG command defines the message format as text mode.

Each command is terminated by issuing a number 13 to represent a carriage return and each
command should be acknowledged by a message “OK”.

Once we have set the modem up ready to send a text message we are ready to start the proc-
ess of sending out the message details to the modem. The SEND_SMS macro is responsible
for passing information to the GSM modem such as the phone number to send the message to
as well as the message itself.

The AT+CMGS command defines the recipient’s


mobile number as well as the data for the message.

The following routine steps through the bytes of the


phone number array passing each byte onto the mo-
dem. There is then a similar routine which is used to
step through the bytes of the message until the end
terminating 0 is detected.

When all of the number and message data has been


passed to the modem the message is automatically
sent.

Copyright 2010 Matrix Multimedia Limited


Page 7

EB647-80-1
Example 2 E-Blocks Mobile
Comms Bundle
Exercise 2 is more advanced text message sending program which allows you to specify both
the mobile phone number and the text data using the keypad E-Block.

The Get_Phone_Number macro is used to collect a phone


number into a byte array using the keypad E-Block. This
array is exactly the same as shown in example 1 but this
time we are creating a routine to allow the array to be
populated rather then simply hard coding the array.

The code shown on the left scans the keypad for a


keypress and then checks to see if no keys are pressed
‘255’ or if the keypress is the same as the previous
keypress which means that the key is being held down.

If the key is not being held down and there is a valid press
then we check for the “*” or “#” keys being pressed. These
keys have the functionality of finishing or resetting the nu-
meric data entry process. Finally if none of the above are
true then we know that we have a single data byte which
can be added to the array.

Copyright 2010 Matrix Multimedia Limited


Page 8

EB647-80-1
Example 2 E-Blocks Mobile
Comms Bundle

When entering the data for the text message


content there has to be a way of entering
ASCII data. As the keypad only has numeric
buttons we have implemented a routine
similar to the routine used on a standard
mobile phone. That is to map the ASCII al-
phabet characters onto the numeric keys.
Multiple presses of a key in quick succes-
sion will act to step through the letters asso-
ciated with that key allowing you to enter
any amount of text you require. The letter
association used by the keypad E-Block is
shown on the image to the left. The number
0 can be used to insert a space into the
message. The number 1 is used to insert a
few standard non alphanumeric characters
into your message such as full stops and
commas. Again the star and hash keys are
used to restart or end the text entry process.

Once the phone number data buffer and the text message data buffer have been populated we
use the same method as shown in example 1 to forward the data to the GSM modem and in
turn send the message.

Before the message is sent you will be asked to confirm the mobile number and the data that
will be sent. This allows you to ensure that everything is correct before proceeding as we all
know that SMS messages are not free.

Pressing the ‘#’ key allows the program to move onto the next stage.

This program also shows the AT commands on the LCD E-Block as they are being fired out to
the GSM modem. This helps you to see how the data you have entered plug into the commands
that are then passed to the modem.

Copyright 2010 Matrix Multimedia Limited


Page 9

EB647-80-1
Example 3 E-Blocks Mobile
Comms Bundle
Exercise 3 allows the GSM modem to be used as a phone for voice messages. The phone
number to ring is hard coded into the Flowcode program to allow the device to be setup as say
an auto dial for emergency reasons. A good example of this functionality would be for use with a
fire or burglar alarm system that rings you when an alarm is triggered.

Again we are hard coding the phone number into a byte array.
You could replace this with the function shown in example 2
that allows you to manually enter a phone number using the
keypad.

In the program we wait for the ‘#’ key to be pressed on


the keypad. Once this has been detected we send the
commands to the GSM modem to initiate the phone
call.

Once the phone call has been established we go back


into a loop that again checks the keypad. This time the
phone is disconnected once the ‘#’ key is detected.

Copyright 2010 Matrix Multimedia Limited


Page 10

EB647-80-1
Example 3 E-Blocks Mobile
Comms Bundle

The phone call is established by using the ATD


command. This allows you to dial any number
specified in the phone number byte array.

The phone number must be terminated with a ;


and a 0 to allow the ATD functions to work cor-
rectly. The test message AT commands do not
need this. Therefore if you wanted to send text
messages and make phone calls in your pro-
gram then you would need to change the ATD
functionality to add the semi colon to the end of
the phone number.

The GSM Receive macros are scattered in the


function to ensure that any incoming data from
the modem is read before it fills the RS232
buffer and causes the UART to have an error.
An error on the RS232 bus will cause the trans-
missions to fail so we must check quite regularly
to ensure this does not happen.

The phone call is disconnected by calling the ATH command.


This command requires no additional parameters.

Please note that there are connectors included with the GSM modem that allow you to connect
a stereo headset with a microphone for use with voice communications. If you want to use audio
then you can use the headset included in the kit by plugging this directly into the GSM unit.

Copyright 2010 Matrix Multimedia Limited


Page 11

EB647-80-1
Troubleshooting E-Blocks Mobile
Comms Bundle

If you are having any problems getting up and running with any of the examples or any of
the Flowcode components then the first port of call is to ensure you have your boards
plugged together and wired correctly. As a rule of thumb any board with a screw terminal
and a +V marking should be connected via a single core wire to the +V screw terminal on
the corresponding Multiprogrammer.

If you do run into any problems then there is help and advice available from our online
user forums located here:

http://www.matrixmultimedia.com/mmforums/

The Articles section contains quite a few examples, as well as hints and tips to aid in your
applications

There is also an online video demonstrating Flowcode, available from the videos
section of our website: http://www.matrixmultimedia.com/lc_videos.php

Copyright 2010 Matrix Multimedia Limited


Page 12

EB647-80-1
Other Products E-Blocks Mobile
Comms Bundle
Matrix Multimedia is a leading global technology company. Over the years we
have developed a portfolio of award-winning products which have applications
in Education, Industry and in the home.

Learning is at the heart of much of what our company does, and the philosophy
of all Matrix learning products is based on ‘learning by doing’. Each year Matrix
spends around 25% of turnover on research and development to ensure that
our learning and development resources are world class.

MIAC PLC
MIAC (Matrix Industrial Automotive Controller) is an industrial grade control
unit which can be used to control a wide range of different electronic systems
including sensing, monitoring and automotive. It has a number of applications
in industry and learning.

Formula Flowcode
Formula Flowcode is a robot vehicle which is used to teach robotics, and to
provide a platform for competing in robotics events.

ECIO

ECIO devices are powerful USB programmable microcontrollers with either 28 or 40 pin
standard DIL (0.6”) footprints. They are perfect for student use at home, project work
and building fully integrated embedded systems.

FlowKit
The FlowKit allows for in circuit debugging directly from within Flowcode. This
is the same ICD debugging feature that is included with our version 7 EB006
Multiprogrammer boards.

Flowcode + E-Block Technology bundles

Matrix Multimedia technology bundles are based on a combination of two of our


most popular products, E-Blocks and Flowcode.

Other bundles in the range

• Easy Mobile Communications Pack • Easy GPS


• Easy Zigbee Pack • Easy USB
• Easy RFID • Build your own PC Interface
• Easy Internet • Build your own PLC
• Easy CAN Bus • Build your own Data-logger

Copyright 2010 Matrix Multimedia Limited

You might also like