[SOLVED !] Help with Macros - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

Thread: Help with Macros992 days old

  1. #16
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,353
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Help with Macros

    Alberto, if it were possible to get a pointer to the string in ROM, I would send it a byte at a time to a PC via serial, so no temporary buffer and no RAM used. The app I'm working on is here
    George.

  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. #17
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    689
    Thumbs Up
    Received: 92
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: Help with Macros

    Hi George,
    I downloaded the project (VarDispSerDemo.bas) and I compiled it.
    I found only one single String, defined as: Dim String_Var As String * 10. Is it right?
    You have written the line: String_Var = "some strin" and you wanted to know the address and length of the String in the ROM, is it correct?

    I can see some things.
    - The length of the String in the ROM will depend on the length of the string of characters you are going to load into the RAM at run time, for example:
    If "Dim String_Var As String * 25" and "String_Var = "some string", only 11 characters will be written in the ROM. Then the lenght of the String is easy to know: LenghtString = Len(String_Var). These infos written in RAM would never be lossed because there are loaded again in RAM after every Reset.

    - Because of the program, if the number of characters loaded in the RAM String varies, it is of no use reading the ROM because it will always be false.

    - Yes, the string address in the ROM could be found with a lot of code and some tricks.

    - But I do not see any utility because you are already using RAM (It is more easy).

    - The correct solution is to use Cdata and I can make a macro to send by RS232 the String/lenght/Address. (No RAM used)

    String1: Cdata "Some Strings",0 ' Written in ROM.
    String2: Cdata "More others Strings",0 ' Written in ROM.

    Could you give me more information?
    Regards
    Alberto
    Last edited by AlbertoFS; 14th September 2017 at 18:20.
    73's de Alberto ea3agv

  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. #18
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,353
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Help with Macros

    Alberto
    I found only one single String, defined as: Dim String_Var As String * 10. Is it right?
    You have written the line: String_Var = "some strin" and you wanted to know the address and length of the String in the ROM, is it correct?
    No, thats just a test of strings and unrelated to this issue.

    Depending on which version you downloaded, in either VarDispSer.inc or SnapShotInc.inc you will see two macros Dump and DumpW. The first will dump RAM (among other things) and continue, the second will dump RAM and wait for a key press on the PC. Now I want to add another option to send an arbitary message to the PC, which for now I'm calling Message("bla bla").

    The length of the String in the ROM will depend on the length of the string of characters you are going to load into the RAM
    I'm trying to minimize the use of RAM so I'm loath to create a temporary RAM buffer unless I have to.

    Yes, the string address in the ROM could be found with a lot of code and some tricks.
    I can't see how, bear in mind there could be many uses of Message("bla bla") so many _STRLB__n's

    The correct solution is to use Cdata and I can make a macro to send by RS232 the String/lenght/Address. (No RAM used)
    An option, but more complicated. I need something that you can quickly add to the source, recompile and run.
    Last edited by towlerg; 15th September 2017 at 00:15.
    George.

  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. #19
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    689
    Thumbs Up
    Received: 92
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: Help with Macros

    Hi George,
    Now I understand your need, although I do not fully understand their use, but this does not matter to me.

    Preamble:
    1- Detect the label of the first String defined by the label (_STRLB__1) generated by the compiler in the ASM file but invisible in ROM.
    2- Detect the final label of the last string defined by the label (_STRLB__X) generated by the compiler in the ASM file but invisible in ROM.
    3- Determine the address and length of each String that will give us the format of each String.

    In my opinion, the system could work as follows:
    - Determine the beginning of the Strings in ROM.
    - Calculate the beginning and lenght of each String.
    - Send the ASCII characters already formatted to the terminal if needed. In other words, send a Carriage Return + Line Feed to the end of each string.
    - Determine the end of the Strings in ROM.

    At the moment I can see one possibility:
    - Place a special String at the beginning of the source program to start the strings list. (Any String you want)
    - Place a special String at the end of the source program to finish the strings list. (Any String you want)

    Depending on how the compiler works the strings of synchronization should be 6 characters to be placed in the same conditions, for example:
    Code:
        Dim MyString0 As String * 6
        Dim EndString As String * 6
    
    Main:
        MyString0 = "000000"
    
        Code...
        MyString1 = "Hello World"
        Code...
        Hrsout "Hellow World",13
        Code...
        Print At 1,1, "Some Strings"
        Code...
        MyString2 = "Testing a string"
        Code...
        MyString3 = "Macro for Strings"
        Code...
        Code...
    
        ' Final of the program.
        EndString = "999999"
        End
    You should read the ROM from address 0 and detect 6 times the character 0 in ASCII (48 in decimal) + 0 for the end, for the header.
    Read the ROM until you find and detect 6 times the 9 character in ASCII (57 in decimal) + 0 for the ending to finish.
    You have to be careful with the Config Fuses, which is allowed to read the ROM.

    ASM file:
    Code:
    _STRLB__1
        db 48,48,48,48,48,48
        db 0
    _STRLB__2
        db 72,101,108,108,111,32
        db 87,111,114,108,100,0
    _STRLB__3
        db 84,101,115,116,105,110
        db 103,32,97,32,115,116
        db 114,105,110,103,0
    _STRLB__4
        db 77,97,99,114,111,32
        db 102,111,114,32,83,116
        db 114,105,110,103,115,0
    _STRLB__5
        db 57,57,57,57,57,57
        db 0
    proton#main#start
    In my Bootloader article on the wiki, you can find all the codes to read the ROM.

    I hope that this solution may suit you. I do not see another solution for the moment. You have posed a very difficult problem.
    Regards
    Alberto
    Last edited by AlbertoFS; 15th September 2017 at 08:46.
    73's de Alberto ea3agv

  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. #20
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    689
    Thumbs Up
    Received: 92
    Given: 2
    Total Downloaded
    4.62 GB

    0 Not allowed!

    Default Re: Help with Macros

    You have to be careful in reading the strings. As the ROM is formatted in Words, if the string has a even number of characters the end will be 0 + 0 (binary). If the string has an odd number of characters the end would be Ascii character + 0.
    Alberto
    73's de Alberto ea3agv

  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. #21
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,353
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Help with Macros

    Alberto, thanks for an innovative solution to an apparently insolvable problem. BTW the purpose of the Message("bla") "macro" was to display on the PC, information about the progress of the program under test eg. "Sleeping, waiting for IRQ" or "end of heading calculation" or "Oh dear, something has gone wrong".

    While walking the dog I thought of a better way. I have to parse out the location in source of each Dump and its ID so all I have to do is store the comment (if any) on that line of source and display it on the PC when that Dump is reached. In that way the PIC has nothing to do.

    Thanks again for all your help.
    Last edited by towlerg; 15th September 2017 at 15:41.
    George.

  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. #22
    Senior Member AlbertoFS's Avatar
    Join Date
    Apr 2005
    Posts
    689
    Thumbs Up
    Received: 92
    Given: 2
    Total Downloaded
    4.62 GB

    1 Not allowed!

    Default Re: Help with Macros

    It is perfect that you have been able to find a better solution for your program. Anyway, I think this thread has been useful to understand how to use the pre-processor for Strings. This way to read the strings in the ROM may be useful to someone in the future.
    Regards
    Alberto
    73's de Alberto ea3agv

  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. #23
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,353
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Help with Macros

    Anyway, I think this thread has been useful to understand how to use the pre-processor for Strings

    I couldn't agree more. Up till now I've only used it for $IFDEF do something $ENDIF, I now see that it's much more powerful.
    George.

  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 4 users browsing this thread. (0 members and 4 guests)

     

Similar Threads

  1. Help with Macros and the Preprocessor
    By johngb in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 31st August 2011, 22:18
  2. SPI Macros
    By dmTulsa in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 14th May 2010, 16:34
  3. [SOLVED !] MACROS - Please be gentle
    By Barry in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 29th January 2010, 00:14
  4. [SOLVED !] SD Macros
    By Mike B in forum Proton Plus Compiler v3
    Replies: 8
    Last Post: 17th October 2008, 00:53
  5. [SOLVED !] Help with macros
    By the.fox in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 14th April 2005, 19:55

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