Go Down

Topic: [Update] Tellurium: serial monitor (Read 34257 times) previous topic - next topic

Coding Badly

Code: [Select]
   Serial.println("ASCII characters:");
   byte b = 0xFF;
   do
   {
     ++b;
       Serial.print((int)b);
       Serial.print(" = ");
       Serial.println((char)b);
   }
   while ( b != 0xFF );



Quote
Quote
After the flood of responses to my query

Not uncommon, I started a thread the other and not a single response


Definitely not uncommon.  For a few years folks had wanted good Arduino support for ATtiny processors.  In other words there was a significant pent up demand.  Despite the pent up demand, it took about six months for Tiny Core downloads to get past 100.  Now there are dozens to hundreds of downloads a day.  For whatever reasons, it takes time for new Arduino things to take off.

graynomad

Looks promising, I see the double TAB on the first line :), can't be helped if you aren't replacing them I guess.

So the dots delimit the various formats of each character?


______
Rob

Rob Gray aka the GRAYnomad www.robgray.com

aarondc

#32
Jun 13, 2013, 06:48 pm Last Edit: Jun 13, 2013, 06:52 pm by aarondc Reason: 1

Code: [Select]
   Serial.println("ASCII characters:");
   byte b = 0xFF;
   do
   {
     ++b;
       Serial.print((int)b);
       Serial.print(" = ");
       Serial.println((char)b);
   }
   while ( b != 0xFF );



Quote
Quote
After the flood of responses to my query

Not uncommon, I started a thread the other and not a single response


Definitely not uncommon.  For a few years folks had wanted good Arduino support for ATtiny processors.  In other words there was a significant pent up demand.  Despite the pent up demand, it took about six months for Tiny Core downloads to get past 100.  Now there are dozens to hundreds of downloads a day.  For whatever reasons, it takes time for new Arduino things to take off.



Thanks for the code snippet - your username is misplaced, methinks :D

Appreciate the background / historical experience reality check.

aarondc

#33
Jun 13, 2013, 06:51 pm Last Edit: Jun 13, 2013, 06:56 pm by aarondc Reason: 1

Looks promising, I see the double TAB on the first line :), can't be helped if you aren't replacing them I guess.

So the dots delimit the various formats of each character?


______
Rob




Dots are the character I am replacing non-printable characters with. Based on user selection (check the 3 push down buttons at the top of each capture), spaces, tabs and CR/LF characters can be replaced. By default, all characters that appeared as blanks when I first ran the sketch are replaced with dots.

graynomad

It's nearly 3AM in east Oz so I guess you've hit the sack :)

Three things, you need to be able to set the radix of the numerical char value, just 10 and 16 I would think.

A mode that only prints the HEX or DEC of the chars with a space between each one, for binary data the ASCII is not important.

And a mode that only prints a . for non-ASCII chars, a bit like the right side of a HEX/ASCII dump.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

graynomad

#35
Jun 13, 2013, 07:01 pm Last Edit: Jun 13, 2013, 07:06 pm by Graynomad Reason: 1
Quote
I guess you've hit the sack

I guess not :)

So with

60.=.<.

you printed spaces so where are the non-printing chars in the transmitted data?

EDIT1: Oh, you consider a any white space as non-printing

EDIT2: Now I'm going to hit the sack.

EDIT3: Don't mind me, the SPACE toggle was pressed.

I'm really off this time.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

aarondc

Oh that's just a straight raw ascii dump. I'll do some sort of hex / decimal dump later...

aarondc

At the risk of bumping my thread for no new content   :smiley-zipper: is the stratgey of updating my first post with download link and ongoing details ok? Or should I just add new posts as I go?

graynomad

I have a sticky thread where I always put the latest version of the documents in the first post. Don't know if that's officially the right thing to do but I seem to recall being asked to do that.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Coding Badly

#39
Jun 17, 2013, 08:12 pm Last Edit: Jun 17, 2013, 08:16 pm by Coding Badly Reason: 1
is the stratgey of updating my first post with download link and ongoing details ok?


Yes.  Please mention that in your first post so readers will know the post has been and will continue to change.

@eried has a somewhat reasonable example (he's a bit over the top with fonts and colors)...
http://forum.arduino.cc/index.php?topic=118440.msg891474#msg891474

aarondc

Thanks. Appreciate the example Coding Badly, I'll try not to get too colourful ;)

aarondc


HEX printing of control chars and/or just a full stop printed in a control char's place so you can see the activity. eg

WERTY..ASDFF.XCVB..

indicating two TABs after the first block, one TAB after the second and a trailing CR/LF


When I started thinking about how to do this, I was thinking every character coming through would be displayed in hex, so you'd have nice, ordered columns of data appearing.

Then I reread your post and saw you only expected non-printing characters to be translated into something useful.

I am curious. In your example above, what would a hex representation look like?

WERTY0x090x09ASDFF0x09XCVB0x0D0x0A - looks too confused to me
WERTY 0x09 0x09 ASDFF 0x09 XCVB0 x0D 0x0A - looks better, but you need to remember the spaces will appear as 0x20, and not as a space in the data stream.

I'm not sure I will ever be sending non-printable characters out, so you have carte blanche on how this is going to work :D

graynomad

I think you need a few options because some formats are appropriate for some data, others for other data.

If you think of the right side of a standard HEX/ASCII dump, all non-printable chars are shown as dots, if you are primarily interested in printable chars that's a very clear format. Apart from that you have to have an option with dots or something I think because beginners print from say 0 to 30 (dec) and wonder why nothing appears on the screen. Of course that assumes that they know enough to select that mode in the first place :)

If you want to show the HEX of non-printables then I think your second example is probably best. This would be good if dumping the characters going to say an LCD where there will be control chars amongst the printed chars. Once you've debugged the control stuff maybe the .. option is better so you can see that they are there but you no longer have much interest in their actual value.

At other times simple aligned columns of HEX numbers (with no 0x) or decimal is appropriate. All zero-padded of course.

And there are probably other formats that make sense as well.

I don't think there's any value in showing the chars above 127 as they are system dependant and unlikely to be used in an Arduino (I would think), after all you just show the chars for the selected font in the terminal prog.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

aarondc

I'll think about it some more then. Too late to implement anything solid now ;-)

graynomad

Yep, you're on the same time as me, 2AM now.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up