Sonsivri

Electronics => General Electronics => Topic started by: arash on December 04, 2005, 09:00:57 21:00



Title: caller id "fsk"
Post by: arash on December 04, 2005, 09:00:57 21:00
Hi all.
I want to make a caller id but in fsk format.
I heard about XR2211 for decoding it.
Is that right?
How to use it.
thanks


Title: caller id "fsk"
Post by: tasosstr on December 05, 2005, 08:00:29 20:00
Hello ,

Have a look

http://www.melabs.com/resources/callerid.htm

http://www.melabs.com/products/labxt.htm

The datasheet for the ic is also there,

and look also the samples

Best Regards,
Tasosstr


Title: caller id "fsk"
Post by: max on December 05, 2005, 09:04:03 21:04
Hi,
Try the zarlink caller id chips MT8841 or MT8843, compact circuit and easier
to interface with uC, better performance than xr2211.


Title: caller id "fsk"
Post by: arash on December 05, 2005, 09:09:29 21:09
Hi max
is  MT8841 or MT8843 for fsk?


Title: caller id "fsk"
Post by: arash on December 05, 2005, 09:11:56 21:11
Hi tasosstr
Where can i finde the schematic?


Title: caller id "fsk"
Post by: max on December 05, 2005, 09:41:17 21:41
Hi,
Both zarlink chips are for fsk decoding, also you do'nt need a serial
port to retrieve the data, simple spi interface.


Title: caller id "fsk"
Post by: tasosstr on December 10, 2005, 10:04:57 10:04
Hi arash

The pdf file with sch is on :

http://www.melabs.com/downloads/LABXTSCH.PDF (http://www.melabs.com/downloads/LABXTSCH.PDF)

and some samples ...

' PicBasic Pro 2.42 or later, LAB-XT Experimenter Board, PIC16F877-20

' Displays Caller ID information on LCD.  Connect either jack on the
' LAB-XT to a telephone line.  Caller ID service must be provided
' by your local phone company.  This code only reads Multiple Data
' Message Format.  LED4 lights when ring is present.


DEFINE    LOADER_USED    1        ' Only required for melabs Loader

DEFINE OSC 20                ' Match the crystal on the board

' Define LCD registers and bits
DEFINE  LCD_DREG        PORTD
DEFINE  LCD_DBIT        4
DEFINE  LCD_RSREG       PORTE
DEFINE  LCD_RSBIT       0
DEFINE  LCD_EREG        PORTE
DEFINE  LCD_EBIT        1

ring_detect        VAR    PORTA.2    ' Define the ring-detect input pin
cid_serial_data    VAR    PORTA.0    ' Define the Caller-ID serial input pin
led4            VAR    PORTC.1    ' Define LED output

idstring    VAR    BYTE[96]    ' Array variable for recording the CID data
h            VAR BYTE        ' Variable for loop count and timing
i            VAR    BYTE        ' Variable for loop count
length        VAR    BYTE        ' Variable stores the length of CID data string

ADCON1 = 7                  ' Set PORTA and PORTE to digital
Pause 200                   ' Wait for LCD to start up

LCDOut $fe,1, "Caller ID for LAB-XT"    ' Vanity display

loop:
    IF ring_detect = 1 Then loop    ' Wait here until ring detected
   
    High led4                        ' Light LED to indicate incoming ring

time_after:    
    IF ring_detect = 0 Then i = 0    ' Clear timer variable if still ringing
    i = i + 1                        ' Increment timer variable
    Pause 1                            ' Pause 1mS
    IF i < 250 Then time_after        ' Loop here until 250mS after ring stops
   
    Low led4                        ' Ring finished, kill LED

    ' Look for CID data, abort if no data for 500mS
    SerIn2 cid_serial_data, 813, 500, loop, [wait($80),length,STR idstring\length]


    LCDOut $fe,1                    ' Clear the display
   
    For i = 0 TO length                ' Begin loop, each count represents a character
                                    ' in the recorded CID data string.

        Select Case idstring        ' For each character, check for known parameter types
       
            Case $01                ' Parameter type 01 (hex) is date and time.
                i = i + 1            ' Move index pointer to parameter length character.
                                    ' This avoids the length character being mistaken for
                                    ' a parameter-type code.

                LCDOut $fe,$80,idstring[i+1],idstring[i+2],_    ' Display date and time
                $FE,$C0, idstring[i+3],idstring[i+4], " ",_
                $FE,$83, idstring[i+5],idstring[i+6],":",_
                idstring[i+7],idstring[i+8]
               
            Case $02, $04            ' Parameter type 02 is the phone number.
                                    ' Parameter type 04 is the reason, if there is no number
                LCDOut $FE,$89        ' Move the LCD cursor to position 9 on line 1
                GoSub disp_string    ' Display the number string

            Case $07, $08            ' Parameter type 07 is the caller's name.
                                    ' Parameter type 08 is the reason, if there is no name
                LCDOut $FE,$C3        ' Move the LCD cursor to position 4, line 2
                GoSub disp_string    ' Display the name string
           
        End Select

    Next i                            ' Loop to the next character in the array
   
GoTo loop                            ' Return and wait for next ring
   
' Subroutine to display text string. This routine is called when a variable length CID parameter
' type is read from the array. The number of characters to display is stored in the next array
' location after the parameter type.

disp_string:                    

    i = i + 1                        ' Move the index pointer to the parameter-length byte

    IF idstring=1 Then            ' If the parameter is only 1 character long, then display a reason

        IF idstring[i+1] = "O" Then LCDOut "Out Of Area"    ' "O" is Out Of Area
        IF idstring[i+1] = "P" Then LCDOut "Blocked"        ' "P" is Private Caller

    Else                            ' If the parameter is longer than 1 character

        For h = 1 TO idstring    ' Loop from 1 to the length of the parameter
            LCDOut idstring[i+h]    ' Display each character in the parameter
        Next h                        ' Do it for the next character

    EndIF



.....


Title: caller id "fsk"
Post by: tasosstr on December 10, 2005, 10:20:30 10:20
------------------------------------------
  Another one
  ------------------------------------------
 
 
  ' PicBasic Pro 2.42 or later, LAB-XT Experimenter Board, PIC16F877-20
 
  ' Demonstrates remote control using DTMF over a phone line.  The
  ' LAB-XT will answer an incoming call on the third ring and sound
  ' a short tone to the caller.  The caller can then control 2 leds
  ' by pressing keys on his telephone.
 
  ' Press 1 for LED4 ON
  ' Press 2 for LED3 ON
  ' Press 4 for LED4 OFF
  ' Press 5 for LED3 OFF
  ' Press 0 to disconnect
 
 
  DEFINE    LOADER_USED    1        ' Only required for melabs Loader
  DEFINE OSC 20                ' 20MHz crystal on the LAB-XT
 
  ' Define LCD registers and bits
  DEFINE  LCD_DREG        PORTD
  DEFINE  LCD_DBIT        4
  DEFINE  LCD_RSREG       PORTE
  DEFINE  LCD_RSBIT       0
  DEFINE  LCD_EREG        PORTE
  DEFINE  LCD_EBIT        1
 
  seize            VAR PORTD.1    ' Alias the line seize control pin
  loop_current    VAR PORTA.3    ' alias the loop current detect input pin
  ring_detect        VAR    PORTA.2    ' Alias the ring-detect input pin
  dtmf_ready        VAR    PORTA.4    ' Alias the dtmf data-ready pin
  select_dtmf        VAR PORTD.3    ' Alias the dtmf enable pin
  DTMF_out        VAR PORTE.2    ' Alias pin for remote user prompts
  led3            VAR PORTC.0    ' Alias pin for LED3
  led4            VAR PORTC.1    ' Alias pin for LED4
 
 
  TRISD = 0        ' Set PORTD to output
  PORTD = 0        ' Initialize PORTD, all zero
  ADCON1 = 7      ' Set PORTA and PORTE to digital
  Pause 200       ' Wait for LCD to start up
  LCDOut $fe,1    ' Clear display
 
 
 
  i            VAR    WORD        ' Variable for loop count
  rings        VAR    BYTE        ' Stores number of rings
  dtmf_digit    VAR BYTE        ' Stores dtmf received digit
 
 
  initialize:
      LCDOut $fe,1, "Waiting for call"    ' Display user prompt
      Low seize                ' Release the line
      rings = 0                ' Reset ring count to 0
      i = 0
      Low led3                ' Shut off LED3
      Low led4                ' Shut off LED4
     
 
  loop:
      Pause 1                    ' Pause 1mS
      i = i + 1                ' Increment counter
      IF i > 5000 Then initialize        ' If 5 seconds have elapsed without ring, re-initialize
      IF ring_detect Then loop        ' Loop here until ring detected
     
     
 
  ringing:    
      IF ring_detect = 0 Then i = 0    ' Clear timer variable if still ringing
      i = i + 1                        ' Increment timer variable
      Pause 1                            ' Pause 1mS
      IF i < 250 Then ringing            ' Return to loop until 250mS after ring stops
     
      rings = rings + 1                ' Increment ring counter
      LCDOut $fe,1, DEC rings," rings detected"    ' Display user prompt
 
      IF rings < 3 Then loop            ' If less than 3 rings, wait for more
     
      seize = 1                        ' If ring 5, answer the call
      Pause 250                        ' Wait 250mS for the line to settle
     
      FreqOut DTMF_out, 500, 800        ' Play a short tone to prompt the caller
      LCDOut $fe,1, "Waiting for DTMF"    ' Display user prompt
     
     
  listen:
      IF (seize = 1) AND (loop_current = 1) Then initialize    ' Re-initialize if the call is dropped remotely
     
      IF dtmf_ready = 0 Then listen    ' Check for DTMF present, if none loop again
 
      ' If DTMF present, continue
 
      select_dtmf = 1            ' Enable the data output from the MT8870
      Pause 1                    ' Pause 1 mS to let data settle
      dtmf_digit = (PORTB >> 4)    ' Read the top nibble of PORTB for DTMF data
 
      ' Use LOOKUP to change the DTMF data to an ASCII character
      LookUp dtmf_digit, ["_1234567890*#ABCD"], dtmf_digit
 
  dtmf_wait:                    
      IF dtmf_ready Then dtmf_wait    ' Loop here until DTMF signal stops
      select_dtmf = 0            ' Disable the MT8870 data output
 
      Select Case dtmf_digit    ' Take action based on the dtmf digit
     
          Case "1"            ' DTMF "1" lights LED3
              High led3
             
          Case "2"            ' DTMF "2" lights LED4
              High led4
             
          Case "4"            ' DTMF "4" kills LED3
              Low led3
             
          Case "5"            ' DTMF "5" kills LED4
              Low led4
             
          Case "0"            ' DTMF "0" hangs up and re-initializes
              GoTo initialize
                         
      End Select
     
  GoTo listen                ' Listen for next DTMF digit
         
     
     
 
 
  ------------------------------------------------
  Another one
  ------------------------------------------------
 
 
 
  ' PicBasic Pro 2.42 or later, LAB-XT Experimenter Board, PIC16F877-20
 
  ' Telemarketing stopper.  Reads caller id and plays Special Information Tones (SIT)
  ' when CID information has been blocked.
 
 
  DEFINE    LOADER_USED    1            ' Only required for melabs Loader
  DEFINE OSC 20                    ' Define for 20MHz crystal on LAB-XT
 
  led4            VAR PORTC.1        ' LED4 output pin
  sieze            VAR    PORTD.1        ' Relay control pin (sieze line)
  loop_current    VAR PORTA.3        ' Loop current present (active low)
  ring_detect        VAR    PORTA.2        ' Ring detect pin (active low, square wave)
  dtmf_out        VAR    PORTE.2        ' DTMF signal output pin
  cid_serial_data    VAR    PORTA.0        ' Caller ID data from FSK chip
 
 
  ADCON1 = 7      ' Set PORTA and PORTE to digital
  TRISD = 0        ' Set PORTD to output
  PORTD = 0        ' Initialize PORTD, all low
 
  ' Define program variables
  j        VAR        BYTE            ' Loop counter, misc
  ring_freq    VAR    WORD            ' Frequency of ring signal (speaker PWM)
  cid_code    VAR BYTE            ' Stores reason code from CID string
 
  initialize:
     
      sieze = 0                    ' Deactivate the line-sieze relay (Hang Up)
      Pause 250                    ' Wait 250mS for things to settle
 
  loop:
 
      ' If Off Hook and the loop_current drops, the caller has hung up. Drop the line
      IF (sieze = 1) AND (loop_current = 1) Then initialize    
 
     
      IF (ring_detect = 0) Then    ' Check for ring-detect (incoming call, active low)
          j = 0                    ' Clear j variable (time elapsed since last ring-detect)
  ring_cycle:
          High led4                ' Light LED to indicate incoming call
          Pause 1                    ' Pause 1mS so we can time this loop
          j = j + 1                ' Each count of j represents 1mS of time
          IF (j > 60) Then stop_ringing        ' If no ring_detect for 60mS, ring has ended
          IF ring_detect = 1 Then ring_cycle    ' Stay in this loop until ring_detect
          Pause 30                ' Pause 30mS. (Low period of ring-detect)        
          j = 30                    ' Set j to 30 (30mS)
          GoTo ring_cycle            ' Loop to keep monitoring the ring-detect
  stop_ringing:                    ' Jump here at end of ring or to answer call
 
          Low led4                ' Shut off the LED
          Pause 250                ' Wait 250mS for line to settle
 
          ' Look for CID data, abort if no data for 500mS
          SerIn2 cid_serial_data, 813, 500, loop,    [wait($80),wait($04,$01), cid_code]
          IF cid_code = "P" Then block_call    ' Check for "Private" code
      EndIF    
         
  GoTo loop               ' Repeat main loop
 
 
  block_call:                        ' Jumps here if turned on and the caller id is blocked
      sieze = 1                    ' Sieze line (Off Hook)
      Pause 500                    ' Wait 500mS to establish loop current
      FreqOut dtmf_out,330,950    ' Send 950Hz tone for 330mS
      Pause 25                    ' 25mS of silence
      FreqOut dtmf_out,330,1400    ' Send 1400Hz tone for 330mS
      Pause 25                    ' 25mS of silence
      FreqOut dtmf_out,330,1800    ' Send 1800Hz tone for 330mS
      Pause 1000                    ' 1 second of silence
  GoTo loop                        ' Back to main loop
 
 
  Other samples (and that sample for  caller id) you can find on :
 
  http://www.melabs.com/resources/samples.htm#xtpbp (http://www.melabs.com/resources/samples.htm#xtpbp)
 
  I hope to help ...
 
  Best Regards,
  Tasosstr