Lcdout macro problem
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    220

    Default Lcdout macro problem

    So, there I was happily programming away... slowly putting together the attached menu tree and suddenly, between one compile and the next, this error shows up: Macro LCDOUTSTR?W not found in macro file. Some things I verified or can infer.
    • I've never seen this before
    • I'm using PBP3.1
    • 8 bit 18F4420
    • This is the only active section of the program other than configuring
    • I've been making incremental changes for days. Literally working one minute - error the next.

    I'm just hoping somebody can put me on the track to solve this. I've searched for the error on the forum and on the internet and do not find anything related.


    Code:
    'READ KEYPAD
    KEY_READ:
      PAUSE 50
      FOR L1 = 0 TO 3
        LATC = %00000000
        LATC.0[L1] = 1 
        FOR L2 = 4 TO 7
          IF PORTC.0[L2] = 1 THEN 
            SELECT CASE PORTC
              CASE %00010001 : KEY_PTR = 0 : RETURN     'RESET 
              CASE %00100001 : KEY_CODE[KEY_PTR] =  0                                
              CASE %01000001 : KEY_CODE[KEY_PTR] = "#"            
              CASE %10000001 : KEY_CODE[KEY_PTR] = "D"
                 
              CASE %00010010 : KEY_CODE[KEY_PTR] =  7
              CASE %00100010 : KEY_CODE[KEY_PTR] =  8 
              CASE %01000010 : KEY_CODE[KEY_PTR] =  9 
              CASE %10000010 : KEY_CODE[KEY_PTR] = "C" 
                  
              CASE %00010100 : KEY_CODE[KEY_PTR] =  4 
              CASE %00100100 : KEY_CODE[KEY_PTR] =  5
              CASE %01000100 : KEY_CODE[KEY_PTR] =  6
              CASE %10000100 : KEY_CODE[KEY_PTR] = "B"
    
              CASE %00011000 : KEY_CODE[KEY_PTR] =  1
              CASE %00101000 : KEY_CODE[KEY_PTR] =  2
              CASE %01001000 : KEY_CODE[KEY_PTR] =  3
              CASE %10001000 : KEY_CODE[KEY_PTR] = "A"
            END SELECT
    
            'CLEAR ROW 3 & 4
            LCDOUT $FE, $94, REP " "\20 : LCDOUT $FE, $94
            LCDOUT $FE, $D4, REP " "\20 : LCDOUT $FE, $D4
            
            FOR D1 = 0 TO KEY_PTR
              IF KEY_CODE[D1] < 10 THEN
                LCDOUT DEC KEY_CODE[D1]   
              ELSE
                LCDOUT KEY_CODE[D1]
              ENDIF
            NEXT D1
            
            IF KEY_PTR = 3 THEN
              DEV_NUM = KEY_CODE[1] * 10 + KEY_CODE[2]
              select case DEV_NUM
                case 1                : LCDOUT $FE, $94, "CLOCK   " : LCDOUT $FE, $D4, "          "
                CASE 2, 3, 4, 5, 6, 7 : LCDOUT $FE, $94, "PLUG #", DEC2 DEV_NUM - 1
                CASE 8, 9, 10         : LCDOUT $FE, $94, "DOSE #", DEC2 DEV_NUM - 8
              END SELECT
            ENDIF
                  
            IF KEY_PTR = 6 THEN
              DEV_REG =  KEY_CODE[4] * 10 + KEY_CODE[5]
              SELECT CASE DEV_NUM 'NAME EACH DEVICE REGISTER
              CASE 1 'CLOCK 
                select case DEV_REG 
                  CASE 1 : LCDOUT $FE, $94, "R:1 MINUTES "
                  CASE 2 : LCDOUT $FE, $94, "R:2 HOURS   "
                  CASE 3 : LCDOUT $FE, $94, "R:3 DOW     "
                  CASE 4 : LCDOUT $FE, $94, "R:4 DATE    "
                  CASE 5 : LCDOUT $FE, $94, "R:5 MONTH   "
                  CASE 6 : LCDOUT $FE, $94, "R:6 YEAR    "            
                  CASE ELSE : LCDOUT $FE, $94 : LCDOUT "ERR: * RESET" 
                END SELECT
              CASE 2, 3, 4, 5, 6, 7 'PLUGS
                select case DEV_REG
                  CASE 1   : LCDOUT $FE, $94, "R:1 ON TIME "
                  CASE 2   : LCDOUT $FE, $94, "R:2 OFF TIME"
                  CASE 3   : LCDOUT $FE, $94, "R:3 DAY PTRN"
                  CASE 4   : LCDOUT $FE, $94, "R:4 2ND ON  "
                  CASE 5   : LCDOUT $FE, $94, "R:5 2ND OFF "            
                 CASE ELSE : LCDOUT $FE, $94, "ERR: * RESET" 
              END SELECT
              CASE 8, 9, 10 'DOSE PUMPS
                select case DEV_REG
                  CASE 1 : LCDOUT $FE, $94, "R:1 ON TIME "
                  CASE 2 : LCDOUT $FE, $94, "R:2 RUN TIME"
                  CASE 3 : LCDOUT $FE, $94, "R:3 DAY PTRN"
                  CASE 4 : LCDOUT $FE, $94, "R:4 PWM%  "           
                  CASE ELSE : LCDOUT $FE, $94, "ERR: * RESET" 
                END SELECT
              END SELECT               
            ENDIF
            
            IF KEY_PTR = 12 THEN
              'REG_VAL = KEY_CODE[8] * 1000 + KEY_CODE[9] * 100 + KEY_CODE[10] * 10 + KEY_CODE[11] 
            ENDIF 
                   
            KEY_PTR = KEY_PTR + 1 
            PAUSE 1000            
          ENDIF
        NEXT L2
      NEXT L1
      
      
      
      IF KEY_PTR < 11 THEN GOTO KEY_READ
        'LCDOUT $FE, $D4, "D#", DEC2 DEV_NUM, " R#", DEC2 DEV_REG, " V#", DEC4 REG_VAL 
      PAUSE 5000
      'WRITE REGISTER VALUE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    RETURN

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,675

    Default Re: Lcdout macro problem

    Some things I verified or can infer.

    there is nothing in that snippet that won't compile correctly. [regardless of how the vars used in snippet are defined]

    without the full error message and its context there is no way to make a rational guess about the problem.

    the problem will lie in the code not posted.
    This is more entertaining than Free to Air TV

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    1,675

    Default Re: Lcdout macro problem

    try and compile this, if it still fails remark one lcd line at a time to identify culprit
    it compiles fine for me with your chip srlected

    Code:
    'READ KEYPAD
    KEY_CODE  var byte[10]
    KEY_PTR   var word
    L1        var word
    L2        var word
    d1        var word
    DEV_NUM   var word
    DEV_REG   var word
    
    
    KEY_READ:
      PAUSE 50
      FOR L1 = 0 TO 3
        LATC = %00000000
        LATC.0[L1] = 1 
        FOR L2 = 4 TO 7
          IF PORTC.0[L2] = 1 THEN 
            SELECT CASE PORTC
              CASE %00010001 : KEY_PTR = 0 : RETURN     'RESET 
              CASE %00100001 : KEY_CODE[KEY_PTR] =  0                                
              CASE %01000001 : KEY_CODE[KEY_PTR] = "#"            
              CASE %10000001 : KEY_CODE[KEY_PTR] = "D"
                 
              CASE %00010010 : KEY_CODE[KEY_PTR] =  7
              CASE %00100010 : KEY_CODE[KEY_PTR] =  8 
              CASE %01000010 : KEY_CODE[KEY_PTR] =  9 
              CASE %10000010 : KEY_CODE[KEY_PTR] = "C" 
                  
              CASE %00010100 : KEY_CODE[KEY_PTR] =  4 
              CASE %00100100 : KEY_CODE[KEY_PTR] =  5
              CASE %01000100 : KEY_CODE[KEY_PTR] =  6
              CASE %10000100 : KEY_CODE[KEY_PTR] = "B"
    
    
              CASE %00011000 : KEY_CODE[KEY_PTR] =  1
              CASE %00101000 : KEY_CODE[KEY_PTR] =  2
              CASE %01001000 : KEY_CODE[KEY_PTR] =  3
              CASE %10001000 : KEY_CODE[KEY_PTR] = "A"
            END SELECT
    
    
            'CLEAR ROW 3 & 4
            LCDOUT $FE, $94, REP " "\20 : LCDOUT $FE, $94
            LCDOUT $FE, $D4, REP " "\20 : LCDOUT $FE, $D4
            
            FOR D1 = 0 TO KEY_PTR
              IF KEY_CODE[D1] < 10 THEN
                LCDOUT DEC KEY_CODE[D1]   
              ELSE
                LCDOUT KEY_CODE[D1]
              ENDIF
            NEXT D1
            
            IF KEY_PTR = 3 THEN
              DEV_NUM = KEY_CODE[1] * 10 + KEY_CODE[2]
              select case DEV_NUM
                case 1                : LCDOUT $FE, $94, "CLOCK   " : LCDOUT $FE, $D4, "          "
                CASE 2, 3, 4, 5, 6, 7 : LCDOUT $FE, $94, "PLUG #", DEC2 DEV_NUM - 1
                CASE 8, 9, 10         : LCDOUT $FE, $94, "DOSE #", DEC2 DEV_NUM - 8
              END SELECT
            ENDIF
                  
            IF KEY_PTR = 6 THEN
              DEV_REG =  KEY_CODE[4] * 10 + KEY_CODE[5]
              SELECT CASE DEV_NUM 'NAME EACH DEVICE REGISTER
              CASE 1 'CLOCK 
                select case DEV_REG 
                  CASE 1 : LCDOUT $FE, $94, "R:1 MINUTES "
                  CASE 2 : LCDOUT $FE, $94, "R:2 HOURS   "
                  CASE 3 : LCDOUT $FE, $94, "R:3 DOW     "
                  CASE 4 : LCDOUT $FE, $94, "R:4 DATE    "
                  CASE 5 : LCDOUT $FE, $94, "R:5 MONTH   "
                  CASE 6 : LCDOUT $FE, $94, "R:6 YEAR    "            
                  CASE ELSE : LCDOUT $FE, $94 : LCDOUT "ERR: * RESET" 
                END SELECT
              CASE 2, 3, 4, 5, 6, 7 'PLUGS
                select case DEV_REG
                  CASE 1   : LCDOUT $FE, $94, "R:1 ON TIME "
                  CASE 2   : LCDOUT $FE, $94, "R:2 OFF TIME"
                  CASE 3   : LCDOUT $FE, $94, "R:3 DAY PTRN"
                  CASE 4   : LCDOUT $FE, $94, "R:4 2ND ON  "
                  CASE 5   : LCDOUT $FE, $94, "R:5 2ND OFF "            
                 CASE ELSE : LCDOUT $FE, $94, "ERR: * RESET" 
              END SELECT
              CASE 8, 9, 10 'DOSE PUMPS
                select case DEV_REG
                  CASE 1 : LCDOUT $FE, $94, "R:1 ON TIME "
                  CASE 2 : LCDOUT $FE, $94, "R:2 RUN TIME"
                  CASE 3 : LCDOUT $FE, $94, "R:3 DAY PTRN"
                  CASE 4 : LCDOUT $FE, $94, "R:4 PWM%  "           
                  CASE ELSE : LCDOUT $FE, $94, "ERR: * RESET" 
                END SELECT
              END SELECT               
            ENDIF
            
            IF KEY_PTR = 12 THEN
              'REG_VAL = KEY_CODE[8] * 1000 + KEY_CODE[9] * 100 + KEY_CODE[10] * 10 + KEY_CODE[11] 
            ENDIF 
                   
            KEY_PTR = KEY_PTR + 1 
            PAUSE 1000            
          ENDIF
        NEXT L2
      NEXT L1
      
      
      
      IF KEY_PTR < 11 THEN GOTO KEY_READ
        'LCDOUT $FE, $D4, "D#", DEC2 DEV_NUM, " R#", DEC2 DEV_REG, " V#", DEC4 REG_VAL 
      PAUSE 5000
      'WRITE REGISTER VALUE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    end
    This is more entertaining than Free to Air TV

  4. #4
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    220

    Default Re: Lcdout macro problem

    Thanks for your time, Richard. Below is the full code.

    "Error: Macro LCDOUTSTR?W not found in macro file." is the error verbatim and all that appears in the Results window when trying to compile in PBPX 3.1.1.4. As I say, it compiled and ran as expected, until the addition of these lines (near the bottom of the menu routines):

    'IF KEY_PTR = 12 THEN
    'REG_VAL = KEY_CODE[8] * 1000 + KEY_CODE[9] * 100 + KEY_CODE[10] * 10 + KEY_CODE[11]
    'ENDIF

    At that point the error appeared. Removing or commenting out these lines has nor resolved the issue. Compiling other projects using the LCD does not cause the problem.


    Code:
    #CONFIG
        CONFIG  OSC = INTIO67         ; HS oscillator
        CONFIG  FCMEN = OFF           ; Fail-Safe Clock Monitor disabled
        CONFIG  IESO = OFF            ; Oscillator Switchover mode disabled
        CONFIG  PWRT = OFF            ; PWRT disabled
        CONFIG  BOREN = SBORDIS       ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
        CONFIG  BORV = 3              ; Minimum setting
        CONFIG  WDT = OFF             ; WDT enabled
        CONFIG  WDTPS = 512           ; 1:512
        CONFIG  CCP2MX = PORTC        ; CCP2 input/output is multiplexed with RC1
        CONFIG  PBADEN = OFF          ; PORTB<4:0> pins are configured as digital I/O on Reset
        CONFIG  LPT1OSC = OFF         ; Timer1 configured for higher power operation
        CONFIG  MCLRE = ON            ; MCLR pin enabled; RE3 input pin disabled
        CONFIG  STVREN = ON           ; Stack full/underflow will cause Reset
        CONFIG  LVP = OFF             ; Single-Supply ICSP disabled
        CONFIG  XINST = OFF           ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
        CONFIG  DEBUG = OFF           ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
        CONFIG  CP0 = OFF             ; Block 0 (000800-001FFFh) not code-protected
        CONFIG  CP1 = OFF             ; Block 1 (002000-003FFFh) not code-protected
        CONFIG  CPB = OFF             ; Boot block (000000-0007FFh) not code-protected
        CONFIG  CPD = OFF             ; Data EEPROM not code-protected
        CONFIG  WRT0 = OFF            ; Block 0 (000800-001FFFh) not write-protected
        CONFIG  WRT1 = OFF            ; Block 1 (002000-003FFFh) not write-protected
        CONFIG  WRTC = OFF            ; Configuration registers (300000-3000FFh) not write-protected
        CONFIG  WRTB = OFF            ; Boot block (000000-0007FFh) not write-protected
        CONFIG  WRTD = OFF            ; Data EEPROM not write-protected
        CONFIG  EBTR0 = OFF           ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR1 = OFF           ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
        CONFIG  EBTRB = OFF           ; Boot block (000000-0007FFh) not protected from table reads executed in other blocks
    #ENDCONFIG
    
    OSCCON = %01110000                'USE INTERNAL CLOCK 8 MEG
    OSCTUNE.6 = 1                     'ENABLE PLL (*4 = 32MEG)
    DEFINE OSC 32                     'TELL EVERYBODY 
    
    DEFINE I2C_SLOW 1
    '-----SERIAL SET-UP------------------------------------------------------------- 
    DEFINE DEBUG_REG PORTE
    DEFINE DEBUG_BIT 2
    DEFINE DEBUG_BAUD 19200
    DEFINE DEBUG_MODE 0
    '-----LCD SETUP-----------------------------------------------------------------
    DEFINE LCD_DREG PORTB   
    DEFINE LCD_DBIT 4 
    DEFINE LCD_RSREG PORTD  
    DEFINE LCD_RSBIT 6  
    DEFINE LCD_EREG PORTD   
    DEFINE LCD_EBIT 7   
    DEFINE LCD_BITS 4  
    DEFINE LCD_LINES 4
    DEFINE LCD_COMMANDUS 3000
    DEFINE LCD_DATAUS 100
    '-----REGISTER ASSIGNS------------------------------------------------------
    CMCON = %00000111                                                               'DISABLE COMPARITOR															
    TRISA = %00000000                                                            
    TRISB = %00000000                                                               '
    TRISC = %11110000                                                               
    TRISD = %00000000 
    TRISE = %00000000
    ADCON0 = %00000000
    ADCON1 = %00001111 
      
    '-----KEYPAD------------------------------------------------------
    KYPD VAR BYTE 
    LATD = %00001111
    KEY_CODE VAR WORD[10]
    KEY_PTR VAR BYTE
    KEY_DEV VAR BYTE
    DEV_NUM VAR BYTE
    DEV_REG VAR BYTE
    REG_VAL VAR WORD
    
    '-----CLOCK SET-UP------------------------------------------------
    RTC_ADD CON %11010000
    REG_TIM CON $00
    'REG_AL1 CON $07		' Not implemented 
    'REG_AL2 CON $0B		' Not implemented
    REG_TMP con $11
    REG_SPL CON $0E
    CAL_DOW VAR BYTE[2]
    
    '-----TIME/ CLOCK VARIABLES----------------------------------------
    REG_MIN VAR BYTE[7]     ' Minimum register values
    'REG_VAL VAR Byte[7]	    ' Seconds, minutes, hours, day of week, date, month, year
    REG_MAX VAR BYTE[7]     ' Maximum register values
    ACT_REG VAR BYTE        ' Active register (setting) 
    'SET CURRENT TIME
    REG_VAL[0] = 0 : REG_VAL[1] = 31 : REG_VAL[2] = 06 : REG_VAL[3] = 2 : REG_VAL[4] = 6 : REG_VAL[5] = 5 : REG_VAL[6] = 19
    
    'GOSUB CLK_WRITE
    '-----I2C---------------------------------------------------------  
    SDA VAR PORTE.0
    SCL VAR PORTE.1
    '-----GENERAL USE VARIABLES---------------------------------------
    L1 VAR BYTE             ' For/ Next value
    L2 VAR BYTE
    D0 VAR BYTE
    D1 VAR BYTE
    D2 VAR BYTE
    TMP_WORD VAR WORD
    
    PAUSE 500
    'TURN ON HEARTBEAT-----
    'I2CWrite SDA, SCL, RTC_ADD, REG_SPL, [%01000000]
    
    
    
    Main:
      LCDOUT $FE, 2
      PAUSE 300
      GOSUB CLK_READ
      GOSUB TMP_READ
      LATC = %00001111
      LCDOUT $FE, $D4, "                    "
      KEY_PTR = 0
      IF PORTC & $F0 > 15 THEN GOSUB KEY_READ     '
    goto Main
    
    
    
    '-----SUB-ROUTINES------------------------------------------------
    'READ KEYPAD
    KEY_READ:
      PAUSE 50
      FOR L1 = 0 TO 3
        LATC = %00000000
        LATC.0[L1] = 1 
        FOR L2 = 4 TO 7
          IF PORTC.0[L2] = 1 THEN 
            SELECT CASE PORTC
              CASE %00010001 : KEY_PTR = 0 : RETURN     'RESET 
              CASE %00100001 : KEY_CODE[KEY_PTR] =  0                                
              CASE %01000001 : KEY_CODE[KEY_PTR] = "#"            
              CASE %10000001 : KEY_CODE[KEY_PTR] = "D"
                 
              CASE %00010010 : KEY_CODE[KEY_PTR] =  7
              CASE %00100010 : KEY_CODE[KEY_PTR] =  8 
              CASE %01000010 : KEY_CODE[KEY_PTR] =  9 
              CASE %10000010 : KEY_CODE[KEY_PTR] = "C" 
                  
              CASE %00010100 : KEY_CODE[KEY_PTR] =  4 
              CASE %00100100 : KEY_CODE[KEY_PTR] =  5
              CASE %01000100 : KEY_CODE[KEY_PTR] =  6
              CASE %10000100 : KEY_CODE[KEY_PTR] = "B"
    
              CASE %00011000 : KEY_CODE[KEY_PTR] =  1
              CASE %00101000 : KEY_CODE[KEY_PTR] =  2
              CASE %01001000 : KEY_CODE[KEY_PTR] =  3
              CASE %10001000 : KEY_CODE[KEY_PTR] = "A"
            END SELECT
    
            'CLEAR ROW 3 & 4
            LCDOUT $FE, $94, REP " "\20 : LCDOUT $FE, $94
            LCDOUT $FE, $D4, REP " "\20 : LCDOUT $FE, $D4
            
            FOR D1 = 0 TO KEY_PTR
              IF KEY_CODE[D1] < 10 THEN
                LCDOUT DEC KEY_CODE[D1]   
              ELSE
                LCDOUT KEY_CODE[D1]
              ENDIF
            NEXT D1
            
            IF KEY_PTR = 3 THEN
              DEV_NUM = KEY_CODE[1] * 10 + KEY_CODE[2]
              select case DEV_NUM
                case 1                : LCDOUT $FE, $94, "CLOCK   " : LCDOUT $FE, $D4, "          "
                CASE 2, 3, 4, 5, 6, 7 : LCDOUT $FE, $94, "PLUG #", DEC2 DEV_NUM - 1
                CASE 8, 9, 10         : LCDOUT $FE, $94, "DOSE #", DEC2 DEV_NUM - 8
              END SELECT
            ENDIF
                  
            IF KEY_PTR = 6 THEN
              DEV_REG =  KEY_CODE[4] * 10 + KEY_CODE[5]
              SELECT CASE DEV_NUM 'NAME EACH DEVICE REGISTER
              CASE 1 'CLOCK 
                select case DEV_REG 
                  CASE 1 : LCDOUT $FE, $94, "R:1 MINUTES "
                  CASE 2 : LCDOUT $FE, $94, "R:2 HOURS   "
                  CASE 3 : LCDOUT $FE, $94, "R:3 DOW     "
                  CASE 4 : LCDOUT $FE, $94, "R:4 DATE    "
                  CASE 5 : LCDOUT $FE, $94, "R:5 MONTH   "
                  CASE 6 : LCDOUT $FE, $94, "R:6 YEAR    "            
                  CASE ELSE : LCDOUT $FE, $94 : LCDOUT "ERR: * RESET" 
                END SELECT
              CASE 2, 3, 4, 5, 6, 7 'PLUGS
                select case DEV_REG
                  CASE 1   : LCDOUT $FE, $94, "R:1 ON TIME "
                  CASE 2   : LCDOUT $FE, $94, "R:2 OFF TIME"
                  CASE 3   : LCDOUT $FE, $94, "R:3 DAY PTRN"
                  CASE 4   : LCDOUT $FE, $94, "R:4 2ND ON  "
                  CASE 5   : LCDOUT $FE, $94, "R:5 2ND OFF "            
                 CASE ELSE : LCDOUT $FE, $94, "ERR: * RESET" 
              END SELECT
              CASE 8, 9, 10 'DOSE PUMPS
                select case DEV_REG
                  CASE 1 : LCDOUT $FE, $94, "R:1 ON TIME "
                  CASE 2 : LCDOUT $FE, $94, "R:2 RUN TIME"
                  CASE 3 : LCDOUT $FE, $94, "R:3 DAY PTRN"
                  CASE 4 : LCDOUT $FE, $94, "R:4 PWM%  "           
                  CASE ELSE : LCDOUT $FE, $94, "ERR: * RESET" 
                END SELECT
              END SELECT               
            ENDIF
            
            'IF KEY_PTR = 12 THEN
              'REG_VAL = KEY_CODE[8] * 1000 + KEY_CODE[9] * 100 + KEY_CODE[10] * 10 + KEY_CODE[11] 
            'ENDIF 
                   
            KEY_PTR = KEY_PTR + 1 
            PAUSE 1000            
          ENDIF
        NEXT L2
      NEXT L1
      
      
      
      IF KEY_PTR < 11 THEN GOTO KEY_READ
        'LCDOUT $FE, $D4, "D#", DEC2 DEV_NUM, " R#", DEC2 DEV_REG, " V#", DEC4 REG_VAL 
      PAUSE 5000
      'WRITE REGISTER VALUE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    RETURN
    
    'READ TIME, CONVERT TO DECIMAL VALUES, DISPLAY
    CLK_READ:
      I2CRead SDA, SCL, RTC_ADD, REG_TIM, [REG_VAL[0], REG_VAL[1], REG_VAL[2], REG_VAL[3], REG_VAL[4], REG_VAL[5], REG_VAL[6]]
      FOR L1 = 0 TO 6			
        D0 = (REG_VAL[L1] >> 4) * 10
        D1 = REG_VAL[L1] & %0001111		
        REG_VAL[L1] = D0 + D1 		    
      NEXT L1				            
      IF REG_VAL[0] // 2 = 1 THEN
        REG_VAL[0] = "-"  
      ELSE
        REG_VAL[0] = "+"
      ENDIF
      READ (REG_VAL[3] - 1) * 2, CAL_DOW[0] : READ (REG_VAL[3] - 1) * 2 + 1, CAL_DOW[1] 
      
      LCDOUT CAL_DOW[0], CAL_DOW[1], " ", dec2 REG_VAL[5], "/", dec2 REG_VAL[4], "/", dec2 REG_VAL[6], "   ", dec2 REG_VAL[2], ":", dec2 REG_VAL[1] , STR REG_VAL[0]
      PAUSE 300
    Return
    
    'CONVERT TO BCD VALUES, WRITE TO CLOCK REGISTERS
    CLK_WRITE:
      FOR L1 = 0 TO 6			       
        D0 = REG_VAL[L1] / 10		    
        D1 = REG_VAL[L1] // 10 		    
        REG_VAL[L1] = (D0 << 4) + d1
      NEXT L1				
      I2CWrite SDA, SCL, RTC_ADD, REG_TIM, [REG_VAL[0], REG_VAL[1], REG_VAL[2], REG_VAL[3], REG_VAL[4], REG_VAL[5], REG_VAL[6]]
      GOSUB CLK_READ			        
    Return
    
    'READ AMBIENT FROM CLOCK CHIP
    TMP_READ:
      I2CRead SDA, SCL, RTC_ADD, REG_TMP, [D1, D2]
      TMP_WORD = D1 << 8 + D2                                 
      LCDOUT $FE, $C0, "AMB:", DEC TMP_WORD
      PAUSE 300
    Return
    
    DATA "S", "U", "M", "O", "T", "U", "W", "E", "T", "H", "F", "R", "S", "A"

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    1,675

    Default Re: Lcdout macro problem

    KEY_CODE VAR WORD[10]

    there a problem KEY_CODE[10] does not exist KEY_CODE[11] is right out, you a exceeding array bounds key_code index is 0 to 9
    exceeding array boundaries is never a good thing
    Last edited by richard; - 2nd June 2019 at 14:39.
    This is more entertaining than Free to Air TV

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,243

    Default Re: Lcdout macro problem

    The issue seems to be this line:
    Code:
    LCDOUT CAL_DOW[0], CAL_DOW[1], " ", dec2 REG_VAL[5], "/", dec2 REG_VAL[4], "/", dec2 REG_VAL[6], "   ", dec2 REG_VAL[2], ":", dec2 REG_VAL[1] , STR REG_VAL[0]
    Namely the STR modifier at the end. If I cut that line short of the last entry it compiles without error.

    /Henrik.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    1,675

    Default Re: Lcdout macro problem

    Namely the STR modifier at the end. If I cut that line short of the last entry it compiles without error.
    not even in the snippet posted either
    This is more entertaining than Free to Air TV

  8. #8
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,176

    Default Re: Lcdout macro problem

    I also notice that the variables "KEY_CODE VAR WORD[10]" and "REG_VAL VAR WORD" are words. If you execute the statement "REG_VAL = KEY_CODE[8] * 1000 + KEY_CODE[9] * 100 + KEY_CODE[10] * 10 + KEY_CODE[11]" that would produce an overflow condition. Also in the past, I believe you can not use the "DEC" directive on an indexed variable inside of an LCDOUT statement. I have always used individual variables when using the "DEC" directive. Try using individual variables and see.
    Dave Purola,
    N8NTA
    EN82fn

  9. #9
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    220

    Default Re: Lcdout macro problem

    Thank you, gentlepeople, for the advice. I will correct as advised and report result. While I did find some information on "USERCOMMAND", which appears to be how LCDOUT was implemented, it seems far more likely that this error is related to some error I've made than some error in PCP3.

    Amoque

  10. #10
    Join Date
    Apr 2011
    Location
    Portland, Oregon
    Posts
    220

    Default Re: Lcdout macro problem

    Working my way through your suggestions I discovered that the problem was this:

    I cut and pasted the clock code from another project and did not realize I'd used the byte variable REG_VAL[7] to hold the clock register values. As I added to the menu code I again used the REG_VAL variable defined as a WORD to hold the on-time (in minutes) for whatever device I was editing. Changing the word variable name was the solution. I came to this conclusion by process of elimination. When I removed the STR directive (the following variable was inadvertently clipped when C&Ping the code), the LCD quit displaying anything at all.

    Commenting out the entire line restored the output of lines 2, 3, and 4. As I studied that line... finally, the error occurred to me. I find it interesting that PBP did not complain about writing indexed values to a non-indexed word variable (REG_VAL) and, indeed, said nothing about the misused variable at all; rather, complaining about LCDOUT.

    On my part, it was completely a case of overthinking the error; I presumed that the 'macro' file was the issue. Kudos to you all for recognizing it was an error in the code - not the compiler. I've been caught by PBP's clunky error reporting before, shame on me for not verifying my code before requesting help.

    Thank you, again

Similar Threads

  1. Replies: 6
    Last Post: - 4th November 2009, 13:36
  2. ERROR: Macro MOD?TCB not found in macro file.
    By JohnP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2009, 19:10
  3. Error: macro COUNT?TCT nor found in macro file.
    By AMMOTT in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th November 2007, 05:05
  4. Macro CMPEQ?TTT not found in macro file
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 14th May 2006, 00:36
  5. Replies: 1
    Last Post: - 3rd October 2005, 15:19

Members who have read this thread : 15

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts