TEP PhonePIC Manual

download TEP PhonePIC Manual

of 8

Transcript of TEP PhonePIC Manual

  • 8/8/2019 TEP PhonePIC Manual

    1/8

    A REVOLUTIONARY WAY TO PROGRAM

    MICROCONTROLLER CHIPS

    Its as easyas texting and

    almost as fast!

    Phone PIC Is the latest and possibly one of the simplest ways ofprogramming PICs. This pioneering system uses any mobile phone for

    programming. It consists of a small programmer circuit board with amicrophone. To programme you simply hold a mobile phone earpiecenear the microphone and enter your programme using the dial-upkeypad. 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 thirdparty who then holds the Phone PIC near their own mobile!

    This system represents a sensible low costalternative investment in PIC programming

    and will provide a robust and excitingnew approach to the technologyand will stimulate andgenerate a lot ofinterest in pupilsand students.

  • 8/8/2019 TEP PhonePIC Manual

    2/8

    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 audibletones directly to the Microcontroller without the need for wires cables and complicatedcomputer interface leads.

    Phone PIC communicates with a circuit via a simple microphone.The PIC Microcontroller incorporates a pre-programmed header programthat 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.Its 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

    Please note! When used with Phone PIC these PIC's must be pre-programmed. When you getthese 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, pleasedownload 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:

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

    As soon as the lever locates the chip, two beepswill be followed by the lighting of an LED. Thiswill confirm the correct initialisation of thePIC and its verification that the chip containsthe necessary header file.

    Battery Pack

    PIC (16F84A type shown)

    Phone PICMicrophone

    Phone PIC Circuit

    BEEP!BEEP!

    PIC Project Boards

    2

  • 8/8/2019 TEP PhonePIC Manual

    3/8

    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 thesounds being emitted from your keypad touch tone buttonsfrom either silent mode or to DTMF mode. You will need tonavigate through your phone menus to phone settings orsound settings menu. There you should find an option tochange the Keypad Tone. Please select Tone in the optionsettings. Do not select beep as this will produce the samesound frequency with each keypad pressed. Once selected

    adjust your phonevolume to enable a clear tone outputthrough its internal speaker.

    We are now ready to test the Phone PIC circuit with yourMobile Phone. Place the microphone as near to thephone output speaker as possible.

    You will need the TEP code sheet to enable commandsto be sent to the microcontroller chip.

    When entering your program, the line numberautomatically starts at 0 and increments automaticallyby 1 each line (i.e. There is no need to enter it).

    The table below lists all of the programs abbreviated line functions:

    HI Enter 44 on the phone keypad followed by an LED outputpin number from 0 to 7.

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

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

    BEEP Enter 23

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

    IF Enter 43 followed by an input pin number from 0 to 3or a variable name i orj (4 or 5).

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

    LET Enter 53 followed by a variable name i orj (4 or 5).The variable name can then be followed by one ofthree operations

    Adjust the volume

    Select DTMF Tones

    0 7

    Phone Keypad: Followed by:

    0 7

    000 255

    00 99

    0 3 orvariable i orj(4 or 5)

    Variable i orj(4 or 5)

    3

  • 8/8/2019 TEP PhonePIC Manual

    4/8

    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 ifstatement involves a condition that must be true for the main command within thestatement to be completed. There are different types ofifcondition:ifstatements 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 3or 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 255or a variable name i orj (4 or 5).

    After you finish entering the IF statement you can enter any one of the other commandswhich will be executed conditionally. You will not hear a double beep until the conditional

    command has been entered successfully.

    4

  • 8/8/2019 TEP PhonePIC Manual

    5/8

    USING LET STATEMENTS WITH VARIABLES

    Let statements are used to set the variables x and y with specific values. The special letmain commands plus (addition) and take (subtraction) also allow for simplemathematics 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 modifythe 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 ofi by 5.Similarly, let i=5 would decrease the value ofi by 5.

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

    5

  • 8/8/2019 TEP PhonePIC Manual

    6/8

    Now lets try out a test program to test the system. After each key press you should hear asingle short beep to signify the programmer has received the input. After entering eachcommand successfully you should hear a double beep. If there was an error you will hear alow pitched beep. After hearing a low pitched beep no change has been made to the programand 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 PICcodes are to the basic Chipfactory commands.

    Chipfactory basic 00 High 1Phone code 44 1 LED number 1 OnChipfactory basic 01 Wait 010

    Phone code 92 010 Wait 1 secondChipfactory basic 02 Low 1Phone code 56 1 LED number 1 OffChipfactory basic 03 Wait 010Phone code 92 010 Wait 1 secondChipfactory basic 04 Beep 200 FrequencyPhone code 23 Beep onceChipfactory basic 05 GOTO 00

    Phone code 46 00 Goto line 00 of program and start againChipfactory basic ENDPhone code 36 End of program

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

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

    Chipfactory basic 00 let i = 000Phone code 53 4 3 000Chipfactory basic 01 If pin 1 low Goto

    Phone code 43 1 0 46 01Chipfactory basic 02 beepPhone code 23Chipfactory basic 03 let i += 001Phone code 53 4 7 001Chipfactory basic 04 if i > 010 hi Pin 4Phone code 43 4 4 010 44 4Chipfactory basic 05 if pin 1 is hi Goto 05

    Phone code 43 1 1 46 05Chipfactory basic 06 Goto 01Phone code 46 01Phone code 36 End

    6

  • 8/8/2019 TEP PhonePIC Manual

    7/8

    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 DEF697 Hz 1 2 3 A

    GHI JKL MNO770 Hz 4 5 6 B

    PRS TUV WXY852 Hz 7 8 9 C

    oper941 Hz * 0 # D

    TEP PIC PROJECT BOARDSThere are various project boards and tutor boards available from TEP and TeachingResources ready to receive the Phone PIC programmed chips.

    High Power Project Board

    Standard Project Board

    Basic Project Board

    Chips programmed using the PhonePIC can easily be integrated into

    Robot or Buggy projects for teachingabout key control principles,

    smart vehicles etc.

    Demo Board

    7

  • 8/8/2019 TEP PhonePIC Manual

    8/8

    LOG ON TO TEPA visit to the TEP website is well worthwhile and should be set as your favouritebookmark! 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 catalogueof 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 ProgrammeWarwick Manufacturing GroupInternational Manufacturing Centre

    University of WarwickCoventry CV4 7AL

    Telephone: 024 7657 3994Facsimile: 024 7657 3975Website: www.tep.org.uk

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

    OUR MISSION:

    TO ENHANCE AND ENRICHTECHNOLOGY EDUCATION AND TRAINING

    Further TEP CD-ROM resources available from:

    Teaching Resources

    Unit 10, IO CentreWaltham CrossHerts, EN9 1AS

    Tel: 01992 716052 www.mutr.co.ukFax: 01992 719474