Parallax Serial Terminal skips first writes
Erlend
Posts: 612
Consequently the Parallax Serial Terminal - which I use (PC window) for debugging - keeps skipping the first one or two lines. I've tried to put in a delay after the pst.start, but it does not help. I picked a demo from obex, but it is the same thing:
Yes, baudrate is set correctly. I've tried stop & restart of the pst, but it doesen't help either. No fun with a bugg debugger!
OBJ pst : "Parallax Serial Terminal" PUB Main | value, base, width, offset pst.Start(115_200) 'Set Parallax Serial Terminal to 115200 baud '-------- Demo 1 -------- pst.Str(@DemoHeader) 'Print header; uses string in DAT section. pst.Chars("-", strsize(@DemoHeader)) 'Use Chars method to output hyphens "-" pst.Str(String(pst#NL, pst#NL, "*** Number Feedback Example ***")) repeat pst.Chars(pst#NL, 3) 'Output multiple new lines pst.Str(String("Enter a decimal value: ")) 'Prompt user to enter a number; uses immediate string. value := pst.DecIn 'Get number (in decimal). pst.Str(String(pst#NL, "Your value is...")) 'Announce output pst.Str(String(pst#NL, " (Decimal):")) 'In decimal pst.PositionX(16) 'Move cursor to column 16 pst.Dec(value) pst.Str(String(pst#NL, " (Hexadecimal):", pst#PX, 16)) 'In hexadecimal. We used PX control code to pst.Hex(value, 8) ' move cursor (alternative to PositionX method). pst.Str(String(pst#NL, " (Binary):")) 'In binary. pst.MoveRight(6) 'Used MoveRight to move cursor (alternative pst.Bin(value, 32) ' to features used above). pst.Str(String(pst#NL, pst#NL, "Try again? (Y/N):")) 'Prompt to repeat value := pst.CharIn while (value == "Y") or (value == "y") 'Loop back if desired
Yes, baudrate is set correctly. I've tried stop & restart of the pst, but it doesen't help either. No fun with a bugg debugger!
Comments
This functions as expected on my setup
I've tried this code too - the pst demo - what happens is that there is no text appearing - until I enter a value <enter>. After that it behaves in accordance with the code. Beats me.
Erlend
You know, PST must be enabled to display serial data, right? By default, when the PST losses focus, it closes the serial port. The act of entering data in the PST window gives focus (selects) to the PST which enables the serial port again. Make sure PST is selected after right after running the SPIN code. Otherwise load the code in EEPROM.
What do other terminals do ? What does PST do when looped back ?
Have you checked the first char is 'legal' ?
Most common cause of what you describe, if it does not appear on loop-back, is somehow a timer init fail skewing the first bit time.
It is increadibly frustrating to be stopped finding the bugs in my code, just because the debugger does'n work!
value := pst.CharIn
while (value == "Y") or (value == "y") 'Loop back if desired[/code]
It produced this output
John Abshier
Erlend
If you can change the Com port it will be in there.
Two things I have noticed and done:
1. after the startup of the FDX, put a 2-4 second delay; looks like that got mentioned a couple posts back. Not sure if that has really made much difference for what I have been doing. Guess it depends how long the cog used takes to initialize and be ready for I/O functions.
2. after clearing the terminal and putting it to ready, I reset the prop and then I get all the expected output. I think there is just that much of a switchover delay between the download from the tool and the startup and make ready of the PST device. Seems I did not have this under BST on my linux box, but I could be wrong there as due to some issues using the terminal under linux, I have been using windows for a few weeks.
2. When loading a program, type -- in rapid succession -- F10 (or F11), F12, CR.
-Phil
I thought the COM was flexible wrt baud speed, thuogh.
Happy: debugging my code contiues!
EDIT
====
No, now it does not work again. Back to frustrations.:frown:
EDIT2
Resignation == putting this line in at first whenever I need pst: value := pst.DecIn -but it is no fun for the brain. I hate patch kind of fixes.
Erlend