Shop OBEX P1 Docs P2 Docs Learn Events
DAT or PUB ??? for a lenghty data table — Parallax Forums

DAT or PUB ??? for a lenghty data table

$WMc%$WMc% Posts: 1,884
edited 2008-10-20 21:38 in Propeller 1
Hello

········ I need to make a data table in SPIN. this data table is (KTablePos.BPe) its the "k" lookup table for the DS2760TC. I have 2 of these on a onewire bus w/ the Prop on My Prop.Pro.Dev.Board. I used(SpinOneWire.spin) and (SpinOneWire-test.spin) This works great as I see the 2 Diff. SER#'s on the TV.

········ I have read the DAT section in the Prop. manule, And the more I read through it, The more confused I seem to get.

········ Q?1 is: Should I use " DAT "·or " PUB "?;Q?2 is: Where would I put the statment· if( PUB )1st,2nd,last.? If (DAT) would it be right after the "OBJ"??; Q?3 which program should it go in (SpinOneWire) or SpinOneWire-test)?????


············ ___________________$WMc%__________out___

Comments

  • mparkmpark Posts: 1,305
    edited 2008-10-19 01:50
    For data tables, DAT is the ticket. The KTablePos.BPE table would look like this:
    DAT
    KTable   Word 00000, 00039, 00079, 00119, 00158
             Word 00198, 00238, 00277, 00317, 00357
    
             Word 00397, 00437, 00477, 00517, 00557
             Word 00597, 00637, 00677, 00718, 00758
    
    


    To look up a k value, you could just say something like this:
       value := KTable[noparse][[/noparse] k ]
    
    
  • heaterheater Posts: 3,370
    edited 2008-10-19 11:36
    Don't forget. Items in DAT sections will only exist once in memory and be used by as many instances of the object you create. Items in VAR will reserved as separate variables for each object instance. So for tables of constants DAT is appropriate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • $WMc%$WMc% Posts: 1,884
    edited 2008-10-20 21:38
    confused.gif

    ······· Thanks for the help guys; I can see (in your example) how to write the data and how it will be called. Why didn't Parallax put that in the manule?.·I'll ·give it try...



    ··············· ________________$WMc%_____________out·
Sign In or Register to comment.