Talking Electronics PIC Theory
 

Buy a kit

TAXI PHONE
Page 2


Mouseover to stop

 

MODIFYING THE PROGRAM
The program can be developed in an F84 chip using an 8-Pin to 18-Pin adapter as shown below. The set-up instructions we have used in the program apply equally to the '508A and F84. The only difference is you must assemble the program in MPASM for the F84 during experimenting and when you are ready to put it into a '508A, the program must be assembled for a PIC12c508A. This will produce two completely different .hex files.


There are a number of areas where the program can be modified to suit different requirements. The first is the dialling speed. The program sends out the DTMF tones at approx 5 tones per second. Many phone lines will accept this rate (and higher rates) but if you are experiencing problems with your carrier, the rate of transmission can be reduced. The tones can be produced for a longer period of time (at DTMF1 the number of loops can be increased to 0F0h) and the delay between tones can be increased (at Dial2, add another one or two CALL Del1 instructions). 
The delay before beginning to send the tones can be increased, depending on how long it takes for your phone system to pick up a line. Don't increase it too much as surprise is the essence of this alarm. 
If you have a number of these alarms at different locations, the Hee Haw sound can be altered for each location. Or the program can be altered to deliver a 4 digit code and a receiver at a central location can identify the particular alarm. 

CONNECTING THE PROJECT TO A PHONE LINE
The requirements for connection to a Public Telephone system vary from country to country and you must find out the full details for your own country. This project must not be connected without an authorisation number. To get an authorisation number, the design has to go through approval stages and this could cost $2,000 - $5,000 or more. Compliance is extremely strict, with the requirement that every component has to be "authorised for connection to the line" and at least 5,000v isolation between components and user.
After approval has been granted, the authorisation number has to attached to the product.
The only way to work on this project is to get an "experimental licence" and place the project behind a "telephone line isolating device." These are available from Altronic Imports in Perth, WA. in Australia.
When we refer to "connecting to the line" in this project, we mean connecting to an experimental line made up of 27v from 9v batteries, a 1k relay in series with one line and terminating with a 4-pin modular telephone plug for connection into the project, as shown below.  A switch on the project allows it to be turned off (bypass mode). Use the ON mode for testing. 

BEFORE BURNING A CHIP
Before burning a chip, Table1 must be increased to at least 100 RETLW 0FFh to allow for reprogramming of phone numbers. For example, a 10 digit number, with RETLW 0E, takes 11 RETLW 0FFh's.
Next, insert the digits of the phone number you wish to call. End with RETLW 0E.
The RETLW values for the digits co-relate exactly except for 0 = 0A as 0 represents ten pulses and ten in hex is 0A!  Note: there is no: RETLW 00h!!

1 = RETLW 01h
2 = RETLW 02h
3 = RETLW 03h
4 = RETLW 04h
5 = RETLW 05h
6 = RETLW 06h
7 = RETLW 07h
8 = RETLW 08h
9 = RETLW 09h
0 = RETLW 0Ah
E = RETLW 0Eh - End of phone number


Do not code-protect the chip as the phone number must be able to be removed when re-burning. This is done by burning down the old digits to 00 00h and the next RETLW 0FFh locations are converted to RETLW 01h etc, for dialing.
When burning a PIC12C508A, in the Fuse Edit section of the PIP-02 programmer, place a dot (o) beside XT and a cross (X) beside Watchdog Timer On.  The MCLR  feature is internal and cannot be altered.     Make sure CP: OFF      The ID and CSum is not important.

           ;TAXI PHONE for 12c508A CHIP
               Note: This program does not dial a recognised telephone number.
               Insert the phone number to be dialled at Table1.

                       ;'508A Files used in this program
          ;07h 
          ;08h 
          ;09h
          ;0Ah 
          ;0Bh 
          ;0Ch 
          ;0Dh 
          ;0Eh loop file
          ;0Fh 
          ;10h jump file for tables
          ;11h 
          ;12h Count file
          ;13h Carrier DTMF 
          ;14h Low tone 
          ;15h decrementable low tone
          ;16h High tone 
          ;17h decrementable high tone
          ;18h 
          ;19h 
          ;1Ah delay routines
          ;1Bh delay routines
          ;1Ch delay routines
          ;1Dh 
          ;1Eh
          ;1Fh 



 SetUp   MOVLW 08      ;Put 0000 1000 into W
             TRIS 06             ;Make GP3 input
             CLRF 06            ;Clear port 6 of junk 
             BSF 01h,0         ;Prescaler bit0
             BSF 01h,1         ;Prescaler bit1
             BSF 01h,2         ;Prescaler bit2 = WDT x 128
             BSF 01h,3         ;Prescaler assigned to WDT 

 StartUp    GOTO Main1


 ;Table 1 for storing phone number


 Table1   ADDWF 02,1      ;File 02 = Low bits of program counter
               RETLW 0Ah       ;0 
               RETLW 01h
               RETLW 01h 
               RETLW 02h 
               RETLW 03h
               RETLW 02h 
               RETLW 09h 
               RETLW 02h 
               RETLW 05h 
               RETLW 05h
               RETLW 0Eh         ;E = End of number

                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
 
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
 
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh
                RETLW 0FFh        ;etc etc etc ETC ETC 


                      ;Table2 DTMF Low tones 

 Table2  ADDWF 02,1      ;File 02 = low bits of program counter
              NOP
              RETLW 075h      ;1 
              RETLW 075h      ;2
              RETLW 075h      ;3
              RETLW 06Bh      ;4
              RETLW 06Bh      ;5
              RETLW 06Bh      ;6
              RETLW 060h      ;7
              RETLW 060h      ;8 
              RETLW 060h      ;9
              RETLW 057h      ;0


                    ;Table3 DTMF HIGH tones 

 Table3  ADDWF 02,1      ;File 02 = Low bits of program counter
              NOP
              RETLW 044h      ;1 
              RETLW 03Dh      ;2
              RETLW 037h      ;3
              RETLW 044h      ;4
              RETLW 03Dh      ;5
              RETLW 037h      ;6
              RETLW 044h      ;7
              RETLW 03Dh      ;8 
              RETLW 038h      ;9
              RETLW 03Dh      ;0

                        ;Short delay between tone approx 50mS

 Del1      CLRWDT
              MOVLW 50h         ;loops
              MOVWF 1B           ;
 Del1A   DECFSZ 1A,1        ;Will produce 256 decrements
              GOTO Del1A
              DECFSZ 1B,1        ;decrements file 1B
              GOTO Del1A
              RETLW 00


                ;0.7sec Delay 

 Del2      CLRWDT
              NOP                   ;NOP's to pad out the delay routine to 
              NOP                   ;create more than 655,000uS delay
              NOP                   ;(approx 0.7sec delay)
              NOP
              NOP
              NOP
              NOP
              DECFSZ 1A,1       ;After one pass, each file will be
              GOTO Del2           ;256 and will produce the longest
              DECFSZ 1B,1        ;delay-time.
              GOTO Del2
              RETLW 00


       ;Dial1 dials the DTMF phone number
       ;13h = carrier file
       ;14h = low tone
       ;15h = decrementable low tone
       ;16h = high tone
       ;17h = decrementable high tone


 Dial1     MOVF 10h,0           ;Put 10h into W
              CALL Table1
              MOVWF 13h          ;Put W into 13h - carrier
              MOVLW 0E            ;Look for E - end of number
              XORWF 13h,0        ;Is 13h = E?
              BTFSC 03,2
              GOTO Main4
              MOVF 13h,0            ;File 13h will be 1,2,3 ..0A
              CALL Table2           ;Get low-tone value
              MOVWF 14h            ;Put low-tone into 14h
              MOVWF 15h            ;Decrementable low-tone file
              MOVF 13h,0
              CALL Table3
              MOVWF 16h             ;Put high-tone into 16h
              MOVWF 17h             ;Decrementable high-tone file
              CALL DTMF1
 Dial2     CALL Del1                 ;Short delay before next
              CALL Del1                 ; digit
              INCF 10h,1
              GOTO Dial1

 DTMF1  MOVLW 0A0h            ; loops of tone 
              MOVWF 11h               ; to produce 1/10th sec
 DTMF2  DECFSZ 17h,1            ;Decrement high-tone file
              GOTO DTMF3
              MOVLW 01                  ;To toggle GP0 
              XORWF 06,1                ;Toggle GP0
              MOVF 16h,0                ;To re-load high-tone file
              MOVWF 17h                ;Re-load high-tone file
 DTMF3  DECFSZ 15h,1             ;Decrement low-tone file
              GOTO DTMF2
              MOVLW 02                  ;To toggle GP1
              XORWF 06,1                ;Toggle GP1
              MOVF 14h,0                 ;To re-load low-tone file
              MOVWF 15h                ;Re-load low-tone file
              DECFSZ 11h,1             ;Decrement loops file
              GOTO DTMF2 
              GOTO Dial2

                       ;Main

 Main1    CALL Del2              ;0.7sec delay
              CALL Del2               ;0.7sec delay 
              CLRF 10h                ;Jump value for Table1
 Main2    MOVF 10h,0            ;Look for NOPs in Table1
              CALL Table1            ; so chip can be re-burnt
              XORLW 00h
              BTFSS 03,2
              GOTO Main3
              INCF 10h,1
              GOTO Main2
 Main3   BTFSS 06,3              ;Is auto-dial Sw closed? = GP3=LOW
              GOTO Main4            ;Yes. Auto Sw closed = GP3 = LOW
 Sw       CALL Del2                ;No. Wait for Sw to be pressed 
              BTFSC 06,3              ;Is switch pressed?
              GOTO Sw                ;No. Loop here until Sw pressed
 Main4   GOTO Dial1               ;Yes.
 Main5   NOP                          ;Loop forever after dialing
              CLRWDT                  ;WDT will turn project on 
              GOTO Main5            ; when power is applied

              END

            


The program above has been laid out with spacing and is not suited for importing as a text file. To download the text file as Taxi-1.zip, click HERE. The .zip holds Taxi-ASM.asm and this is suitable for both the PICF84 and '508A.
 No .hex file has been provided as you must add your own phone number to the .asm file above and create your own .hex file. 

You will need the: Multi Chip Programmer - for burning  '508 chips
You will also need to download the programming program PIP-02.
You should also go to the section "Burning a Chip." This section explains how to load the PIC chip with a .hex file. 

TO RE-BURN A '508A CHIP
If you need to change the phone number, the old digits are turned into 00 00 (including the RETLW 0E command), and the new digits are placed after the 00 00's.
This can be done until all the RETLW 0FFh locations are used. That's why you need up to 100 RETLW 0FFh when you first burn the chip.

This concludes the Taxi Phone Project. To buy a kit, click  HERE .