Macro questions


+ Reply to Thread
Results 1 to 8 of 8

Thread: Macro questions901 days old

  1. #1
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,374
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Macro questions

    While looking through the ADC and SPI macros to see how they work I noticed a couple of things that I could not find answers to, I searched the manual for Macro and did not find any information on them at all.

    I have seen some examples where it used Macro but in the libraries above it uses Macro- , is there a difference with using the dash?There are also references to Byte_Bit, Byte_Byte and Byte_Word but I cannot find where to get information on these.
    In the SPI.inc there is Return_WREG used in several places which does not appear to have been declared anywhere, I can see WREG has data written to it but I cannot see how this ties up with Return_WREG which I assume it does.

    I am sure there is a whole lot more that I need to know but cannot find out where all this information is.

    Regards,
    Bob

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,671
    Thumbs Up
    Received: 353
    Given: 168
    Total Downloaded
    1.99 GB

    1 Not allowed!

    Default Re: Macro questions

    The macros never really took off, so I didn't write an article on how to use them. Maybe I'll get around to it, as they are quite simple to use, and very efficient.

    The Return_xxxxx directives are something I wrote a while back, for when I wrote libraries, but they are handy and there are a few of them.

    Return_Wreg will return the value held in the WREG SFR
    Return_Byte pParameter Will return the byte variable's name in pParameter
    Return_Word pParameter Will return the word variable's name in pParameter
    Return_Dword pParameter Will return the dword variable's name in pParameter

    I've just completed Return_Float, so it will be in the next compiler update.

    To use one of them, a simple example Is:

    Code:
    Dim MyByte as Byte
    
    Dim Mac_Bytein as Byte
    Dim Mac_Byteout as Byte
    '
    ' Create a simple demo macro to add 1 to the parameter value and return it
    '
    TestMacro Macro pValueIn
        Num_Byte pValueIn, Mac_Bytein  ' Make the assumption that pValueIn is a constant value, and load it into Mac_Bytein
        Mac_Byteout = Mac_Bytein + 1   ' Add 1 to Mac_Bytein and place it into Mac_Byteout
        Return_Byte Mac_Byteout        ' Return the contents of Mac_Byteout to the program that uses the macro
    Endm
    
    Main:
    ' Test the macro
    
        MyByte = TestMacro 10        ' Load MyByte with the return value from the macro. Which will be 11. i.e. 10 + 1
    
    ' Or...
    
        If TestMacro 10 = 11 Then   ' Call the macro and test the result
            HrsoutLn "Correct"      ' Display if it correct
        Else                        ' Otherwise...
            HrsoutLn "Incorrect"    ' Display if it is incorrect
        EndIf

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,219
    Thumbs Up
    Received: 104
    Given: 1
    Total Downloaded
    2.92 GB

    1 Not allowed!

    Default Re: Macro questions

    If you want to play with macros you could try using the MacroGenerator wizard. I wrote it to save the labour of writing out long macros and to make life easier when using Library Manager. (BTW it was my first Delphi program!)

    What it does is allow you to pass parameters to a subroutine and optionally receive a return. It provides an approximation to Procedures in 18F series programs. You can download it as part of Library Manager Development tools. As I think it has some pertinence still I might add it to the wiki as a separate download.
    JohnB

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,671
    Thumbs Up
    Received: 353
    Given: 168
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Macro questions

    Sorry John. I'd forgotten about that program. It does make things a lot easier.

    That's the problem with the forum, it's too large and things get forgotten. Is there any chance of releasing the source to it for users to, maybe, add extras.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Prolific Poster johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,219
    Thumbs Up
    Received: 104
    Given: 1
    Total Downloaded
    2.92 GB

    1 Not allowed!

    Default Re: Macro questions

    I am happy to release it but the code is a bit messy as it was my first attempt at Delphi.

    I'll dig it out and try and publish it in the next few days.
    JohnB

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,942
    Thumbs Up
    Received: 26
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: Macro questions

    Could you point me to the MacroGenerator plugin please John?

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,219
    Thumbs Up
    Received: 104
    Given: 1
    Total Downloaded
    2.92 GB

    0 Not allowed!

    Default Re: Macro questions

    Its only available as part of the Library Manager Developers pack.
    I don't have time at present to publish it as a separate plugin I am afraid.
    JohnB

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,942
    Thumbs Up
    Received: 26
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: Macro questions

    ah ok that would explain why I cant find it
    thanks John

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. [SOLVED !] Cannot place a user defined macro within a user defined macro?!?
    By DmitriK in forum Proton Plus Compiler v3
    Replies: 10
    Last Post: 19th August 2011, 02:24
  2. usart questions (other questions MSSP?)
    By spyder0069 in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 21st November 2009, 05:21
  3. [SOLVED !] Macro calling another macro inside a library
    By pdgnr in forum Library Manager
    Replies: 2
    Last Post: 27th March 2008, 07:20
  4. Macro
    By gurolkalayci in forum Proton Plus Compiler v3
    Replies: 7
    Last Post: 26th March 2006, 17:41
  5. [SOLVED !] 2 questions
    By BenH in forum GPS
    Replies: 8
    Last Post: 20th November 2005, 08:14

Tags for this Thread

Posting Permissions

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