pst printing variable
mikea
Posts: 283
Hi, I was using the "lookup" command and having a problem with the pst commands to print out the lookup index. I can't find a similar example. I have tried "pst.chars", and "pst.dec". what is the proper way to print the sting or value of "list" associated with lookup? Thanks
CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 obj pst:"parallax serial terminal" pub view|index,list pst.start(115_200) waitcnt(clkfreq/2+cnt) repeat index from 1 to 7 list:=lookup(index: "hi",1234,"bye",5678,"bon jour",2222,"adios") pst.Dec(list) waitcnt(clkfreq+cnt)
Comments
Okay, here's a core that works -- not that you numbers are changed to strings as you cannot mix those types. If you need them to be numbers, put them in a separate list.
BTW... PST is just FullDuplexSerial with training wheels -- take of the training wheels!
BTW, here's how I would print the list. I always strive to create code that can be used across a variety of applications.
This uses a method called str_pntr() to find the starting address of a specific string within a list of strings.
I admit to being pretty pleased with myself after writing it. I complimented myself with the thought "It looks like something JonnyMac would write".
While our methods aren't exactly the same, I like to think my compliment was justified.
High praise, indeed.
</sarc>
The lookup list works fine for strings, provided they're formatted correctly: