Shop OBEX P1 Docs P2 Docs Learn Events
Custom Characters BenkyLCDdriver — Parallax Forums

Custom Characters BenkyLCDdriver

coryco2coryco2 Posts: 107
edited 2013-11-20 20:37 in Propeller 1
Does anyone have some demo code for setting and displaying custom characters using the BenkyLCDdriver? I tried this way, but it just displays eight characters from the DAT array instead of setting the custom character. What am I missing?
CON

  _clkmode = xtal1 + pll16x                      ' System clock settings
  _xinfreq = 5_000_000

  LCDBasePin    = 1

OBJ
  LCD: "BenkyLCDdriver"                        'Declare LCD display driver

VAR

  LONG maxT                         ' Variable used by LCD driver    
  
PUB Main


  LCD.start( LCDBasePin,0 )                      ' Start LCD Display
  maxT:=LCD.getMax
  waitcnt(clkfreq + cnt)                          ' Wait 1 s before starting

  LCD.exec( LCD#CMD_SETCHAR, @custom1)
  repeat
  

DAT

        custom1   byte    111[8], 0

BenkyLCDdriver.spin

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2013-11-19 21:08
    One of the demos packed with the driver shows a small image and then some bar graphs. This is done with custom characters.
  • MagIO2MagIO2 Posts: 2,243
    edited 2013-11-19 21:42
    Well, actually i found it in all the demos ;o)
      ' Init some special characters
      LCD.exec( LCD#CMD_INSTR, %01000000 ) ' set the character RAM address to 0
      LCD.exec( LCD#CMD_SETCHAR, @char1 )  ' Power plug
      LCD.exec( LCD#CMD_SETCHAR, @char2 )  ' Rails
    
    ... where char1 and char2 are 8 byte arrays containing the character data.
  • MagIO2MagIO2 Posts: 2,243
    edited 2013-11-20 12:03
    If you want to change individual characters at different occasions, you'd set the character ram address to a value different than %000000 (the 6 least significant bits in the first exec in the example above).
    LCD.exec( LCD#CMD_INSTR, %01000000 + charNumber * 8 )
    with a charNumber between 0 and 7 and then send 8 bytes with the LCD#CMD_SETCHAR command. With each byte sent to the display the cgram pointer is increased automatically. So, after writing one character the pointer points to the next character.
  • coryco2coryco2 Posts: 107
    edited 2013-11-20 19:15
    @MagIO2

    Thanks for replies! Sorry, I misplaced the demos for driver and wasn't able to find it on the OBEX any more (?) Could you please post the demo or complete driver archive or direct me to where it is on the OBEX now?
  • MagIO2MagIO2 Posts: 2,243
    edited 2013-11-20 20:37
    You are welcome! It is here
    http://obex.parallax.com/object/270
Sign In or Register to comment.