chipKIT® Development Platform

Inspired by Arduino™

New ASCII table.. 'A' does not equal DEC 65

Created Mon, 09 Jan 2012 21:52:57 +0000 by gnomishworks


gnomishworks

Mon, 09 Jan 2012 21:52:57 +0000

Here's the code:

void setup() { // initialize both serial ports: Serial.begin(9600); Serial1.begin(9600); }

void loop() { // read from port 1, send to port 0: if (Serial1.available()) { int inByte = Serial1.read(); Serial.println(inByte); Serial.println(inByte, DEC); Serial.println(inByte, BYTE); } }

I verified that I am receiving 'A' using Hyperterm directly from a serial keyboard. In the Arduino COM app connected to "Serial" I get:

Serial.println(inByte); = 95 Serial.println(inByte, DEC); = 95 Serial.println(inByte, BYTE); = _

What gives?


majenko

Mon, 09 Jan 2012 22:11:28 +0000

What are you connecting to Serial1, and how are you connecting it?


gnomishworks

Mon, 09 Jan 2012 22:37:37 +0000

Using a HAGSTOM KE24 which is a programmable keyboard emulator that has keyboard and RS232 output. (MAX232 chip on the board). I am connecting it to serial1 with 9600, 8, 1, none.

The HASTROM does sends out ASCII characters and I verified it sending 'A' with Hyperterminal.


majenko

Mon, 09 Jan 2012 23:03:36 +0000

Does this keyboard thing output RS-232 or TTL voltage levels? If the former, are you feeding it via a MAX232 or similar, and if the latter, are you sure you have the signal polarity correct?


gnomishworks

Mon, 09 Jan 2012 23:09:06 +0000

Think I found out I am using RS232 so I will find a TTL convert.

Thanks


les1943

Tue, 10 Jan 2012 09:27:23 +0000

RS232 levels are -9v to +9v you may have killed serial1 pins...these are +5v tolerant