Sie sind auf Seite 1von 8

A REVOLUTIONARY WAY TO PROGRAM

MICROCONTROLLER CHIPS
Phone PIC Is the latest and possibly one of the simplest ways of
programming PICs. This pioneering system uses any mobile phone for
programming. It consists of a small programmer circuit board with a
microphone. To programme you simply hold a mobile phone earpiece
near the microphone and enter your programme using the dial-up
keypad. The Phone PIC responds to the acoustic tones (DTMF tones)
generated by each key and translates these into program instructions.
It is even possible to program a PIC at any distance by phoning a third
party who then holds the Phone PIC near their own mobile!
This system represents a sensible low cost
alternative investment in PIC programming
and will provide a robust and exciting
new approach to the technology
and will stimulate and
generate a lot of
interest in pupils
and students.

It’s as easy
as texting and
almost as fast!
PHONE PIC PROGRAMMER -
CONCISE INSTRUCTIONS
Phone PIC communicates with any ‘Old’ mobile phone that incorporates DTMF keypad tones.
These options are usually available from the (options / settings) menus. Once activated
students will be able to simply use the alpha numeric keypad codes in producing audible
tones directly to the Microcontroller without the need for wires cables and complicated
computer interface leads.
Phone PIC communicates with a circuit via a simple microphone.
The PIC Microcontroller incorporates a pre-programmed header program
that can decode the DTMF tones directly into chips memory in ‘real time’.
Once the student has finished imputing the control codes, the chip is
immediately ready for inserting into numerous PIC project boards.
It’s as easy as texting - and almost as fast!
The Phone PIC programmer is capable of programming
three common 18 pin Microcontroller chips:


16F627 16F84 16F84A PIC Project Boards

Please note! When used with Phone PIC these PIC's must be pre-programmed. When you get
these PIC's from teaching resources they will be supplied pre programmed at no extra cost.
For those of you who have the capability to program your own supply of PIC chips, please
download the appropriate hex files / PIC header files from:
www.tep.org.uk/phonepic/hex-files.htm

SETTING UP THE PHONE PIC CIRCUIT


FOR PROGRAMMING
How to initialise the Phone PIC circuit: ‹ Battery Pack
Phone PIC Circuit
Phone PIC

Microphone

PIC (16F84A type shown)

Connect the battery to the Phone PIC circuit first. Insert the PIC
to be programmed into the ZIF Socket ensuring Pin in 1 is top left.

As soon as the lever locates the chip, two beeps BEEP!BEEP!


will be followed by the lighting of an LED. This
will confirm the correct initialisation of the
PIC and its verification that the chip contains
the necessary header file.

«2»

GENERATING DTMF TONES
USING YOUR MOBILE PHONE
For more information on DTMF tones, see appendix (a)

Generally, most mobile phones will allow you to change the


sounds being emitted from your keypad touch tone buttons


Select DTMF Tones
from either silent mode or to DTMF mode. You will need to
navigate through your phone menus to ‘phone settings’ or
‘sound settings’ menu. There you should find an option to
change the Keypad Tone. Please select Tone in the option
settings. Do not select beep as this will produce the same
sound frequency with each keypad pressed. Once selected
adjust your phone volume to enable a clear tone output
through its internal speaker.


Adjust the volume

We are now ready to test the Phone PIC circuit with your
Mobile Phone. Place the microphone as near to the
phone output speaker as possible.
You will need the TEP code sheet to enable commands
to be sent to the microcontroller chip.
When entering your program, the line number
automatically starts at 0 and increments automatically
by 1 each line (i.e. There is no need to enter it).

The table below lists all of the programs abbreviated line functions:
Phone Keypad: Followed by:

HI Enter 44 on the phone keypad followed by an LED output 0–7


pin number from 0 to 7.

LO Enter 56 followed by an output pin number from 0 to 7. 0–7

WAIT Enter 92 followed by a three digit number from 000 to 255. 000 – 255

BEEP Enter 23

GOTO Enter 46 followed by a two digit number from 00 to 99. 00 – 99

IF Enter 43 followed by an input pin number from 0 to 3 0 – 3 or


variable i or j
or a variable name i or j (4 or 5). (4 or 5)

END Enter 36. All programs must finish with an END.

LET Enter 53 followed by a variable name i or j (4 or 5). Variable i or j


(4 or 5)
The variable name can then be followed by one of
three operations

«3»
INTRODUCTION TO THE MAIN COMMANDS
high = (HI) This command switches an output high.

low = (LO) This command switches an output low

goto - This command causes program flow to ‘jump’ to a new line.

wait - This command creates a pause, in units of 0.1 seconds.


Therefore the command wait 010 generates a pause 1 second long.

INTRODUCTION TO THE ‘IF’ STATEMENTS


An if statement involves a ‘condition’ that must be true for the main command within the
statement to be completed. There are different types of if condition:
if statements involving the digital inputs. For example:

if input 0 is on then ... if 0 on (on = high)

if input 1 is off then ... if 1 off (off = low)

IF Enter 43 followed by an input pin number from 0 to 3


or a variable name i or j (4 or 5).

If a pin number was entered it can be followed by a 0 or 1 to test its state.

c.f. IF pin 2 = 1 then ...

If a variable was entered then the next key press represents:

is equal to 3(e)
is greater than 4(g)
is less than 5(l)
is not equal to 6(n)

This can then be followed by a three digit number from 000 to 255
or a variable name i or j (4 or 5).

After you finish entering the IF statement you can enter any one of the other commands
which will be executed conditionally. You will not hear a double beep until the conditional
command has been entered successfully.

«4»
USING LET STATEMENTS WITH VARIABLES
Let statements are used to set the variables x and y with specific values. The special let
‘main’ commands ‘plus’ (addition) and ‘take’ (subtraction) also allow for simple
mathematics with the variable values. For example:

LET Enter 53 followed by a variable name i or j (4 or 5).


The variable name can then be followed by one of three operations:

= 3(e)
+= 7(p)
–= 6(m)

A three digit number from 000 to 255 or i or j (4 or 5) can then be entered to set or modify
the variable.

What does –= and += (minus equals & plus equal) mean?


let i += 5 is a shorthand way of writing: let i = i + 5.

i.e.
let i+=5 increase the value of i by 5.
Similarly, let i–=5 would decrease the value of i by 5.

END Enter 36. All programs must finish with an END.

«5»
Now let’s try out a test program to test the system. After each key press you should hear a
single short beep to signify the programmer has received the input. After entering each
command successfully you should hear a double beep. If there was an error you will hear a
low pitched beep. After hearing a low pitched beep no change has been made to the program
and you can start entering the command again. You must always finish your program an
END command 36.

The chart below uses the TEP Chipfactory commands to show how similar the Phone PIC
codes are to the basic Chipfactory commands.

Chipfactory basic 00 High 1


Phone code 44 1 LED number 1 On
Chipfactory basic 01 Wait 010
Phone code 92 010 Wait 1 second
Chipfactory basic 02 Low 1
Phone code 56 1 LED number 1 Off
Chipfactory basic 03 Wait 010
Phone code 92 010 Wait 1 second
Chipfactory basic 04 Beep 200 Frequency
Phone code 23 Beep once
Chipfactory basic 05 GOTO 00
Phone code 46 00 Goto line 00 of program and start again
Chipfactory basic END
Phone code 36 End of program

The example above simply lights up an LED for one second then it goes off for one second
followed by a beep at the end of the program. Line 05 instructs the program to restart from
the beginning line 00.

Now let’s try out a program that uses the If and Let statements. This program monitors the
number of times you have pressed switch 1. The program waits for you to press the switch
on 10 times. On the 11th input it switches on an LED.

Chipfactory basic 00 let i = 000


Phone code 53 4 3 000
Chipfactory basic 01 If pin 1 low Goto
Phone code 43 1 0 46 01
Chipfactory basic 02 beep
Phone code 23
Chipfactory basic 03 let i += 001
Phone code 53 4 7 001
Chipfactory basic 04 if i > 010 hi Pin 4
Phone code 43 4 4 010 44 4
Chipfactory basic 05 if pin 1 is hi Goto 05
Phone code 43 1 1 46 05
Chipfactory basic 06 Goto 01
Phone code 46 01
Phone code 36 End

«6»
APPENDIX (A)
What are DTMF tones?
DTMF tones are the tones used in telephones for tone dialling.
Dual-tone-multi-frequency DTMF, also known as touch-tone. The DTMF tones are
sums of two sine wave tones at following frequencies:

1209 Hz 1336 Hz 1477 Hz 1633 Hz

ABC DEF
697 Hz 1 2 3 A

GHI JKL MNO


770 Hz 4 5 6 B

PRS TUV WXY


852 Hz 7 8 9 C

oper
941 Hz * 0 # D

TEP PIC PROJECT BOARDS


There are various project boards and tutor boards available from TEP and Teaching
Resources ready to receive the Phone PIC programmed chips.

Standard Project Board


High Power Project Board


Chips programmed using the Phone


PIC can easily be integrated into
Robot or Buggy projects for teaching

about key control principles,


Basic Project Board “smart” vehicles etc.


Demo Board

«7»
LOG ON TO TEP
A visit to the TEP website is well worthwhile and should be set as your favourite
bookmark! Take the trouble to log on to the TEP website at www.tep.org.uk and catch
up with the latest features and support material. The site provides ready access to :

» On-line browsing of the Teaching Resources catalogue:


Go to www.tep.org.uk and click on Products to browse the complete catalogue
of resources including all the products featured in this leaflet.
» New Downloadable circuits for Control and Electronics projects
» Links to other sites
» CADCAM ideas and resources with a Pro/DESKTOP focus
» Details on How to join TEP
» Updated Training Portfolio and INSET update


» Latest news and ideas from TEP schools
» and much, much more!

Technology Enhancement Programme Further TEP CD-ROM resources available from:


Warwick Manufacturing Group
International Manufacturing Centre Teaching Resources
University of Warwick Unit 10, IO Centre
Coventry CV4 7AL Waltham Cross
Herts, EN9 1AS
Telephone: 024 7657 3994
Facsimile: 024 7657 3975 Tel: 01992 716052 www.mutr.co.uk
Website: www.tep.org.uk Fax: 01992 719474

OUR MISSION:
TO ENHANCE AND ENRICH
TECHNOLOGY EDUCATION AND TRAINING

TEP is a programme of the Gatsby Technical Education Project, a registered charity No. 1060744.

Das könnte Ihnen auch gefallen