Using ASM files as include


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Using ASM files as include

    Hi,

    Well i have been working something out and now i need to use a DTMF detector, it comes to my attention that microchip has a whole project and ASM files that can be used to detect this tones without a DTMF decoder, but by using just a pic and a small ZCD. AN257.

    Now my question is:

    Can i use this ASM project to include it in my Picbasic Project?, i dont know any ASM and i dont want to learn any C18, i am really comfortable with PicBasic

    Today i will be testing the project as compiled by MPLAB but i hope i could get some advise in order to decide wheter i will go through with it tomorrow.

    Thanks

    DJC

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi, "Doom & Gloom"'s my name for today.

    First off, I'll say that I understand very little about the math involved in that application note.
    When I see something like ...

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1927&stc=1&d=118711900 6"></img>

    My eye's gloss over, and I take another sip from the beer.

    But after looking at AN257...., that's some serious stuff.
    Probably why they have all the copyright and license restrictions.

    However, I can say that the program uses "relocatable" code. (something I've never got to work with PBP).
    So just using them as an include file, and calling the functions, isn't going to work.

    I suppose if you actually understood what it what doing, you could rewrite it.
    But with math like that, I wouldn't know where to start, or how to find the bugs that would be inevitable.

    Best regards,
    &nbsp; DG
    &nbsp; Doom & Gloom
    <br>
    Attached Images Attached Images  

  3. #3


    Did you find this post helpful? Yes | No

    Red face Amazingly Easy

    Hi Darrel.

    Bad luck for me, the code is not that hard by the way.

    Amazingly: there is no math at all in the final algorithm. I am having real fun doing this stuff by the way.

    In short words the math formula of DFT (which you took the bother to take) is a simple comparision of two bits in N samples, when the sample is passed through a 1bit A/D converter (Zero cross detector for example).

    What the algorithm does is:
    Code:
     if RealSample = StoredExpected then
               Energy = Energy + 1
     else
               Energy = Energy - 1
     endif
    The stored expected is a representation of 1`s and 0´s of the signal, considering the samplig frecuency.

    i.e. Stored Expected
    11111000001111100000111110000011111000001111100000 111110000011111


    This must be done with each sample and one can choose like 114 samples (any number, the bigger the better).

    The final Energy its a great representation of the existence of the Detected Frequency in the signal. a simple excel worksheet amazed me, this is really a great filter!!

    You could even try to trick the algorithm by adding two or three more frequencies at the same time and it will GET the result!

    The reason to tell you all this is because my project might need optimization, i am really bad writing that way. BUT YOU ARE A WIZARD, so i might be posting code to check .

    I Think a good include can come out of this.

    By the way, is the EEPROM memory of 16f628 fast enough to be read? i am storing my Stored Expected in that memory but my result is not exact at the moment. I am getting the greatest energy around 300 with a F applied of 350.

    I am attaching the excel form that amazed me in case someone is interested, you can move frequency and phase of two frequencies and watch the resultant Wave, and also watch the resultant energy, wich would show that the frequency is detected.
    Attached Files Attached Files
    Last edited by Josuetas; - 15th August 2007 at 05:26.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Well that certainly makes it look easy.
    A lot easier than that other formula.

    It'll be interesting to see if it does as good in the real world as in the spreadsheet.

    Yup, should make a good include file.

    is the EEPROM memory of 16f628 fast enough to be read? ...
    Reading from EEPROM only takes 1 instruction cycle, but loading the address each time adds a couple too. But it should still be plenty fast enough.
    <br>
    DT

Similar Threads

  1. Continuous Interrupts when using DT_INTS and an INCLUDE file
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 15th January 2010, 21:42
  2. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  3. Include ASM file help
    By harryweb in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd May 2007, 20:22
  4. include files 8k limit
    By skimask in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th January 2006, 06:35
  5. Replies: 2
    Last Post: - 13th December 2005, 00:11

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