DTMF and PIC for Remote Control


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    It doesn't work because you're using a logical operator instead of the bitwise operator.

    pincode1 = (PORTB & $0F) would return the right value.

    Logical operators can only return true or false.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Sep 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default DTMF decoder using 16F628A

    I have new coding problem, using TMR0 I do not understand........put simply
    Code:
    loop1:
      if intcon.2 = 0 then loop1  
      intcon.2 = 0
      clicks=clicks+1
      if clicks >=1900 then
      clicks=0
      high pin11:pause 100:low pin11  'Flash LED for 10th of second
      secs=secs+1
      endif
      if secs>=5 then 
      high pin10:pause 100:low pin10
      gosub nowt
      secs=0 'Reset secs
      endif
      goto loop1  
      end
      nowt: 
      return
    
    But fails if 
                  gosub nowt
                  endif
                  goto loop1  
                  end
                  nowt: 
                  secs=0 'Reset secs
                  return
    The inclusion of any code in the sub-routine at nowt: causes whole to fail?
    Last edited by ScaleRobotics; - 21st July 2010 at 17:42. Reason: added code tags

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Can you post the whole code, using code tags, so we can see how everything is setup? TMRO is "normally" set to trigger an interrupt handler so I am not sure what you are doing with what I see posted.

    Might just be running out of time???
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default DTMF decoder

    Hello....All of the code is shown below......
    Code:
    '****************************************************************
    '*  Name    : TIMER01.INC                                          *
    '*  Author  : Michael Denton                                        *
    '*  Notice  :                                    *
    '*  Date    : 27/03/2010                                                *
    '*  Version : 1.0                                                          *
    '*  Notes   :                                                                *
    '****************************************************************
    cmcon = %00000111 'Make portA all digital I/O otherwise ADC
    intcon = %10110000 'R/W Reg Bit2 is T0IF TMRO overflow bit
                       'must be reset in software
    option_reg = %10010000 'prescaler for TMR0 set at 1:1
    vrcon = %00000000 'Turn off reference voltage
    eecon1 = %00001111 'EEPROM data register
    
    '=======================================================
    PIN6  VAR PORTB.0   ' Rename all port names with physical PIN number
    PIN7  VAR PORTB.1   ' Makes it easier to wire up
    PIN8  VAR PORTB.2
    PIN9  VAR PORTB.3
    PIN10 VAR PORTB.4
    PIN11 VAR PORTB.5
    PIN12 VAR PORTB.6
    PIN13 VAR PORTB.7
    PIN17 VAR PORTA.0
    PIN18 VAR PORTA.1
    PIN1  VAR PORTA.2
    PIN2  VAR PORTA.3
    PIN3  VAR PORTA.4
    '=======================================================
    
    INPUT PIN2   '
    input pin6   '
    input PIN7   '
    input PIN8   '
    input PIN9   '  
    input PIN12  ' 
    input PIN13  '
    
    output pin1   '
    output pin3   ' 
    output pin10  '  
    output PIN11  '
    OUTPUT PIN17  '
    OUTPUT PIN18  '
    
    '=================  Check functionality      ==========================
      m var word :n var word 
      clicks var word: secs var word
      
    ' ===============================================================   
      pause 1000 'Do nothing for a while
      main:
      loop1:
      if intcon.2 = 0 then loop1  'TMR0 must be enabled to get out of this loop1
      intcon.2 = 0
      clicks=clicks+1
      if clicks >=1900 then
      clicks=0
      high pin11:pause 100:low pin11  'Flash LED for 10th of second
      secs=secs+1
      endif
      if secs>=5 then 
      high pin10:pause 100:low pin10
      gosub nowt
      secs=0 'Reset secs
      endif
      goto loop1  
      end
      nowt: 'm=m+1 ' Why does this one extra instruction cause Pin11 High
    ' And cause progam to FAIL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      return
    Last edited by ScaleRobotics; - 21st July 2010 at 17:41. Reason: added code tags

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Maybe this will help. Scroll down to post #125 to start.
    http://www.picbasic.co.uk/forum/show...t=12677&page=4

    In your code, where does the value of "m" come from?

    And... Look at using code tags when you post code. Makes it easier to read...
    http://www.picbasic.co.uk/forum/misc.php?do=bbcode#code
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Sep 2009
    Posts
    11


    Did you find this post helpful? Yes | No

    Default DTMF decoder

    Quote Originally Posted by mackrackit View Post
    Maybe this will help. Scroll down to post #125 to start.
    http://www.picbasic.co.uk/forum/show...t=12677&page=4

    In your code, where does the value of "m" come from?

    And... Look at using code tags when you post code. Makes it easier to read...
    http://www.picbasic.co.uk/forum/misc.php?do=bbcode#code

    Right, m comes out of the blue, just a byte variable as demonstration that inclusion of m=m+1 causes failure.
    How do you use code tags when posting code?
    Rgds

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mike1939 View Post
    Right, m comes out of the blue, just a byte variable as demonstration that inclusion of m=m+1 causes failure.
    How do you use code tags when posting code?
    Rgds
    Code Tags:

    [_code]
    Anything here will be in the tag.
    Remove the _ to make it work.
    [_/code]
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. 8870/dtmf + Pic?
    By PIC_hobbyist in forum General
    Replies: 2
    Last Post: - 5th March 2013, 01:19
  2. PIC RS-232 to control Access database?
    By Angus Anderson in forum General
    Replies: 6
    Last Post: - 29th July 2007, 13:26
  3. Replies: 2
    Last Post: - 31st July 2006, 16:06
  4. Problems with DTMF Generatiom
    By Angus Anderson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2006, 21:12
  5. Shaping DTMF Signal out of PIC
    By charudatt in forum Schematics
    Replies: 1
    Last Post: - 8th October 2003, 10:09

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts