Shop OBEX P1 Docs P2 Docs Learn Events
Serial LCD Help — Parallax Forums

Serial LCD Help

TtailspinTtailspin Posts: 1,326
edited 2011-02-08 20:12 in Propeller 1
This is probably going to be one of those "this stuff is so easy, it's hard" kind of questions,

I am using..
Serial LCD 2X16 using the Serial_LCD_Demo.spin from the OBEX, work's just fine,
The LCD Demo uses FullDuplexSerial

Nintendo64 Joystick using the N64_v1.2.spin from the OBEX. also work's just fine
The N64 test uses TV_Text.

FullDuplexSerial and TV_Text have the same public method block's named "PUB bin"
Both PUB bin's are identical.

It Looked like it would be a no brainer to display Joystick button states on the LCD using FullDuplexSerial.

But, I am missing something, it is not working as expected, and I am not sure what I am looking for.

All I get is 0's for the Joystick states displayed on the LCD.
I can make the display look like I want, but the Button states never change.

AB LR Z S
00 00 0 0 <<< these binary numbers don't change when I push the buttons on the Joystick.

Here is what I am trying to make work..
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  TX_PIN        = 15
  BAUD          = 19_200
 
OBJ
  LCD           : "FullDuplexSerial.spin"
  N64           : "N64_v1.2"
PUB Main
  LCD.start(TX_PIN, TX_PIN, %1000, 19_200)     'Set pins, mode, and buad rate for LCD
  waitcnt(clkfreq / 100 + cnt)                 'Pause for FullDuplexSerial.spin to initialize
  LCD.tx(22)                                   'Turn on Display
  LCD.tx(17)                                   'Turn on Backlight 
 
repeat  
  LCD.tx(12)                                   'Form Feed, cursor to Row_0-Column_0, clear Display, must pause 5ms 
  waitcnt(clkfreq / 100 + cnt)                 'Pause for minimum of 5ms to allow LCD to settle
 
  LCD.str(string("AB LR Z S     "))            'Print Button Labels on top row
 
  LCD.tx(148)                                  'Move cursor to Posisition :Row1, Column0
 
  LCD.bin(N64.A, 1)                            'Display state of Joystick button :A
  waitcnt(clkfreq / 50 + cnt)                  'Pause
 
  LCD.bin(N64.B, 1)                            'Display state of Joystick button :B
  LCD.tx(9)                                    'Move cursor right one  
  waitcnt(clkfreq / 50 + cnt)                  'Pause
 
  LCD.bin(N64.L, 1)                            'Display state of Joystick button :L
  waitcnt(clkfreq / 50 + cnt)                  'Pause
 ect..ect..
Thank You for Your time in this.:smile:

Comments

  • TtailspinTtailspin Posts: 1,326
    edited 2011-02-08 16:08
    Never Mind... it turns out, not only do You have to "declare" the object, You must also START the object.

    I am telling You, this stuff is so easy, it's hard...
    OBJ
      LCD           : "FullDuplexSerial.spin"
      N64           : "N64_v1.2"  ' "Declare" the object
    PUB Main
     <<<< add this line if You actually want to USE the object >>>>
      N64.start(17)     'START up the N64 Joystick  
     
      LCD.start(TX_PIN, TX_PIN, %1000, BAUD)     'Set pins, mode, and buad rate for LCD
      waitcnt(clkfreq / 100 + cnt)                 'Pause for FullDuplexSerial.spin to initialize
     
    

    Well that was fun...
    You may now continue with Your regular scheduled programing, thank you, please keep the snickering to a minimum please...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-02-08 20:12
    Don't feel bad... Did the "exact" thing the other night.. Was trying to figure out why on earth the 'float.spin' object wasn't working.. yup... Forgot to start it.

    OBC
Sign In or Register to comment.