Sending HEX values over Serial

Hi,

I'm trying to control an old Vacuum Florescent display (2x20 char) module.
It talks 4800-8-N-2. (Note the 2 stop bits)

Everything Looks correct, except when I try to send 0x13,...... it does not reply!
It suppose to go scroll mode,...... but nothing!!

Below is the code I'm using

void setup() {
  Serial.begin(9600);
  Serial1.begin(4800, SERIAL_8N2);
  Serial1.write(0x13);//Scroll Mode
  Serial1.write(0x00);//Select Line 1
  Serial1.write(0x01);//Line clear
  Serial1.print("Testing.....abcdefghijklmnopq");
  Serial1.write(0x02);//Select Line 2
  Serial1.write(0x01);//Line clear
  Serial1.print("Hello..abcdefghijklmnopq");
}

void loop() {
}

When I hook up to PC and have CoolTerm send 0x13 as a HEX, the display does goes to Scroll Mode with no issues.

Why cant Arduino can do what the CoolTerm does?

Thanks

When you say that you send 0x13 do you mean that you send one byte with the value 0x13 or a literal “13” ?

With CoolTerm?
Yes It's one byte with the value of 13.
Thnaks

0x0D (decimal 13) is an ASCII carriage return character and 0x0A decimal 10) is an ASCII line feed. Some terminals only work with text and take both of these to be the end of line so may not echo them. Some just treat one as end of line and ignore the other. If, as you seem to be, you are sending binary data then both your sender and receiver need to be configured to handle binary data and not treat the data as text. Looks as though the Serial class just ignores carriage return; you need to look at the Serial class source code.

Sorry if I was not clear.
But it's the Hex 0x13 or Decimal 19.
In ASCII table the name given for this character is "Device Control 3".

Why cant Arduino can do what the CoolTerm does?

It can, it can do exactly what CoolTerm can do. However you have to know what CoolTerm actually does. I suspect it is sending more than just the one byte.
Try writing a sketch that just reads serial data and prints out the ASCII of the bytes it sends. My bet is that their is a LF or CR in there as well.

have CoolTerm send 0x13 as a HEX,

You are sending binary values. HEX is a human readable representation of a binary value.

If sending just that byte works with CoolTerm and not with the Arduino, there is something wrong with the Arduino code, which you forgot to post. Please use code tags.

I have the full code on my first post.
Line number 4 is where the problem is.
"Scroll mode"
Everything else work without any problem
Thanks

What about a pointer to the datasheet? so we can see how the device is supposed to work.

The display might not be ready so quickly after power up.

Try a short delay after Serial1.begin(), or send an extra byte or two before the 0x13.

Attached is the manual.
Check section 4.2.1

Thanks

S36522_01_REVA.pdf (546 KB)

jremington:
The display might not be ready so quickly after power up.

Try a short delay after Serial1.begin(), or send an extra byte or two before the 0x13.

I tried the delay. But no avail.

My guess would be that the 01 command is resetting things so the DC3 scroll mode is lost as it says "DC1 mode is selected"

You could try moving the 13 command after the other commands.

--- bill

Yes that was the problem.

Guess I didn't read the manual well.

When resetting the line the module goes back to DC1 mode....Duh

Its working now.

Thanks you so much