Where should I discuss SD/MMC FAT issues? - Page 3


Closed Thread
Page 3 of 3 FirstFirst 123
Results 81 to 93 of 93
  1. #81
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Great! But you where wrong about the 9Tcy... Read previous post again... or build an ASM project then watch the Program Memory window.
    And yet again, that's what I get for posting off the hip... Since when is a macro...a subroutine? Must forgive my blatent stupidity...the house payment is due today
    So, does that little @ NOP?C trick work any other little way that I'm not knowing of yet with anything else?

    BTW...Self-Expanding Macro is my new buzzword...

  2. #82
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    So, does that little @ NOP?C trick work any other little way that I'm not knowing of yet with anything else?
    Well i don't know.. i'm not in your own short

    When you call a Macro, the compiler just copy/paste the whole macro code where you called the macro.

    let see...
    Code:
    OneMacro  macro
        MOVE?CT 1,PORTA,0
        MOVE?BB _MyVar,_YourVar
        endm
    EACH TIME you call the macro like this...
    Code:
    @ OneMacro
    This will paste
    Code:
        MOVE?CT 1,PORTA,0
        MOVE?BB _MyVar,_YourVar
    so...
    Code:
    @ OneMacro
    @ OneMacro
    will obviously generate
    Code:
        MOVE?CT 1,PORTA,0
        MOVE?BB _MyVar,_YourVar
        MOVE?CT 1,PORTA,0
        MOVE?BB _MyVar,_YourVar
    Hence why we often suggest to reduce your macro size.

    in NOP?C, The Conditional While (not sure if conditional or MPASM directive.. but anyway), just copy the amount of NOP you asked in the argument parameter

    NOP?C 5

    will juste paste
    @ NOP
    @ NOP
    @ NOP
    @ NOP
    @ NOP

    that's it. No code overhead, no nothing.... self expanding... or expandOnDemand ... huh?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #83
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Ok, now it's clear and I understnad why it's 5 Tcy for the example. Though it's still going to load tons of NOP's in the code (for my program), it's still strait line. Like you said, it sure will reduce the time needed to tweek the NOP's for clocking speed adjustments. Excelent tip and thanks!
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  4. #84
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JD123 View Post
    Like you said, it sure will reduce the time needed to tweek the NOP's for clocking speed adjustments. Excelent tip and thanks!
    Might even work with a separate variable...as in...
    @ NOP?C _variable
    ? maybe? maybe not?
    then you could set the variable at the top and only change it once and in your code use something like
    @ NOP?C _variable+2
    or
    @ NOP?C _variable+10
    and so on...
    But then again, if you go that far, all you're doing is reinventing the wheel (i.e. pauseus)

  5. #85
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    If _Variable is a CONSTANT, it will work indeed. You can still declare it on asm level

    Code:
    @MyVar=.30
    and later call the macro
    Code:
    NOP?C MyVar+10
    Last edited by mister_e; - 2nd April 2008 at 17:51.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #86
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    If _Variable is a CONSTANT, it will work indeed.
    That's what I meant...a CONSTANT...
    I think this little tidbit is going to save me a bunch of typing soon...

  7. #87
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    In this case, it could be better to change it too.
    Code:
    ASM
    NOP?C   macro Cin
        local a
    a=0
        while a<(Cin+MyByte)
            nop
    a++=1
            endw
        endm
    ENDASM
    and at the top of your code you define MyByte like
    Code:
    @MyByte=.10 ; your value.. whatever
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #88
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    When you first typed "=.30", I thought the decimal and the zero were a type-o. Then I see you used "=.10". It's been a long time (close to 10 years ago) that I've been through the MPASM manual, and I can still go back and read it, but can you explain the "=.30" and "=.10" for defining 3 and 1? I would have thought it would just be "=3" or "=1".

    Thanks for taking your time to explain all this to us.
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  9. #89
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It's just a MPASM naming convention. Depending the current MPASM radix setting
    @a=10
    @B=30
    Those above could be considered as decimal or hexa.

    Let's open a PBP .INC file, let's say 16F628.inc, you'll discover...
    Code:
        else
            LIST
            LIST p = 16F628, r = dec, w = -302
            INCLUDE "P16F628.INC"   ; MPASM  Header
            ;__config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
            NOLIST
        endif
            LIST
    so every value should be considered as decimal using PBP.

    MPASM naming convention
    .10 or d'10' will always be considered as 10 decimal whatever your Radix setting is.. kinda safe way to write things.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #90
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Thanks Mr.E. Now that you mentioned it, I remember dealing with the radix before, but never much explored it many uses. Again, that was a long time ago... and I've had several beers since then.
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  11. #91
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    oh... think we ALL had few beer... in case you're thirsty
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #92
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    oh... think we ALL had few beer... in case you're thirsty
    Well, in that case, I'll take
    @MyBeer=.12
    (of course that's 30 in metric beers...double it and add six)

    Handy tip there MrE...

  13. #93
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    if i could .. i would put...
    Code:
    MOVLW .3
    MULLW .8
    MOVFF PRODL, _InMyThroat
    or so
    Last edited by mister_e; - 2nd April 2008 at 22:44.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Reading and Writing from SD/MMC cards as FAT filesystem?
    By charliez in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd June 2006, 23:26

Members who have read this thread : 1

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