Shop OBEX P1 Docs P2 Docs Learn Events
Concatenating bytes in DAT section — Parallax Forums

Concatenating bytes in DAT section

bte2bte2 Posts: 154
edited 2015-01-11 14:50 in Propeller 1
Hi folks!

I have a graphic VFD display that I am writing some custom logos and such for, by declaring the data bytes in the DAT section. The display is 16 pixels tall so it takes two bytes for each column to be displayed. Here is how I am doing it:


(this code works just fine)
logodatastart byte(%11111111), (%11111111)   ' display data
                   byte(%10000100), (%00100001)   ' display data
                   byte(%10000100), (%00100001)   ' display data
                   byte(%10000100), (%00100001)   ' display data
                   byte(%10000100), (%00100001)   ' display data
                   byte(%10000000), (%00100001)   ' display data
                   byte(%10000000), (%00100001)   ' display data
                   byte(%10000000), (%00100001)   ' display data


What I would like to do, in order to help visualize what the output will look like (without the intervening parenthesis, comma, and %) is to declare those bytes as 16-bit words but read them as 8-bit bytes like this:

(this code does not work)
logodatastart byte(%1111111111111111)   ' display data
                   byte(%1000010000100001)   ' display data
                   byte(%1000010000100001)   ' display data
                   byte(%1000010000100001)   ' display data
                   byte(%1000010000100001)   ' display data
                   byte(%1000000000100001)   ' display data
                   byte(%1000000000100001)   ' display data
                   byte(%1000000000100001)   ' display data

I want to do this so I can tilt my head and get a good idea of what the display will look like. The byte seperators make it harder to visualize what is happening and I would like to get rid of them if possible.

The code works, so this isn't urgent at all, just curious. I tried several ways to get this to work but no love as of yet.

Am I missing something?

Comments

  • bte2bte2 Posts: 154
    edited 2015-01-11 09:30
    Ultimately what I hope to accomplish is rewrite the fetching part to start grabbing those bytes from the bottom of the array, so that I can make a field of zeroes then just add the 1s where I want the pixels lit up. I tried declaring them as words, and that didn't work.
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-01-11 09:31
    I believe this will work.
    logodatastart byte
                       word %1111111111111111   ' display data
                       word %1000010000100001   ' display data
                       word %1000010000100001   ' display data
                       word %1000010000100001   ' display data
                       word %1000010000100001   ' display data
                       word %1000000000100001   ' display data
                       word %1000000000100001   ' display data
                       word %1000000000100001   ' display data
    
    However, the right and left bytes will be swapped with respect to the way they're displayed in a word. If need be, you could swap the bytes at the beginning of your program.
  • bte2bte2 Posts: 154
    edited 2015-01-11 09:42
    Hi Dave, thank you for replying. I tried it that way but it didn't work (directly at least). I think I might have to declare them as words and use data[0] and data[1] to fetch them, but I've been too busy to experiment much. I'll keep chipping away at it but I don't think it is too terribly complicated.

    Thanks again :-)
  • bte2bte2 Posts: 154
    edited 2015-01-11 10:28
    Actually my question has changed. I have the program set up to start from the bottom of the array, and I have the elements declared as words, so now I am attempting to get the index integrated with the byte offset.

    This expression will not compile:
      repeat temp from 32 to 0                        ' logo is 33 columns wide temp is an offset pointer into the array
            VFD.tx(logodatastart[temp].byte[1])   ' display data
            VFD.tx(logodatastart[temp].byte[0])   ' display data
    

    The array is declared like this(for 33 lines):
    logodatastart word %1111111111111111   ' display data
                       word %1000010000100001   ' display data
                       word %1000010000100001   ' display data
                       word %1000010000100001   ' display data
                       word %1000010000100001   ' display data
                       word %1000000000100001   ' display data
                       word %1000000000100001   ' display data
                       word %1000000000100001   ' display data
    etc
    etc
    etc
    

    Anybody have any pointers how I might integrate the address offset and the byte modifier? I've fiddled around with it for a bit and am stuck.
  • kuronekokuroneko Posts: 3,623
    edited 2015-01-11 11:19
    bte2 wrote: »
    Actually my question has changed. I have the program set up to start from the bottom of the array, and I have the elements declared as words, so now I am attempting to get the index integrated with the byte offset.

    This expression will not compile:
      repeat temp from 32 to 0                        ' logo is 33 columns wide temp is an offset pointer into the array
            VFD.tx(logodatastart[temp].byte[1])   ' display data
            VFD.tx(logodatastart[temp].byte[0])   ' display data
    
    Unfortunately the syntax doesn't allow for this. Try this (or any other variation) instead:
    temp := @logodatastart[32]+1
    repeat 66
      VFD.tx(byte[temp--])
    
  • bte2bte2 Posts: 154
    edited 2015-01-11 14:50
    kuroneko wrote: »
    Unfortunately the syntax doesn't allow for this. Try this (or any other variation) instead:
    temp := @logodatastart[32]+1
    repeat 66
      VFD.tx(byte[temp--]
    

    Worked like a charm, just as you posted it. Thank you huge!

    -bryan
Sign In or Register to comment.