Code verification errors 16F1847


Closed Thread
Results 1 to 26 of 26

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    "Message[303] C:\PBP\BILL'S RETIC.ASM 1191 : Program word too large. Truncated to core size. (5761)"
    followed by another 77 lines of the same but with end number changes.

    Does this mean the chip program space is not big enough? It compiles to 7789 words used while the 18F2620 compiles to 14146 bytes.

    it sounds more like a calculated jump or memory offset has gone out of limits, maybe if you post the entire error message
    but sometimes the clues are pretty vague




    While I'm here... how does one capture/copy the results messages? I appear to highlight it (turns black) but ^c has no effect
    its not quite a clean copy though
    Attached Images Attached Images  
    Warning I'm not a teacher

  2. #2
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Hi Richard,

    Thanks for taking the time to help.

    I was too quick in my last post - I had not upgraded to PBP3.0.10 when I did those tests, I guessed it was a MPASM issue...

    I then installed PBP3.0.10 and repeated the exercise - it's all good! No error messages and zero verification errors when burning the chip. In hindsight I should have done everything first and then posted - Doh!

    Thanks for the info on copying the results area, a great resource I'll make a note of. I hope these findings are useful for others who may experience similar difficulties.

    Thanks again and best regards,
    Bill

  3. #3
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Hi All,

    Since my last post on this subject I've tested the 16F1847 in my custom pcb following a good compile and verification (after upgrading MPLAB/MPASM/PBP3).

    The results are not good (please see attached files). The hardware is confirmed good as the GLCD displays "Hello World" correctly but fails miserably when the @ printstr x,y,"xxxxx" command is invoked. I've had good success using this and more on a 16F88 pic and I need something with more codespace.

    If there are any takers out there with advice on how to crack this, you have my attention...

    Code:
    
    '*****************************************************************************
    '*  Name    : Bill's Retic testing.pbp                    #### NON Working Code ####    *                                      
    '*  Author  : WJ Sherwood                                                    *
    '*  Date    : 02/05/18                                                       *
    '*  Device  : 16F1847 (8k code space)                                        *
    '*  Version : 1.0  2588 words with PBP 3.0.10.4                              *
    '*  Notes   :                                                                *
    '*          : Hello World works fine but @ PrintStr 6,3,"Reticulation" does  *
    '*          : not and causes strange effects.                                *
    '*          :                                                                *
    '*          :                                                                *
    '*****************************************************************************
    '
    ' Connections as follows:
    '
    '      	    PIC(F1847)            OTHER		
    '      	    PortA.2 (pin 1)     SDA on Nokia module.     
    '     	    PortA.3 (pin 2)     D/C on Nokia module.     
    '      	    PortA.4 (pin 3)     RST on Nokia module.     
    '    MCLR   PortA.5 (pin 4)     10k pullup to 5v via diode for ICSP.
    '    Vss    Ground  (pin 5)		CS on Nokia module.		
    ' 		    PortB.0 (pin 6)     Spare.		             
    ' 		    PortB.1 (pin 7)	    
    '		    PortB.2 (pin 8)     
    '   (CCP1)	PortB.3 (pin 9)     Spare.
    '		    PortB.4 (pin 10)     		
    '		    PortB.5 (pin 11)	
    '		    PortB.6 (pin 12)    
    ' 		    PortB.7 (pin 13)    Spare.
    '    Xtal   PortA.6 (pin 15)    Spare.  LCD pin hard grounded.   
    '    Vdd    5 volts (pin 14)			
    '    Xtal   PortA.7 (pin 16)    LED indicator and optocoupler driver for Triac/solenoid valve.     
    '     	    PortA.0 (pin 17)    LED backlight on Nokia module. 
    '      	    PortA.1 (pin 18)    SCK on Nokia module.
    
    ' NOKIA 3310 LCD (eBay) MODULE PINOUT
    ' as viewed from the FRONT (left -> right)
    '     ---------------------
    '    |       oooooooo      |   Note actual display area is 30x21mm.
    '    |       1      8      |
    '     ---------------------
    '    |                     |
    '    |                     |
    '    |                     |
    '    |                     |
    '     ---------------------
    '    |       oooooooo      |   
    '    |       1      8      |
    '     ---------------------
    '
    '1 !rst  portA.4    
    '2 !cs   Gnd    #### works fine grounded, saved a pin here.
    '3 d/!c  portA.3    
    '4 sda   portA.2    (pulled high 4k7).  Runs okay without it (pullup on pcb?).
    '5 sclk  portA.1    
    '6 vcc   3.3v       
    '7 Led   portA.0    Gnd to light - connects to vcc (via smd resistor if solder JP near pin 8 top), max 3v3 supply!                
    '8 gnd                    
    
    '=====================================================================================================
    '        CONFIGURE DEVICE
    '=====================================================================================================
     
    @ ERRORLEVEL -306   ; turn off crossing page boundary message
    
    #CONFIG ; F1847.
            __config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_OFF
            __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #ENDCONFIG
    
    ' -----[ Initialization ]------------------------------------------------------------------------------------------------ 
     
        clear                   ' ****** Clear statement must be before any INC file.******
    
        Include "MODEDEFS.BAS"          ' Include Shiftin/out modes.
        include "LCD_3310v32 WJS.inc"   ' Edited for current hardware connections.
    
        TRISA = %00000000   ' All outputs.
        TRISB = %00000000   ' All outputs.
        ANSELA = 0          ' Turn off analog port A
        ANSELB = 0          ' Turn off analog port B
        CM1CON0 = 0         ' Comparators off.
        CM1CON1 = 0
        CM2CON0 = 0         ' Comparators off.
        CM2CON1 = 0
        CPSCON0 = 0         ' Capacitive sense module off.
        OSCCON = %01101010  ' 4Mhz (F1847).
    '    INTCON = %00001000  ' B.3 = 1 - Interrupt on change Enable bit.
    '    IOCBN = %00110000   ' Enable IOC falling edge on PORTB.4-5 (pulled up).
    '    IOCBP = 0           ' Disable IOC rising edge on PORTB.
    
    ' Stored onboard E2...
    Message Data "Bill's DIY Retic testing"  
    
    '=====================================================================================================
    '        PIN ASSIGNMENTS, SYSTEM CONSTANTS, TEMPORARY VARIABLES
    '=====================================================================================================
    ' Alias pins
    Triac   var PortA.7     ' Optocoupler drives the triac/solenoid.
    
        GOTO Satu           ' Jump over the subroutines area.
    
    '=====================================================================================================
    ' Subroutines here in the first page...
    '=====================================================================================================
    Splash:     ' Show opening screen.
    '@ PrintStr 12,2,"Bill's DIY"        ; the single quote causes problems within the asm - workaround below.
    '@ PrintStr 12,2,"Bill"              ; First part.
    '   Lcd_Data = "'"                   ' Note byte size single char.
    '   Gosub Lcd_SendChar               '
    '@ PrintStr 42,2,"s DIY"             ; Final part.
    @ PrintStr 6,3,"Reticulation"       ; Line 4.
    @ PrintStr 18,4,"02May18"           ; Line 5.
    @ PrintStr 0,5,"Push to select"     ; Line 6.
        return
    
    '=====================================================================================================
    ' Program area...
    '=====================================================================================================
     Satu:      ' Operation when system first powered up. 
    pause 1000
        pulsout Triac, 20000    ' Heartbeat for testing, 200ms.        
        gosub Lcd_Init      ' Initialize LCD.
        gosub Scr_Normal    ' Normal Black on White.                                  
        Gosub Splash        ' Show opening screen.            
        pause 3000          ' 3 seconds.
    
    gosub Lcd_Clear         ' Clear contents of screen
    pause 50
    
    PosX = 30:PosY = 0:gosub Lcd_GotoXY ' position 30 of 84 in the x direction, row 0 (of 0 to 5)
    Lcd_Data = "H"
    gosub Lcd_SendChar
    Lcd_Data = "E"
    gosub Lcd_SendChar
    Lcd_Data = "L"
    gosub Lcd_SendChar
    Lcd_Data = "L"
    gosub Lcd_SendChar
    Lcd_Data = "O"
    gosub Lcd_SendChar
    
    PosX = 30:PosY = 1:gosub Lcd_GotoXY ' position 30 of 84 in the x direction, row 1 (of 0 to 5)
    Lcd_Data = "W"
    gosub Lcd_SendChar
    Lcd_Data = "O"
    gosub Lcd_SendChar
    Lcd_Data = "R"
    gosub Lcd_SendChar
    Lcd_Data = "L"
    gosub Lcd_SendChar
    Lcd_Data = "D"
    gosub Lcd_SendChar
    Lcd_Data = "!"
    gosub Lcd_SendChar
    
        pause 1000              ' 
        gosub Lcd_Clear         ' Clear contents of screen
        goto Satu               ' Repeat
    
    end
    LCD_3310v32 WJS.inc.txt

    FWIW there is a similar thread I posted under "Using Nokia LCD" today concerning the troublesome 16F1847 but using mister_e's Nokia wrapper (which succeeds Scale Robotics' earlier macro used in this Hello World example)... I'm sure there is a common problem with both.

    Best regards,
    Bill

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    the problem is in this macro
    Code:
    ASM
    PrintStr macro x, y, Str
        local TheString, OverStr
        goto OverStr
    TheString
        data   Str, 0
    OverStr
        MOVE?CB  x, _PosX
        MOVE?CB  y, _PosY
        MOVE?CW  TheString, _Addr
        L?CALL   _StringOut
        endm
    ENDASM
    its not that simple going from code for pic18 to pic16
    the word size for core 14 pics ie pic16 is 14bits
    the "data" directive attempts to write two 8 bit pieces of data into a 14bit slot ,hence the end falls off



    you could change it to use the "da" directive to pack two 7 bit pieces of data into that space [its ok for 7bit ascii]
    but then you need to unpack the data when you read it back
    Warning I'm not a teacher

  5. #5
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Hi Richard,

    Hmmm, then why does it work perfectly on an F88?

    Can you give me an example how I can change to "da" and then unpack please?

    Kind regards,
    Bill

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    if you look at the lst file the compiler detects a problem for the 16f88 and still generated the wrong result

    16f88 lst

    Code:
    0934                      M TheString
    Message[303]: Program word too large.  Truncated to core size. (5265)
    Message[303]: Program word too large.  Truncated to core size. (7469)
    Message[303]: Program word too large.  Truncated to core size. (6375)
    Message[303]: Program word too large.  Truncated to core size. (6C61)
    Message[303]: Program word too large.  Truncated to core size. (7469)
    Message[303]: Program word too large.  Truncated to core size. (6F6E)
    0934   1265 3469 2375     M     data   "Reticulation", 0
           2C61 3469 2F6E 
           0000
    16f1847
    Code:
      0000                    M     local TheString, OverStr
    0971   2979               M     goto OverStr
    0972                      M TheString
    0972   1265 3469 2375     M     data   "Reticulation", 0
           2C61 3469 2F6E 
           0000 
    0979                      M OverStr
    pic18 the correct result
    Code:
                          02715  PrintStr 6,3,"Reticulation"       ; Line 4.
      0000                    M     local TheString, OverStr
    0011FE EF08 F009          M     goto OverStr
    001202                    M TheString
    001202 6552 6974 7563     M     data   "Reticulation", 0
           616C 6974 6E6F 
           0000 
    001210                    M OverStr



    maybe it was ok in older versions of complier , I doubt it though ,wrong is wrong
    Last edited by richard; - 3rd May 2018 at 07:22. Reason: spelling
    Warning I'm not a teacher

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    I think Charles should be informed about this.

    Ioannis

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Can you give me an example how I can change to "da" and then unpack please?
    in the offending macro find the word "data"

    delete the t and and one of the remaining a's in that word


    to unpack

    read in the low byte , store bit 7 value of low byte then bitwise and (&) the low byte with 127
    then
    read in the high byte left shift it left 1 digit then add 1 to result if bit7 result from low byte is not zero

Similar Threads

  1. 16F1847 Usart and I2C
    By Seahound1 in forum Serial
    Replies: 6
    Last Post: - 18th December 2012, 20:41
  2. Replies: 3
    Last Post: - 1st July 2008, 21:07
  3. DTMF verification
    By lerameur in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st May 2008, 23:28
  4. Data verification
    By Daniel Simões in forum Serial
    Replies: 5
    Last Post: - 26th August 2006, 02:59
  5. Timing verification.
    By Dwayne in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2004, 15:44

Members who have read this thread : 0

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