Menu

Converting from Pic Basic Pro to Great Cow Basic - using Lookup and assign value to a var

Help
2024-11-22
2024-11-24
  • Steve Scott

    Steve Scott - 2024-11-22

    Hello All-
    I have coded in Pic Basic Pro for many years but am trying to get proficient and use Great Cow Basic for any new projects.
    My question is if there any others out there who are or who have moved from PBP to GCB, could you help me with I am trying to accomplish with the following line:
    `/lookup PRevision dig 1,[zero,one,two,three,four,five,six,seven,eight,nine],DspDig2/'
    '/lookup PVersion dig 0,[zero,one,two,three,four,five,six,seven,eight,nine],DspDig3/'
    In the 1st line, I am trying to lookup a value based on digit 1 of the variable PRevision in a table of
    zero, one, two, three, to nine. and put the value into variable DspDig2.
    The 2nd line much the same but lookup based on digit 0 of the variable PRevision in the same table and put it in variable DspDig3.

    ALSO, is there a way to specically read or write to a specific digit of a variable?

    Any help would be greatly appreciated.

     

    Last edit: Steve Scott 2024-11-22
  • Steve Scott

    Steve Scott - 2024-11-22

    I think I am getting some of this.
    This is what I have WITHOUT figuring out how to read or write to a specific digit in a variable.
    Does this work:

        Sub DisplayCodeRev
        'Need to get the single letters to work here - or just satisfied using HEX values
            DspDig1 = 0x50 | Decimal ' "r" (0x50) for Revision of code plus (ORed) the decimal point. 
        '    lookup PRevision dig 1,[zero,one,two,three,four,five,six,seven,eight,nine],DspDig2
            ReadTable 7Seg, PRevision dig 1, DspDig2 
        '    lookup PRevision dig 0,[zero,one,two,three,four,five,six,seven,eight,nine],DspDig3
            ReadTable 7Seg, PRevision dig 0, DspDig3
            gosub WriteToDisp
        'return
        End Sub
    
        Table 7Seg
            zero,one,two,three,four,five,six,seven,eight,nine
        End Table    
    
        ReadTable works this way?
    
     
  • Steve Scott

    Steve Scott - 2024-11-22

    I can always use several variables for the individual digits in the Var:
    VarD0, VarD1, VarD2, etc.....

     
  • Steve Scott

    Steve Scott - 2024-11-22

    This is for writing to a STLED316S 7-segment 8 digit controller via 3-wire SPI.

     
  • Thomas Henry

    Thomas Henry - 2024-11-24

    STLED316S is similar to the existing 7Segment libraries. Hack the existing libraries as this will give you the answer.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.