Pages: [1]   Go Down
Author Topic: ASCII/character table  (Read 1295 times)
0 Members and 1 Guest are viewing this topic.
Houston, Texas, USA
Offline Offline
Full Member
***
Karma: 2
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"Corrections, suggestions, and new documentation should be posted to the Forum."

I would like to suggest adding a ASCII/character table to the Arduino reference guide. As this guide is downloaded/include in the installation pack it would be convenient to included rahter than having to look one up on the internet somewhere. I offer the attached as a starting point.
  ASCII_Table.xlsx used to generate table
  ASCII_Table.htm single page html document (entire table)
  ASCII_Table.pdf Acrobat file (2 pages)
  ASCII_Table_001-1127.PNG codes 1 to 127
  ASCII_Table_128-255.PNG   codes 128-255

Tables include Binary (in two nibbles), Hex, Decimal and escape codes.
Extended codes (128-255) are from MS Linedraw (replicates MS DOS page).



* ASCII_Table_001-1127.PNG (174.64 KB, 1771x789 - viewed 85 times.)

* ASCII_Table_128-255.PNG (171.32 KB, 1777x808 - viewed 58 times.)
* ASCII_Table.ZIP (444.79 KB - downloaded 28 times.)
« Last Edit: August 23, 2013, 09:19:06 am by lewtwo » Logged

engineering is the art of planning and forethought
http://www.keywild.com

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13477
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

only one image attached..

ASCII tables above 128 differ quite a bit, e.g. depending on country code keyboard, so how many should be added?


Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Sr. Member
****
Karma: 4
Posts: 327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

any is better than none,

why not the basic one, and a note about localisum,
   after all, the guide is for starters,
     
lets not complicate ..
Logged

Houston, Texas, USA
Offline Offline
Full Member
***
Karma: 2
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In fact ASCII does NOT define codes above decimal 127 (ref:  http://en.wikipedia.org/wiki/ASCII)

The second page I chose is code page 437 that was used by MS DOS. I used the "MS Linedraw" font to represent it. .
(ref: http://en.wikipedia.org/wiki/Code_page_437)
This is noted at the top of the page for the second half of the table (128-256).
Most of these codes still work at the DOS command prompt and are still supported by a few compilers like FreeBasic.
Logged

engineering is the art of planning and forethought
http://www.keywild.com

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26322
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

www.asciitable.com,
I just look it up when needed, easier than trying to find it within the myriad of info hosted at arduino.cc
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Houston, Texas, USA
Offline Offline
Full Member
***
Karma: 2
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

only one image attached..

I screwed up (again). Sorry 'bout that ... smiley-sad-blue
I have added the files to the first post.
Logged

engineering is the art of planning and forethought
http://www.keywild.com

Houston, Texas, USA
Offline Offline
Full Member
***
Karma: 2
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

www.asciitable.com,
I just look it up when needed, easier than trying to find it within the myriad of info hosted at arduino.cc

I was doing that ... but my internet connection is wireless and sometimes is is also connectionless. smiley-roll
My local Arduino reference index now has the html ASCII added.
I just thought it might be helpful for those individuals that are just starting in the Arduino environment.
From the number of posts you have I suspect you have been around for a while .... yes ???
Logged

engineering is the art of planning and forethought
http://www.keywild.com

Houston, Texas, USA
Offline Offline
Full Member
***
Karma: 2
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just noted that the reference page for "char" (Char.html) has a link to "ASCII chart" (ASCIIchart.html).

Characters are stored as numbers however. You can see the specific encoding in the ASCII chart. This means that it is possible to do arithmetic on characters, in which the ASCII value of the character is used (e.g. 'A' + 1 has the value 66, since the ASCII value of the capital letter A is 65). See Serial.println reference for more on how characters are translated to numbers.


The on-line version of the reference includes that page.
The one in the installation package does not.

Also i note that the reference includes this paragraph:
The char datatype is a signed type, meaning that it encodes numbers from -128 to 127. For an unsigned, one-byte (8 bit) data type, use the byte data type.

So decimal values on the second page should all be negative, yes ??
Somehow that just does not seem right.
Code:
void setup()
{ char buffer[34];
  
  Serial.begin (9600);
  for (int i= 192; i< (224); i++)
    { Serial.print(char(i));
    }
  Serial.println("");  
  
  Serial.println("================================");
  for (int i= -64; i< -32; i++)
    { Serial.print(char(i));
    }
  Serial.println("");  
  
  Serial.println("================================");
  for (int i= 0; i<32; i++)
    { buffer[i]= (192+i & 0xFF);
      Serial.print("  ");
    }
  buffer[32]=0;
  Serial.println(buffer);
  Serial.println(buffer[31],DEC);

//  Serial.println("================================");
//  for (int i= 0; i<32; i++)
//    { buffer[i]= (-64+i & 0xFF);
//    }
//  buffer[32]=0;
//  Serial.println(buffer);
  
  for (int i= 0; i<8; i++)
    { Serial.print(buffer[i], DEC);
      Serial.print(" ");
    }
  Serial.println("");
  for (int i= 0; i<8; i++)
    { Serial.print(buffer[i], HEX);
      Serial.print(" ");
    }
  Serial.println("");
  for (int i= 0; i<8; i++)
    { Serial.print(buffer[i], BIN);
      Serial.print(" ");
    }
  Serial.println("");

}

void loop(){;} //nada
I will be darned if I can tell the difference but they all do come back as negative.
This has something to do with char values over 127 wrapping back around to the negative side , yes ??
Logged

engineering is the art of planning and forethought
http://www.keywild.com

Pages: [1]   Go Up
Jump to: