Embedded Strings in your Code Space


Closed Thread
Results 1 to 40 of 50

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    How dare you fix my program while I'm still posting that you were right!

    Ha ha, Good job!
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    OK as i will probably never happen again, i'll write the date/month/year in my notebook with the note
    once in my life, i beat Mr Darrel Taylor
    THE Canadian 1
    United State 0
    Just kidding Darrel I learn a lot from all of your previous posts.

    Keep up the good work !!!
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Oh shoot,

    Still has that "Padding the string" problem.

    Code:
    010D   26F9 1073 3A72 00255 String1 da "My string",13,10,"blah blah",13,10,125,126,127,0
           34EE 3380 000D
           000A 316C 30E8
           1062 3661 3400
           000D 000A 007D
           007E 007F 0000
    Sendstring still terminates early if the string has an ODD number of charaters.

    Almost there.

    P.S.
    THE Canadian 0.99
    <br>
    Last edited by Darrel Taylor; - 27th August 2005 at 22:02.
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Maybe this...
    Code:
    StringOut:  ' Send the string out via Hserout
        Readcode Addr, TwoChars       ' Get the 14 bit packed characters
        IF TwoChars <> 0 then
            Char = TwoChars >> 7      ' Separate first char
            if Char then              ' Look for Null char, Don't send if found
               hserout [Char]         ' Send first char
            endif
    
            Char = TwoChars & $7F     ' Separate second char
            if Char then              ' Look for Null char, Don't send if found
               hserout [Char]         ' Send the second char
           endif
           Addr = Addr + 1            ' Point to next two characters
           goto StringOut	          ' Continue with rest of the string
        ENDIF
    return
    DT

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


    Did you find this post helpful? Yes | No

    Default

    hmmpff... is it me or
    Code:
        IF TwoChars <> 0 then
    is unecesary since we check both character anyway???
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    But it has to stop sometime.

    When you add a final ,0 to the end of the line, DA generates a 0x0000 word. So only if the whole word is 0 will it consider it the end of the "string".

    Any other 0 characters within the "string" are ignored.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Got it..
    Code:
    StringOut:  ' Send the string out via Hserout
        Readcode Addr, TwoChars       ' Get the 14 bit packed characters
        IF TwoChars then
            Char = TwoChars >> 7      ' Separate first char
            if Char then              ' Look for Null char, Don't send if found
               hserout [Char]         ' Send first char
            endif
    
            Char = TwoChars & $7F     ' Separate second char
            if Char then              ' Look for Null char, Don't send if found
               hserout [Char]         ' Send the second char
           endif
           Addr = Addr + 1            ' Point to next two characters
           goto StringOut	          ' Continue with rest of the string
        ELSE
            Addr=Addr+1
            Goto StringOut
        ENDIF
    return
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    NARGH forget the above. It depend on the previous and the next string... wich doesn't happen with my first version with DT...mmm
    Steve

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

Similar Threads

  1. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Please help with storing strings in codespace
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th May 2008, 01:02

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