Shop OBEX P1 Docs P2 Docs Learn Events
SEROUT problem with Sparkfun Serial LCD? — Parallax Forums

SEROUT problem with Sparkfun Serial LCD?

MorrolanMorrolan Posts: 98
edited 2009-10-17 23:55 in BASIC Stamp
Hi,

I'm having a problem using the SEROUT command with a Sparkfun serial LCD 16x2.

The Datasheet says that in order to write a custom boot splash screen, set the display how I want it, then send the 'special' control character 0x7C (dec 124) followed by "<control>j".

I have no problem sending any other of the commands or displaying text but I don't understand what it means by "<control>j".

Doing:

SEROUT 10, LcdBaud, [noparse][[/noparse]$7C, "<control>j"]



Simply displays <control>j on the LCD?

Datasheet can be found here: www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF

Has anyone else come across this or could anyone please shed some light on the subject?

Many Thanks in advance,
Morrolan

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Flying is simple. You just throw yourself at the ground and miss.

"I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image."
Stephen Hawking

Comments

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2009-10-17 22:16
    Here is a little program I used to set the splash screen
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    lcd   PIN 4
    lcdCom      CON  $FE  'command prefix
    lcdCom2     CON  $7C  'special command prefix
    clrLCD      CON  $01  'Clear entire LCD screen
    displayOff  CON  $08  'Display off
    displayOn   CON  $0C  'Display ON
    noCurs      CON  $0C  'Make cursor invisible
    ulCurs      CON  $0E  'Show underline cursor
    blkCurs     CON  $0D  'Show blinking block cursor
    curpos      CON  $80  'set cursor  + position  (row 1=0 TO 15, row 2 = 64 TO 79)
    scrollRight CON  $1C
    scrollLeft  CON  $18
    curRight    CON  $14
    curLeft     CON  $10
    #SELECT $STAMP                          ' Select Baud constants
      #CASE BS2, BS2E, BS2PE
        T1200       CON     813
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
      #CASE BS2SX, BS2P
        T1200       CON     2063
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
      #CASE BS2PX
        T1200       CON     3313
        T2400       CON     1646
        T4800       CON     813
        T9600       CON     396
        T19K2       CON     188
    #ENDSELECT
    PAUSE 500
    SEROUT lcd, T9600, [noparse][[/noparse]lcdcom, clrLCD]
    SEROUT lcd, T9600, [noparse][[/noparse]lcdcom, curpos+6, "First", lcdcom, curpos+68, "LastName"]
    SEROUT lcd, T9600, [noparse][[/noparse]lcdcom2, $0A] 'ctrl-j
    
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-17 22:21
    The control codes are those bytes in the range $00 - $1F. When someone writes <control>j or Control-J or ^J or any of a variety of similar notations, they mean for you to send the control code corresponding to the letter J or j. The simplest way to do this is to write $1F & "J" and the compiler will translate that into the appropriate code to send. <control>@ is $00, <control>A is $01, <control>Z is $1A, so <control>J is really $0A.
  • MorrolanMorrolan Posts: 98
    edited 2009-10-17 23:55
    Ahhh, and here was me over-complicating things by thinking I had to send something else, instead of just $7C followed by $0A!

    Many Thanks,
    Morrolan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Flying is simple. You just throw yourself at the ground and miss.

    "I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image."
    Stephen Hawking
Sign In or Register to comment.