Shop OBEX P1 Docs P2 Docs Learn Events
Comments and suggestions for improvement of demo object — Parallax Forums

Comments and suggestions for improvement of demo object

average joeaverage joe Posts: 795
edited 2012-05-14 00:22 in Propeller 1
Hi Everyone!
I have just finished translating the EarthLCD - ezLCD 301 app note for the BS2 into SPIN and I am looking for comments and suggestions for improvement. I intend on posting this in the OBEX when finished and would like this object to be self-explanatory and easy to use. The object is thoroughly tested and works like a charm. Any help would be appreciated!
{{
''********************************************
''*  ezLCD-301 application note from bs2     *
''*  Author:                                 *
''*  Translated to SPIN by Joe Heinz         *
''*  Copyright (c) 2012 EarthLCD.com         *
''*  See end of file for terms of use.       *
''********************************************
}}
{-----------------REVISION HISTORY-----------------
 v1.0 - x/x/2012 first official release.
}
     ezLCDtx     = 1                                         'The ezLCD tx pin (RX pin on prop)                                 , change as needed
     ezLCDrx     = 0                                         'The ezLCD rx pin (TX pin on prop)                                 , change as needed
     ezLCDbaud   = 9600                                      'the ezLCD baud-rate                                               , change as needed
     pinOut      = 22                                        'This is the pin to toggle on and off                              , change as needed
     pstBaud     = 115200                                    'This is the baud-rate for Parallax Serial Terminal Debugger       , change as needed
     
VAR
 byte serStr[6], idx, c                                                        'define a 6-byte string array for storing the data received from ezLCD  

OBJ serial : "FullDuplexSerial"                                                'This object does the actual serial communication with the display   *Thanks Chip Gracey, Jeff Martin
    wait   : "timing"                                                          'This object is for simple timing                                    *Thanks Parallax
    pst    : "parallax serial terminal"                                        'This object is for debugging to PC, comment out if not used         *Thanks Jeff Martin, Andy Lindsay, Chip Gracey
    
PUB BOOT                                                                       ''This method runs at startup
serial.start(ezLCDrx,ezLCDtx, 0, ezLCDbaud)                                    'Start fullDuplex serial driver with ezLCD pins @ ezLCDbaud, mode 0. Returns false if no cog available.
pst.start(pstBaud)                                                             'Start Parallax Serial Terminal @ pstBaud, comment out if used
dira[pinOut] ++                                                                'Make pinOut an output

serial.str(string("cls black"))                                                'Clears the display to black
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("theme 1 9 3 0 0 0 8 8 8 8"))                                'Defines Theme 1 for button 1
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("theme 2 5 20 3 3 3 4 4 4 4"))                               'Defines Theme 2 for button 2
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("fontw 1 sans72"))                                           'define font for button 1 widget
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("fontw 2 sans72"))                                           'defines font for button widget 2
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("string 1 ON"))                                              'defines string for button 1
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("string 2 OFF"))                                             'defines string for button2
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("button 1 10 40 185 140 1 0 25 1 1"))                        'defines button 1                   
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1ms(10)                                                              'Wait 10ms

serial.str(string("button 2 205 40 185 140 1 0 25 2 2"))                       'defines button 2
CR_LF                                                                          'Send Carriage Return + Line Feed

wait.pause1s(3)                                                                'Wait 3 Seconds for ezLCD to finish sending feedback about it's displays

serial.rxflush                                                                 'Clear serial receive buffer
pst.clear                                                                      'Clear parallax Serial Terminal, comment out if not used

'   Main Loop starts here
repeat                                                                         'Repeat loop starts here
  idx ~                                                                        'Clear idx
  repeat while (c:= serial.rx) <> 13                                           'Copy serial receive buffer into c and repeat until Carriage Return is received,  CR signifies end of string from display 
      serStr[idx++] := c                                                       'Move receive buffer into serStr then increment idx, 
  serStr[idx] ~                                                                'Set last byte to 0, for 0 terminated string to Parallax Serial Terminal
  pst.str(@serStr)                                                             'Send serStr to Parallax serial Terminal, comment out if not used
  pst.newline                                                                  'Send newline to Parallax Serial Terminal, comment out if not used
  if serStr[0] == "B" and serStr[1] == "P" and serStr[2] == "1"                'If received data is BP1 which means button 1 pressed
    outa[pinOut] := 1                                                            'then set pinOut high 
  if serStr[0] == "B" and serStr[1] == "P" and serStr[2] == "2"                'If received data is BP2 which means button 2 pressed 
    outa[pinOut] ~                                                               'then set pinOut low
serial.rxflush                                                                 'clear serial receive buffer for next iteration
bytefill(@serStr,6,0)                                                          'clear serString for next iteration

PUB CR_LF                                                                      ''Send Carriage Return + Line Feed
serial.tx(13)                                                                  ' Send Carriage Return to display
serial.tx(10)                                                                  ' Send Line Feed to display

Comments

  • average joeaverage joe Posts: 795
    edited 2012-05-13 22:33
    Sorry to bump this post but I am getting ready to release the above code and want to get it to "obex standard." There needs to be some documentation added to the beginning of this. I could also use some help understanding the process of releasing an object. *and maintaining a post related to the object!*

    I am also working on a low-level driver for the ez-lcd301 and been getting stuck. The object basically parses space-delimited, ASCII commands and parameters to something a bit easier to work with in spin. I keep getting strange errors with the returns and can't quite figure out what's going on. Full object :
    ''********************************************************************************************************************************************
    ''*  ezLCD-301 driver fro EarthLCD.com                                                                                                       *
    ''*  Author: Joe Heinz                                                                                                                       *
    ''*  Copyright (c) 2012 EarthLCD.com                                                                                                         *
    ''*  See end of file for terms of use.                                                                                                       *                        
    ''********************************************************************************************************************************************
    '' documentation fix... PG 33, progress {id}{x}{y}{Width}{Height}{options}{max}{value}{theme} should read
    ''                                      {id}{x}{y}{Width}{Height}{options}{value}{max}{theme}   
    ''############################################################################################################################################
    
    {-----------------REVISION HISTORY-----------------
     v0.0 - x/x/2012 first official release.
    }
    
    CON
    ''############################################################################################################################################
    ''#                          Full Duplex Serial Settings                                                                                     #                                                 #
    ''#                                                                                                                                          #
    ''#    LCDtx      = 1          Set this to match the ezLCD tx pin (RX pin on prop)                                                           #
    ''#    LCDrx      = 0          Set this to match the ezLCD rx pin (TX pin on prop)                                                           #
    ''#    LCDbaud    = 67500     Change this to match the intended baudrate to the display                                                     #
    ''#                                                                                                                                          #
    ''#                                                                                                                                          #
    ''#                                                                                                                                          #
    ''############################################################################################################################################
    ''#                              Command Table                                                                                               #
    ''#                                                                                                                                          #
      rst     = 29                                                  'Reset      command
      clsc    = 2                                                   'Clear      command
      png     = 3                                                   'Ping       command
      vrb     = 106                                                 'Verbose    command
      bri     = 5                                                   'Brightness command
      col     = 6                                                   'Color      command
      colid   = 7                                                   'Color ID   command
      fnt     = 10                                                  'Font       command
      fntw    = 11                                                  'Fontw      command
      fnto    = 12                                                  'Fonto      command
      thresh  = 105                                                 'Threshold  command
      lnw     = 13                                                  'LineWidth  command
      lntyp   = 14                                                  'LineType   command
      xycmd   = 15                                                  'XY         command
      xyidcmd = 41                                                  'XY ID      command
      strcmd  = 16                                                  'String     command
      plotcmd = 17                                                  'Plot       command
      linecmd = 18                                                  'Line       command
      boxcmd  = 19
      circmd  = 20
      arccmd  = 21
      piecmd  = 22
      piccmd  = 24
      prntcmd = 25
      clpen   = 46
      clpar   = 47
      rcd     = 30
      ply     = 31
      stp     = 32
      wt      = 102
      pse     = 33
      lp      = 34
      spd     = 35
      dl      = 58
      rn      = 57
      chd     = 52
      mkd     = 53
      rmd     = 58
      rmod    = 54
      morecmd = 59
      cp      = 56
      dircmd  = 55
      fmt     = 60
      sct     = 40
      cm      = 62
      cfi     = 37
      iocmd   = 38
      cwdcmd  = 51
       
      
    ''#                                                                                                                                          #
    ''############################################################################################################################################
    ''#                            General Settings                                                                                                              #
    
       LT = 13
       buffersize = 65
    
    ''#                                                                                                                                          #
    ''############################################################################################################################################
    ''#                                                                                                                                          #
       
    VAR 
     long bufferAddress                                                             '
        byte incoming[buffersize]
    OBJ serial : "FullDuplexSerial"                                      'This object does the actual serial communication with the display
    
    PUB null                                                             'not a top level object
    
    PUB INIT(LCDtx,LCDrx,LCDbaud,BufferPointer)                                      '' Start ezLCD 30x driver, Returns the COG number of FullDuplexSerial or False if no cog available
    result := serial.start(LCDrx,LCDtx, 0, LCDbaud)                                    'Start fullDuplex serial driver with ezLCD pins @ ezLCDbaud, mode 0. Returns false if no cog available. 
      bufferAddress := BufferPointer                                                    'copy buffer address to main memory
    PUB RESET                                                                        '' Reset ezLCD as if it was just turned on
    LCD_CMD(rst)                                                                       'send reset command to display
    
    PUB CLS(c)                                                                       '' Clear display to color and clear widgets 
      ifnot c < 200 and c > -1                                                          'check to make sure color is valid, 0 - 199
        c := 0                                                                           'if not set c = 0
    LCD_CMD1(clsc,c)                                                                   'send CLS command to display with color
    
    PUB PING                                                                         '' Asks LCD to send acknowledge with pong, Returns the response from the display
    LCD_CMD(png)                                                                        'send "PING" command to display
    
    result := serial.rx - 48                                                                 'return lcd response
    
    
    
    PUB LIGHT(brightness)                                                            '' Set backlight level to brightness when 0 - 100 (as percent)  *default is 75%. If brightness = -1, returns the current brightness as ASCII 0-terminated STRING to buffer in main memory 
       if brightness > -1 and brightness < 101                                          'check to make sure brightness is between 0 and 100 (as percent)
         LCD_CMD1(bri,brightness)                                                         'send "LIGHT" command to display with brightness
       elseif brightness == -1                                                          'if brightness = -1
         LCD_CMD(bri)                                                                     'send "LIGHT" command
    
         result := GetString                                                              'pass string to buffer in main memory and set result to string size
    
    
    
    '          ***  Tested OK   ***
    '_________________________________________________________________________________
    
    
    
    PUB COLOR(CID)                                                              '' Set current color to COLORID (0 - 199). If CID = -1, Returns current color to buffer in main memory and set result to string size. Returns 0 if good, -1 if incorrect color is given 
      if CID < 200 and CID > -1                                                         'if CID = (0 - 199)
        LCD_CMD1(col,CID)                                                                   'send "COLOR" command to display with "c"        
      elseif CID == -1                                                                  'if CID = -1
        'LCD_CMD(col)                                                                      'send "COLOR" command to display
    
        serial.dec(6)                                                    'send "cmd" command to display
        CR_LF                                                              'send CR + LF to display
    
        
        result := GetString                                                               'pass string to buffer in main memory and set result to string size
      else                                                                              'otherwise
       result := -1                                                                       'set result to -1
    
    PUB COLORID(index,R,G,B)                                                         '' Set COLORID[index] to RGB value. IF R = -1, Returns the color values of COLORID[index]        
     if R == -1                                                                         'if r = -1
       LCD_CMD1(colid, index)                                                                 'send "COLORID" command to display
       result := GetString                                                                'pass string to buffer in main memory and set result to string size 
     else                                                                               'otherwise
       LCD_CMD4(colid,index,R,G,B)                                                        'send "COLORID" command to display with "index" , "R" , "G" , "B"
       
    
                               '' 
    PUB FONTi(f)                                                                     '' Use internal font (factory)  "f",  currently 0 and 2 = default medium font
        LCD_CMD1(fnt,f)                                                                 'send "FONT" command to display with "f" to display
        
    PUB FONTp(fontNamePointer)                                                       '' Use programmable font (ezf file) from flash drive
        LCD_STR(fnt,fontNamePointer)                                                    'send "FONT" command to display with "fontName" @ Pointer
        
    
    
    
    PUB FONTw(index,fontNamePointer)                                                 '' Use programmable widget font (ezf file) from flash drive for each of 16 themes
       if index <> -1
         LCD_D_S(fntw,index,fontNamePointer)                                               'send "FONTW" command to display with "index" and  "fontName" @ Pointer   
       else
         LCD_CMD(fntw)                                                                    'send "FONTO" command to display
         result := serial.rx  - 48                                                            'get font orientation from display, and return it as the result  
       
    PUB FONTo(orientation)                                                           '' Set font orientation, 0 = Horizontal, 1 = Vertical. Other to Return Font orientation  
      if orientation == 0 or orientation == 1                                           'If orientation is 0 or 1                                           
        LCD_CMD1(fnto,orientation)                                                        'send "FONTO" command to display with "orientation"  
         result := serial.rx  - 48
      else                                                                              'If orientation is NOT 0 or 1 
         LCD_CMD(fnto)                                                                    'send "FONTO" command to display
         result := serial.rx  - 48                                                            'get font orientation from display, and return it as the result
         
                             
    PUB THRESHOLD(value)                                                             '' Set the value used for sensitivity of touch display, Default is 256
      if value <> -1                                                                    'if value <> -1
        LCD_CMD1(thresh,value)                                                            'send "THRESHOLD" command to display with "value"
      else                                                                              'otherwise
        LCD_CMD(thresh)                                                                   'send "THRESHOLD" command to display 
        result := GetString                                                         'set result 
        
    PUB LINEWIDTH(pixel)                                                             '' Sets line width to pixel width. 1 or 3 pixels wide. If invalid pixel width is passed, Returns line width from display 
      if pixel == 1 and pixel == 3                                                      'check for valid pixel width
        LCD_CMD1(lnw,pixel)                                                               'send "LINEWIDTH" command to display with "pixel"
      else                                                                              'invalid pixel width returns current pixel width 
        LCD_CMD(lnw)                                                                      'send "LINEWIDTH" command to display
        result := serial.rx - 48                                                              'get "pixel" from display, and return it as the result
        
    PUB LINETYPE(type)                                                               '' Sets line type to solid, dot or dash. 0 = solid, number increases spacing between dots, -1 
      if type <> -1                                                                     'check for valid line width
        LCD_CMD1(lntyp,type)                                                              'send "LINETYPE" command to display  with "type"
      else                                                                              'otherwise
        LCD_CMD(lntyp)                                                                    'send "LINETYPE" command to display  
        result := GetString                                                               'return current type as the result
    
    PUB XY(x,y)                                                                      '' Set drawing cursor to location x,y on display. x and y are checked to make sure they can fit on the display. Set x = -1 to return current X,Y                                                          
     if x <> -1                                                                         'check for set x,y
        LCD_CMD2(xycmd,x,y)                                                               'send "XY" command to display with "x" and "y" 
     else                                                                               'otherwise
        LCD_CMD(xycmd)                                                                    'send "XY" command to display   
        result := GetString                                                               'return current x,y to buffer in main memory and sets the string size as the result
        
    PUB XY_byName(xyNamePointer)                                                     '' Set drawing cursor to location x,y on display. x and y are checked to make sure they can fit on the display.
                                                                                     '' 9 font justifications: LT, CT, RT, LC, CC, RC, LB, CB, RB offers convienient display placement options    
        LCD_STR(xycmd,xyNamePointer)                                                    'send "XY" command to display with "xyName" @ pointer
        
    PUB XYID(index,SavRes)                                                           '' Save X and Y into XY array using index if SavRes = 1, otherwise Restore X and Y from XY arrau using index
     serial.dec(xyidcmd)                                                                'send "XYID" command to display
     serial.tx(32)
     serial.dec(index)                                                                 'send index to display                                                             
      
      if SavRes == 1                                                                    'if SavRes = 1
        serial.tx(32)
        serial.dec(1)                                                                     'send "1" to display, signifies SAVE command
     CR_LF                                                                                'Send CR + LF
    
    PUB LCD_STRING(index,stringPointer)                                              '' Store "string" @ stringPointer in the string array using index. If stringPointer = -1, recall string from index. Index = 0 - 61. Returns -1 if index is invalid
    if index > 0 and index < 62                                                         'Check for valid index and if valid 
      if stringPointer <> -1                                                              'Check for Store / Recall and if Store 
        LCD_D_S(strcmd,index,stringPointer)                                                     'send "STRING" command to display with "index" and  "string" @ Pointer 
      else                                                                                 'if Recall
        LCD_CMD1(strcmd,index)                                                                  'send "STRING" command to display with "index"
         result := GetString                                                                'pass string to buffer in main memory and set result to string size    
    else                                                                                  'if invalid index                                                                
      result := -1                                                                            'set result = -1            
    
    PUB PLOT(x,y)                                                                    '' Place a pixel at XY with current color. Will place pixel at current X,Y if X and Y are set to -1
      if x == -1 and y == -1                                                            'Check for X,Y set to -1 and draw pixel at current X,Y 
        LCD_CMD(plotcmd)                                                                  'send "PLOT" command to display, draws at current X,Y
      else                                                                              'otherwise
        LCD_CMD2(plotcmd,x,y)                                                             'send "PLOT" command to display with "x" and "y"       
        
    PUB LINE(x,y)                                                                    '' Place line from current X,Y to X,Y with current color and current width and curren type
        LCD_CMD2(linecmd,x,y)                                                           'send "LINE" command to display with x and y
    
    PUB BOX(width, height, fill)                                                     '' Place a box from current X,Y with specified width and height. 
                                                                                     '' Fill = 1 or F to fill box or string starting with F. Box must be > 1 pixel wide 
     if fill == "F"                                                                     'if fill = "F"
        fill := 1                                                                        'set fill = 1
    LCD_CMD3(boxcmd,width,height,fill)                                                      'send "BOX" command to display with "width", "height" and "fill" 
    
    PUB CIRCLE(radius, fill)                                                         '' Draw circle at current X,Y with radius. Fill = "1" or "F" to fill circle 
      if fill == "F"                                                                    'check if fill = "F" and if so
        fill := 1                                                                         'set fill to "1"  
    LCD_CMD2(circmd,radius,fill)                                                        'send "CIRCLE" command to display with "radius" and "fill" 
                                                                                                                                 
    PUB ARC(radius, start, end, fill)                                                '' Draw ARC with Radius, Start angle and End angle. Fill = 1 or "F" to fill arc. Angle of 0 is on the right
      if fill == "F"                                                                    'check if fill = "F" and if so
        fill := 1                                                                         'set fill to "1"                                               
    LCD_CMD4(arccmd,radius,start,end,fill)                                              'send "ARC" command to display with "radius", "start", "end" and "fill"
    
    PUB PIE(radius, start, end)                                                      '' Draw PIE with Radius, Start angle and End angle. Angle of 0 is on the right
    LCD_CMD3(piecmd,radius,start,end)                                                       'send "PIE" command to display with "radius", "start", "end"
    
    PUB PICTURE(x, y, options, index)                                                '' Display PICTURE ID index on the LCD. File can be JPG, GIF or BMP.
                                                                                     '' X,Y is the upper left corner of the image when no options are applied.
                                                                                     '' Options : 1 = Align to center of display, 2 = down scale image to display, 3 = both
    LCD_CMD4(piccmd, x, y, options, index)                                                  ' send "PICURE" command to display with "x", "y", "options", "index"
    
    PUB PRINTi(index, justNamePointer)                                               '' Print string in String Array pointed to by index to the display.
                                                                                     '' 9 font justifications: LT, CT, RT, LC, CC, RC, LB, CB, RB offers convienient display placement options
      LCD_D_S(prntcmd,index,justNamePointer)                                                 'send "PRINT" command to display with "index" and "justification Name" @ Pointer
    
    PUB PRINTs(stringPointer, justNamePointer)                                       '' Print string in String Array pointed to by index to the display.
                                                                                     '' 9 font justifications: LT, CT, RT, LC, CC, RC, LB, CB, RB offers convienient display placement options
      LCD_Str2(prntcmd,stringPointer,justNamePointer)                                   'send "PRINT" command to display with "index" and "justification Name" @ Pointer
      
    
    PUB CLIPENABLE(enable)                                                           '' Turn on clip enable area
     LCD_CMD1(clpen,enable)                                                                'send "CLIPENABLE" command to display with "enable"
     
    PUB CLIPAREA(left, top, right, bottom)                                           '' Set Clip Area to protect the surrounding area from change
      LCD_CMD4(clpar, left, top, right, bottom)                                            'send "CLIPAREA" command to display with "left", "top", "right" and "bottom"
      
    PUB RECORD(namePointer)                                                          '' Record marco "name" to internal flash drive under \EZUSER\MACROS\
      LCD_STR(rcd,namePointer)                                                           'send "RECORD" command to display with "name" @ pointer
      
    PUB PLAY(namePointer)                                                            '' Play macro "name", Looks in directory \EZUSER\MACROS first and if not found it looks in \EZSYS\MACROS\
      LCD_STR(ply,namePointer)                                                           'send "PLAY" command to display with "name" @ pointer
                                                                                                                                                     
    PUB STOP                                                                         '' Stop playing macro and close the file
                                                                                     '' You may have to restart the display to see the files from the PC side
        LCD_CMD(stp)                                                                     'send "STOP" command to display
        
    PUB WAIT(optionPointer)                                                          '' Wait for events. Options "T" = Touch, "!T" = No Touch, "TR" = Touch and Release, "IO1-9" = Wait for 1, "!IO1-9" = Wait for 0
     LCD_STR(wt,optionPointer)                                                          'send "WAIT" command to display with "option" @ pointer
                                                                        
    PUB PAUSE(delay)                                                                 '' Pause delay (msec)
      LCD_CMD1(pse,delay)                                                               'send "PAUSE" command to display with "delay" 
    
    PUB LOOP(onOff)                                                                  '' Loop any macro that run. "1" = ON, "0" = OFF !!Loop should not be used in a macro.!!
      LCD_CMD1(lp,onOff)                                                               'send "LOOP" command to display with "onOff"
    
    PUB SPEED(delay)                                                                 '' Delay between macro line processing (msec)
      LCD_CMD1(spd,delay)                                                               'send "SPEED" command to display with "delay"
    
    PUB DEL(namePointer)                                                             '' Delete file name @ namePointer, same as erase
      LCD_STR(dl,namePointer)                                                           'send "DELETE" command to display with "name" @ namePointer
       
    PUB REN(namePointer1, namePointer2)                                              '' Rename file name1 to file name2 using name pointers
      LCD_STR2(rn,namePointer1,namePointer2)                                            'send "RENAME" command to display with "name" @ Pointer1 and "name" @ Pointer2  
    
    PUB CD(directoryNamePointer)                                                     '' Change to directory
      LCD_STR(chd, directoryNamePointer)                                                'send "CD" command to display with "directoryName" @ Pointer
       
    PUB MD(directoryNamePointer)                                                     '' Make directory
      LCD_STR(mkd, directoryNamePointer)                                                'send "MD" command to display with "directoryName" @ Pointer
    
    PUB RD(directoryNamePointer)                                                     '' Remove directory
      LCD_STR(rmd,directoryNamePointer)                                                 'send "RD" command to display "directoryName" @ Pointer  
    
    PUB COPY(namePointer1, namePointer2)                                             '' Copy file name1 to file name2
      LCD_STR2(cp,namePointer1,namePointer2)                                            'send "COPY" commmand to display with "name" @ Pointer1 and "name" @ Pointer2 
    
    PUB FORMAT(passwordPointer, serialPointer, volumeLabelPointer)                   '' Format "ezLCD" volumeid
       serial.dec(fmt)                                                                  'send "FORMAT" command to display
       serial.tx(32)                                                                    'send "space" to display
       serial.str(passwordPointer)                                                      'send name @ passwordPointer
       serial.tx(32)                                                                    'send "space" to display
       serial.str(serialPointer)                                                        'send name @ serialPointer
       serial.tx(32)                                                                    'send "space" to display
       serial.str(volumeLabelPointer)                                                   'send name @ volumeLabelPointer
       CR_LF                                                                            'send CR + LF
    
    PUB SECURITY(passwordPointer, stringPointer)                                     '' Lock the flash drive so it can not be accessed from the PC
      LCD_STR2(sct, passwordPointer, stringPointer)                                     'send "SECURITY" command to display with "password" @ Pointer and "string" @ Pointer
    
    PUB CFGIO(gpio, type)                                                            '' Configure GPIO as input (0) or output (1), serial, spi, i2c
      if type == "I"                                                                      'if type = "I"
        type := 0                                                                           'set type = 0
      elseif type == "O"                                                                  'if type = "O" 
        type := 1                                                                           'set type = 1
      LCD_CMD2(cfi,gpio,type)                                                             'send "SCFGIO" command to display with "GPIO number" and "data"
    
    
    PUB IO(gpio,data)                                                                '' IO write GPIO (1-9) with data. Write data to peripheral if configured
      LCD_CMD2(iocmd,gpio,data)                                                         'send "IO" command to display with "GPIO number" and "data"
      result := GetString                                                               'pass string to buffer in main memory and set result to string size 
    
    PUB CWD                                                                          '' Returns current working directory
       LCD_CMD(cwdcmd)                                                                  'send "CWD" command to display
       result := GetString                                                              'pass string to buffer in main memory and set result to string size   
      
    PUB MORE(namePointer)                                                            '' Sends the content of the file name to the current console port
      LCD_CMD(morecmd)                                                                 'send "MORE" command to display
      result := GetString                                                              'pass string to buffer in main memory and set result to string size   
      
    PUB DIR(maskPointer)                                                             '' Returns directory using mask 
      LCD_STR(dircmd,maskPointer)                                                      'send "dir" command to display with "mask" @ Pointer
      result := GetString                                                              'pass string to buffer in main memory and set result to string size 
    
    ''#############################################################################################################################################
    ''#                                                                                                                                           #
    ''#                                                                                                                                           #
    ''# These methods need to be worked on                                                                                                        #
    ''#                                                                                                                                           #
    ''#                                                                                                                                           #
    
    PUB THEME(themeIndex,embossDkColor,embossLtColor,textColor0,textColor1,textColorDisabled,color0,color1,colorDisabled,commonBkColor,tFontw)  | idx  ''Set widget theme info    !NOTE tFontw requires Firmware Verion 1.06 or later!   
      serial.dec(90)
        repeat idx from 0 to 10
          serial.tx(32)
          serial.dec(themeIndex[idx])
    CR_LF                                                                                                                                        
    PUB AMETER_VALUE(id, value)
        LCD_CMD2(77, id, value)
    
    PUB ANALOG_METER(id,x,y, Width, Height, options, inital, maxn, themen, stringID)    | idx
      serial.dec(76)
        repeat idx from 0 to 9
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    
    PUB BUTTON(id,x,y, Width, Height, options, align, radius, themen, stringID)         |idx
      serial.dec(70)
        repeat idx from 0 to 9
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    
    PUB CHECKBOX(id, x, y, width, height, options, themen, stringID)                   |idx
      serial.dec(71)
        repeat idx from 0 to 7
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF    
    
    PUB CHOICE(stringPointer, themen)
      serial.dec(89)                                               
      serial.tx(32)
      serial.str(stringPointer)
      serial.tx(32)
      serial.dec(themen)
      CR_LF
    
    PUB DIGITAL_METER(id,x,y,width,height,options,value,digits,dotpos,themen)          |idx
      serial.dec(74)
        repeat idx from 0 to 9
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    
    PUB DMETER_VALUE(id,value)
    LCD_CMD2(75,id,value)
    
    PUB GROUPBOX(id,x,y,width,height,options,themen,stringID)                        |idx
      serial.dec(72)
        repeat idx from 0 to 8
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF           
    PUB PROGRESS(id,x,y,width,height,options,position,range,themen)                  |idx
      serial.dec(85)
        repeat idx from 0 to 8
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    PUB PROGRESS_VALUE(id,value)
        LCD_CMD2(86,id,value)
    
    PUB RADIO_BUTTON(id,x,y,width,height,options,themen,stringID) | idx
      serial.dec(73)
        repeat idx from 0 to 7
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
      
    PUB STATIC_TEXT(id,x,y,width,height,options,frame,themen,stringID) | idx
      serial.dec(87)
        repeat idx from 0 to 8
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
     
    PUB STATICTEXT_VALUE(id,stringPointer)
      LCD_D_S(88,id,stringPointer)      
    
    PUB AMETER_COLOR(id,color1,color2,color3,color4,color5,color6)   | idx
      serial.dec(78)
        repeat idx from 0 to 6
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    
    PUB DIAL(id, x, y, radius, options, resolution, inital, maxn, themen, stringID) | idx
      serial.dec(80)
        repeat idx from 0 to 9
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    
    PUB SLIDER(id, x, y, width, height, options, range, resolution, value, themen) | idx
      serial.dec(82)
        repeat idx from 0 to 9
          serial.tx(32)
          serial.dec(id[idx])
    CR_LF
    
    PUB CheckWidget    | w,i,d                                                   ''Returns last widget change
    
        if GetString
          case byte[bufferAddress]
            "0" : w := 0
                  d := 0
                  
            "-" : w := 0
                  d := -1
    
            "1" : w := 0     
                  d := 1
                  
            "B" : w := 1
                  i := (byte[bufferAddress][1] - 48)
              if byte[bufferAddress][2] == "P"
                d := 1
              else
                d := 0 
                                                                                            
            "C" : w := 2
                  i := byte[bufferAddress][1]
              if byte[bufferAddress][2] == "C"
                d := 1
              else
                d := 0
            
            "R" : w := 4
                  i := byte[bufferAddress][1]
              if byte[bufferAddress][2] == "S"
                d:= 1
              else
                d:= 0
                  
            "D" : w := 5
                  i := byte[bufferAddress][1]
                  'd := str2dec(bufferAddress + 2)
    
            
            "S" : w := 6
                  i := byte[bufferAddress][1]
                  'd := str2dec(bufferAddress + 2)
    
    
    ''#                                                                                                                                           #
    ''#                                                                                                                                           #
    ''# These methods are for compatibility, they are commented out to save space. If you need them, un-comment them.                             #
    
         
    'PUB VERBOSE(mode) | m                                              '' Sets Verbose (Command Echo) mode "ON" (1) or "OFF" (0), Returns mode or false if incorrect mode is given
    ' if mode == string("ON") or mode == 1                                  'if mode is set to "ON" or "1"                
    '   m := 1                                                                 'set m to 1 
    ' elseif mode == string("OFF") or mode == 0                             'if mode is set to "OFF" or "0"
    '   m := 0                                                                 'set m to 0
    ' else                                                                  'else 
    '   result := -1                                                           'set result to -1
    '   return                                                                 'and return to caller
    '   
    'result := m                                                            'set result = m
    'LCD_CMD1(vrb,m)                                                        'send "Verbose" command to display with mode as paramater
    'serial.rxflush                                                                  'call rxflush
    
    
    'PUB REM                                                           '' Remark? 
    'PUB COMMENT
    
    'PUB ERASE(namePointer)                                                          '' Delete file name @ namePointer
    '  LCD_STR(58,namePointer)                                                          'send "DELETE" command to display
    
    'PUB TYPE(namePointer)                                                           '' Sends the content of the file name to the current console port  
    ' serial.tx(59)                                                                    'send "TYPE" command to display        
    
    'PUB CHDIR(directoryNamePointer)                                                 '' Change to directory
    '  LCD_STR(52,directoryNamePointer)                                                 'send "CHDIR" command to display   name @ directoryNamePointer
    
    'PUB MKDIR(directoryNamePointer)                                                 '' Make directory
    '  LCD_STR(53,directoryNamePointer)                                                 'send "MKDIR" command to display with "name" @ directoryNamePointer
    
    'PUB RMDIR(directoryNamePointer)                                                  '' Remove directory
    '  LCD_STR(54,directoryNamePointer)                                                  'send "RMDIR" command to display
    
    'PUB SET_CMD(interfacePointer, baud, cmd, modebitsPointer)                        '' Select command to interface. Baud rate = 110 to 230400. com = 1 for command port. mode = "n91/2" : "O81/2" : "N81/2"
    '    serial.dec(62)                                                                  'send "CMD" to display
    '    serial.tx(32)                                                                   'send "space" to display
    '    serial.str(interfacePointer)                                                    'send "interface" @ Pointer to display
    '    serial.tx(32)                                                                   'send "space" to display
    '    serial.dec(baud)                                                                'send "baud" to display 
    '    serial.tx(32)                                                                   'send "space" to display
    '    serial.dec(cmd)                                                                 'send "cmd" to display 
    '    serial.tx(32)                                                                   'send "space" to display
    '    serial.str(modebitsPointer)                                                     'send "modebits" @ Pointer to display 
    '    CR_LF
    
    ''#                                                                                                                                           #
    ''#                                                                                                                                           #
    ''#############################################################################################################################################
    ''#                                                                                                                                           #
    ''#   Public functions for reading data from screen                                                                                           #
    ''#                                                                                                                                           #
    ''#############################################################################################################################################
    
    PUB RXFLUSH                                                                      '' Used to flush fullDuplexSerial Recieve buffer
        serial.rxflush                                                                  'call rxflush
    
    PUB RXCHECK                                                                      '' Return character in FullDulexSerial buffer
        result := serial.rxcheck                                                        'call rxcheck and return result
    
    PUB RXWAIT                                                                       '' Wait for FullDuplexSerial character  
    result := serial.rx                                                                 'call rx and return result
    
    PUB GetString | n,co,c                                                           ''pass string to buffer in main memory and set result to string size           
      n := 0                                                                           'clear "n"
        repeat while (c := serial.rx) <> LT and n <> buffersize - 1                    'repeat until line terminator or buffer full , read byte from serial.rx to c
          incoming[n++] := c                                                             'store c in incoming buffer and increment "n"
                                                            '   n == buffersize NG no line terminator found within max length
                                                            '   n  < buffersize OK but may still be missing numbers
        if n  < buffersize - 1                                                         'if buffer not full
          incoming[n] := 0                                                               'terminate string with 0
          repeat co from 0 to n                                                          'repeat "co" length of string
            byte[bufferAddress][co] := incoming[co]                                        'copy byte from incomming buffer to buffer in main memory
          result := n                                                                    'set result to string size
        else                                                                           'if buffer full
          result := -1                                                                   'return -1
                                                                       
    ''#############################################################################################################################################
    ''#                                                                                                                                           #
    ''#   Private functions for sending data to and from screen                                                                                   #
    ''#                                                                                                                                           #
    ''#############################################################################################################################################
    
    PRI LCD_D_S(cmd,dec,stringPointer)                                               '' Send a command, 1 decimal and 1 string to display
       serial.dec(cmd)                                                     'send "cmd" command to display
        serial.tx(32)                                                      'send "space" to display
        serial.dec(dec)                                                     'send "index" to display
        serial.tx(32)                                                      'send "space" to display
        serial.str(stringPointer)                                          'send fontName @ Pointer to display
        CR_LF                                                              'send CR + LF to the display  
        
    PRI LCD_STR2(cmd,stringPointer1,stringPointer2)                                  '' Send a command and 2 string parameters to display
    ' MASTER_STR(@cmd, 2)
         serial.dec(cmd)                                                    'send "cmd" command to display
         serial.tx(32)                                                      'send "space" to display
         serial.str(stringPointer1)                                         'send first string to display
         serial.tx(32)                                                      'send "space" to display
         serial.str(stringPointer2)                                         'send second string to display
         CR_LF                                                              'send CR + LF to the display
    
    PRI LCD_STR(cmd,stringPointer)                                                   '' Send a command and a string parameter to the display
    ' MASTER_STR(@cmd, 1)
         serial.dec(cmd)                                                    'send "cmd" command to display
         serial.tx(32)                                                      'send "space" to display
         serial.str(stringPointer)                                          'send string to display
         CR_LF                                                              'send CR + LF to the display
    
    PRI LCD_CMD4(cmd,dec1,dec2,dec3,dec4)                                            '' Send a command and 4 decimal parameters to the display
    '   MASTER_DEC(@cmd,4)
    
         serial.dec(cmd)                                                    'send "cmd" command to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec1)                                                   'send dec1 to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec2)                                                   'send dec2 to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec3)                                                   'send dec3 to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec4)                                                   'send dec4 to display
         CR_LF                                                              'send CR + LF to the display
    
    PRI LCD_CMD3(cmd,dec1,dec2,dec3)                                                 '' Send a command with 3 decimal parameter to display
    '   MASTER_DEC(@cmd,3)
         serial.dec(cmd)                                                    'send "cmd" command to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec1)                                                   'send dec1 to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec2)                                                   'send dec2 to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec3)                                                   'send dec3 to display
    
    CR_LF                                                                'send CR + LF to display
        
    PRI LCD_CMD2(cmd,dec1,dec2)                                                      '' Send a command with 2 decimal parameter to display
    '   MASTER_DEC(@cmd,2)
        
         serial.dec(cmd)                                                    'send "cmd" command to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec1)                                                   'send dec1 to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec2)                                                   'send dec2 to display
         CR_LF                                                              'send CR + LF to display
    
    PRI LCD_CMD1(cmd,dec)                                                            '' Send a command with 1 decimal parameter to display
    '   MASTER_DEC(@cmd,1)
    
         serial.dec(cmd)                                                    'send "cmd" command to display
         serial.tx(32)                                                      'send "space" to display
         serial.dec(dec)                                                    'send dec to display
         CR_LF                                                              'send CR + LF to display
    
    PRI LCD_CMD(cmd)                                                                 '' Send a command to the display
        serial.dec(cmd)                                                    'send "cmd" command to display
        CR_LF                                                              'send CR + LF to display
    
    'PRI MASTER_DEC(cmdPtr, num)  | idx
    '   serial.dec(byte[cmdPtr])
    '    repeat idx from 1 to num
    '      serial.tx(32)
    '      serial.dec(byte[cmdPtr][idx])
    'CR_LF
    '
    'PRI MASTER_STR(cmdPtr, num)  | idx
    '   serial.dec(byte[cmdPtr])
    '    repeat idx from 1 to num
    '      serial.tx(32)
    '      serial.str(byte[cmdPtr][idx])
    'CR_LF
    
    
    PRI CR_LF                                                                        '' Send CR + LF to the display
       serial.tx(13)                                                       'send CR to display
       serial.tx(10)                                                       'send LF to display
    
    {{
    &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;
    &#9474;                                                   TERMS OF USE: MIT License                                                  &#9474;                                                            
    &#9500;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9508;
    &#9474;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation    &#9474; 
    &#9474;files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,    &#9474;
    &#9474;modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software&#9474;
    &#9474;is furnished to do so, subject to the following conditions:                                                                   &#9474;
    &#9474;                                                                                                                              &#9474;
    &#9474;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.&#9474;
    &#9474;                                                                                                                              &#9474;
    &#9474;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE          &#9474;
    &#9474;WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR         &#9474;
    &#9474;COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,   &#9474;
    &#9474;ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                         &#9474;
    &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;
    }}                                                                   
    
    The problem is: Returns from this work
    PUB LIGHT(brightness)                                                            '' Set backlight level to brightness when 0 - 100 (as percent)  *default is 75%. If brightness = -1, returns the current brightness as ASCII 0-terminated STRING to buffer in main memory 
       if brightness > -1 and brightness < 101                                          'check to make sure brightness is between 0 and 100 (as percent)
         LCD_CMD1(bri,brightness)                                                         'send "LIGHT" command to display with brightness
       elseif brightness == -1                                                          'if brightness = -1
         LCD_CMD(bri)                                                                     'send "LIGHT" command
    
         result := GetString                                                              'pass string to buffer in main memory and set result to string size
    
    
    
    '          ***  Tested OK   ***
    '_________________________________________________________________________________
    
    But this does not return anything?
    
    
    PUB COLOR(CID)                                                              '' Set current color to COLORID (0 - 199). If CID = -1, Returns current color to buffer in main memory and set result to string size. Returns 0 if good, -1 if incorrect color is given 
      if CID < 200 and CID > -1                                                         'if CID = (0 - 199)
        LCD_CMD1(col,CID)                                                                   'send "COLOR" command to display with "c"        
      elseif CID == -1                                                                  'if CID = -1
        LCD_CMD(col)                                                                      'send "COLOR" command to display
        
        result := GetString                                                               'pass string to buffer in main memory and set result to string size
      else                                                                              'otherwise
       result := -1                                                                       'set result to -1
    
    They should either both work, or neither. Why one works, and the other one doesn't has me confused. Any help would be appreciated as always!
  • SRLMSRLM Posts: 5,045
    edited 2012-05-13 23:37
    You need to work a bit on the names. Specifically, the names for methods need to be camel case, constants need to be capitalized, and variables either camel case or underscore separated.
    http://www.parallaxsemiconductor.com/goldstandard

    For your question, if CID<200 and CID > -1 then there is no assignment to result? Your first example is also missing such an assignment, but perhaps you don't have a test case for the first condition.
  • average joeaverage joe Posts: 795
    edited 2012-05-14 00:22
    Thanks for the hint on names, I will take care of that right away! I read that DOC but didn't have code yet so now that I do, I will format as prescribed!

    about the assignment, if CID<200 and CID > -1, then you are writing CID to the display, setting the display to use that color. Same thing with the backlight. If you send
    LIGHT(80)
    
    your setting the backlight to 80%. If you send
    BacklightSetting := LIGHT(-1)
    
    this should return the current backlight setting and place it in BacklightSetting. *and does, in a round about way returning the SIZE, and placing the actual value in the buffer*
    ColorID := Color(-1)
    
    does NOT behave properly and returns 0, or no string? The command seems to be getting lost, but
       LCD_CMD1(cmd, dec) 
    
    seems to work everywhere else it's used. I'm just scripting the RETURN sections of the code now. You can send data to the display with what I posted, but getting data from the display *by calling the same method with the first parameter set to -1* is proving more difficult than anticipated!
    Thanks again and I will keep you updated!
Sign In or Register to comment.