Thoughts on String variable debugging in ViewPort
Currently most people are using variants of FullDuplexSerial to interface with a terminal. At the lowest level, this means they're bit-banging one byte at a time to/from the terminal- in their main cog. Correct me if I'm wrong, but I don't think this makes it easy/convenient to create nice interfaces for passing longs, floats, strings around... It also completely ties up your IO channel- you can only share 1 channel of text information.
ViewPort's architecture is different. One cog is dedicated to sharing global memory with the PC program. Up to now it shared "longs", and arrays of longs (which could represent streaming video or sampled measurements). I recently added the ability to share arrays which contain null-terminated strings. To transmit a string, your program needs to copy a string to such an array. Transmitting floats or integers in hex/binary formats just means ViewPort has to decode the value as that.
You can share any number of strings- and you can easily switch within ViewPort to the string you want to watch. You can also share any number of other things- video, IO measurements, variables....
I'm working on a clean way to let your program "prompt" for input: string, float, int, hex, binary... vp.getStr would cause your spin code to wait until a string was entered inside of ViewPort. vp.getInt for integers entered in any format ...
Here's some things you could do:
vp.sendStr(&DebugStr,"This is a debug string- select the Debug channel to view these strings")
vp.sendStr(&UIStr,"This is a user interface string- please type your name")
vp.getStr(&Name) 'program pauses here until user has entered a string, which will be assigned to Name
vp.sendStr(&UIStr,"How old are you")
vp.getInt(&Age) 'user can type a number in hex, binary... it'll be assigned to age
vp.sendStr(&UIStr,"In 5 yours you will be:")
vp.sendInt(Age+5)
Here's a screenshot of ViewPort's debugger with a small terminal window on the bottom right. The "text" tab has a full-sized terminal.

What do you think?
Hanno
ViewPort's architecture is different. One cog is dedicated to sharing global memory with the PC program. Up to now it shared "longs", and arrays of longs (which could represent streaming video or sampled measurements). I recently added the ability to share arrays which contain null-terminated strings. To transmit a string, your program needs to copy a string to such an array. Transmitting floats or integers in hex/binary formats just means ViewPort has to decode the value as that.
You can share any number of strings- and you can easily switch within ViewPort to the string you want to watch. You can also share any number of other things- video, IO measurements, variables....
I'm working on a clean way to let your program "prompt" for input: string, float, int, hex, binary... vp.getStr would cause your spin code to wait until a string was entered inside of ViewPort. vp.getInt for integers entered in any format ...
Here's some things you could do:
vp.sendStr(&DebugStr,"This is a debug string- select the Debug channel to view these strings")
vp.sendStr(&UIStr,"This is a user interface string- please type your name")
vp.getStr(&Name) 'program pauses here until user has entered a string, which will be assigned to Name
vp.sendStr(&UIStr,"How old are you")
vp.getInt(&Age) 'user can type a number in hex, binary... it'll be assigned to age
vp.sendStr(&UIStr,"In 5 yours you will be:")
vp.sendInt(Age+5)
Here's a screenshot of ViewPort's debugger with a small terminal window on the bottom right. The "text" tab has a full-sized terminal.

What do you think?
Hanno

Comments
ViewPort will support a "string variable type" which you can use in spin and view/change using ViewPort. Just like you can view/change integers you'll be able to view/change strings.
ViewPort will also have a built in terminal that interfaces easily with existing terminal spin code. The conduit object will provide a replacement for the "tx" and "rx" commands that are the backbone for sending/receiving anything else. So, integrating any existing terminal code will be easy- just replace the tx and rx functions with the vp equivalents...
So, you still lose one cog to handle serial IO (used to be FullSerial, now Conduit). You can send/receive text using the existing terminal functions. AND you get all the goodness of ViewPort- debugger, view/change variables, view io state....
Hanno
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH - Electronics: Engineer - Programming: Professional
Here it's documentation:
{{ Use this Object instead of a FullDuplexSerial derivative to quickly get started with ViewPort. ViewPort has a terminal which let's you use your existing terminal code, but so much more: monitor the Propeller IO pins at up to 80Msps, monitor and change variables, vision, fuzzy logic.... (This object was adapted from Marin Hebel's Extended_FDSerial, which was based on Chip Gracey's FullDuplexSerial) ____________________________ Features: * Full suite of terminal functions to receive and transmit strings and integers * Fully compatible tx and rxbyte foundation * Wrapper for all Conduit functions- just use this object ____________________________ Use: -Set clock rate to 80MHz: CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 -Include this object in your program- replace your existing FullDuplexSerial variant: Obj vp:"Terminal" -Allocate 2 longs VAR long OutP,InP -Share memory with ViewPort vp.share(@outP,@inP) 'use instead of vp.start(30,31,0,9600) ____________________________________________________________ Here's a simple program: CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ vp: "terminal" var long OutP,InP pub main vp.share(@OutP,@InP) ' instead of vp.start(31,30,0, 9600) repeat vp.str(string("Hello World!",13)) ______________________________________________________________ Terminal Functions Tx(byte) Print a byte Str(stringptr) Print a string Dec(value) Print a decimal number Hex(value, digits) Print a hexadecimal number Bin(value, digits) Print a binary number Rx Receive a byte of data RxTime(ms) Receive byte with timeout RxDec Returns decimal string as value RxDecTime(ms) Returns decimal string as value with timeout RxHex Returns received hex string value as decimal RxHexTime(ms) Returns received hex string value as decimal with timeout RxStr Passes received string RxStrTime(ms) Passes received string with timeout RxCheck Check if byte received (never waits) RxFlush Flush receiver buffer _______________________ ViewPort Functions Share(@varA,@varC) Share memory from varA to varC with ViewPort. This lets you monitor&change them. You MUST use this function- at the start of your program, but AFTER "register" and "config" statements have run. Register(component,cfg) Register other components (fuzzy logic, video, quicksample..) Config(cfgstring) Configure ViewPort. CfgString can be generated by ViewPort. }}(installs as ViewPort v4.1F)
Some new goodies:
- support for Propeller float type
- support for Propeller string type
- new terminal, see tutorial #16
- improved OpenCV, better interface, runs continuously (even while other tabs are up), and lets you use either a webcam, a propeller frame grabber, an avi file, or images...)
- lots of fixes
Download v4.1F
This version expires mid-Feb. I hope to release the final by then! No known issues- if you encounter something strange please tell me about it!
Hanno