TextStar Display

Hi there,

Recently I have been playing with a TestStar Display and found them pretty good. I found a page on this forum (http://forum.arduino.cc/index.php?topic=22628.0) showing some code that was a bit outdated. So I have modified it and added it below.

#include <SoftwareSerial.h>

SoftwareSerial serial_lcd(10,9); //rx tx
void serial_lcd_writeline(int linenum);
void serial_lcd_showline(int linenum);
void serial_lcd_init();

void setup() {
  serial_lcd.begin(9600);
  
    serial_lcd_init();
    serial_lcd.println("Hello World");
    serial_lcd_writeline(2);
    serial_lcd.println("Line 2");
    serial_lcd_showline(1);
    
    delay(3000);
    
    serial_lcd_showline(3);
    serial_lcd.println("Line 3");
    serial_lcd_showline(2);
    
    delay(3000);
}

void loop() {

}

void serial_lcd_init() {
  delay(2500);
  
  serial_lcd.write(12);
  
  serial_lcd.write((byte)254);
  serial_lcd.write((byte)67);
  serial_lcd.write((byte)4);
}

void serial_lcd_writeline(int linenum) {
  serial_lcd.write((byte)254);
  serial_lcd.write((byte)76);
  serial_lcd.write((byte)linenum);
}

void serial_lcd_showline(int linenum) {
  serial_lcd.write((byte)254);
  serial_lcd.write((byte)71);
  serial_lcd.write((byte)linenum);
}

The changes I made are basically due to the BYTE operator not being supported anymore since v1.0,. meaning you have to use the write function instead.

If anyone knows of any info on how to read from the buttons on this display that would be much appreciated? I would also like to know more about the reasons for connecting with TTL or RS232 (advantages and disadvantages) and how to implement. I have read somewhere that the arduino uno does not have a true RS232 output is the correct? Any links to places to read about these topics would be awesome, I will keep looking into it myself in the mean time though.

Thanks

Mash

Hi.

TextStar or TestStar (you mentioned both) doesn't ring a bell to me. Is that a type or a brand ? In case it is a brand, then what type are you talking about ? Do you have a picture, and can you show that (or a link to it).

An Arduino has a TTL level RS232 port, and just RX and TX. Handshaking and such stuff aren't there (initially i typed "are missing", but who misses those ?). This has a very simple reason: You only need a standard port which can also be used for other purposes, ad you will save a dedicated port with some additional level shifting hardware.

So if you need a real RS232 port, you'd have to add that piece of hardware yourself. That would be a MAX232 (or some derivate) and supporting components, of which some 4 capacitors (acting as charge pumps) are the most important ones. Google MAX232 for 5 volt level or MAX2323 for 3 volt level, you'll find lots of information.

Hey,
First off I wanted to thank you for posting your code. I have been banging away at updating that old demo code and didn’t realise the difference between print and write.

I am not sure if this helps but I was using this code to debug what to send to the TextStar. When I run it and press a button i get Aa Bb Cc Dd for each button respectively.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup (){
// print to laptop
 Serial.begin(9600);
 Serial.println("Arduino & TextStar LCD example");
 mySerial.begin(9600);
 mySerial.println("Hello, world?");
}

void loop (){ 
 if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());                    
}

The data sheet says:
Defining Keys
When they are pressed and released, each of the four keys on the module can send bytes of
data/ASCII characters via the Transmit (Tx) port to an attached device. For example, in the
module’s default state, when pressed the top left-hand key sends the ASCII letter ‘A’. When it is
released, it sends the letter ‘a’. In the same way, the bottom left-hand, top right-hand and bottom
right-hand keys will send ‘Bb’, ‘Cc’ and ‘Dd’ respectively. This can be tested by connecting the Tx
line to the Rx line on the module which will then display any characters that are sent.
The characters sent by each key can be redefined from the setup menu to any value between 0 and
255 or can be set to ‘None’ in which case no value will be assigned to that action. The assigned
values are also used by the ‘Send Key States’ command (254,‘K’) which uses them to transmit the
current key states to an attached device. This allows an attached device to determine which keys
are being pressed if required. The default assignment is ‘AaBbCcDd’ so if none of the keys are
being pressed, the command 254,‘K’ will result in a reply of ‘abcd’. If the top left-hand key is being
pressed then 254,‘K’ will result in a reply of ‘Abcd’.