Code verification errors 16F1847


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    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

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    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

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    I think Charles should be informed about this.

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Thanks Richard,

    I'm no aficianado with asm and if needed it sort of defeats the purpose being on a PicBasicPro forum, but it is fast becoming apparent one needs to know some asm if one wants to excel with anything that extends PBP out of its comfort zone and to its boundaries. I'm almost completely ignorant on this subject despite being very willing to learn. I'd like to think those who are very knowledgeable and experienced in such matters would welcome the opportunity to pass on same and offer due guidance - call it a legacy if you will.

    I don't want anyone to write my code for me but I'm flying blind under these circumstances and have no clue on such matters.

    While I can make the change from data to da I don't have much idea how to perform the unpack - while I am grateful for your help, reading it is difficult to understand. If your suggestion means I have to make the changes for every @ printstr line (a learning curve all of its own) then it will be easier pulling teeth and I'd suggest the whole macro thing is a waste of time for me - easier to stick with 18F's to do the job, which don't seem to show this problem. This being the case I'd jump across to Swordfish and dispense with PBP completely but I like to use the 12F and 16F series - and don't like being forced into doing anything I don't want to!

    Charles, following on from Ioannis' prompt, if you can shed some light here, please do so. Apart from Richard there is very little input seen to date. If it is all too difficult then I'll move away from these Nokia displays to something more accommodating.

    Kind regards,
    Bill

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Charles, following on from Ioannis' prompt, if you can shed some light here, please do so. Apart from Richard there is very little input seen to date. If it is all too difficult then I'll move away from these Nokia displays to something more accommodating.
    there is no pbp error here . the asm "data" directive in inappropriate for core 14 devices

    I don't want anyone to write my code for me but I'm flying blind under these circumstances and have no clue on such matters
    what part of my description can't you not follow , there is no need for asm at all to do this.


    hint
    Code:
    packedbit var bit
    StringOut:
        Readcode Addr, Char           ' Get a character    would be the low byte
        packedbit= char.7 
        char=char&127
      .......
    Warning I'm not a teacher

  6. #6
    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 the help. I started work Friday so my time on the forum will be a lot less from now on unfortunately - but good that I have an income now after so long.

    Can I ask: have you tried these changes yourself and seen the results on a Nokia 3310 lcd? I tried your suggestion per my interpretation below and it compiled/assembled without errors but the result was the same as if the changes were not made - so I'm assuming I didn't do it correctly or am still missing something.

    I made the following edits after replacing data with da:

    Code:
    'for @ printstr
    Addr  VAR WORD
    'Char  VAR byte ' lcdchardata[0]   [WJS] as it was
    Char  VAR word ' lcdchardata[0]    [WJS] now for modification
    
    StringOut:
    ' Edits for 16F devices.
        Readcode Addr, Char             ' Get a character
        if Char = 0 then StringDone     ' Look for Null char, Stop if found
    packedbit = char.7                  ' Store bit 7 value of low byte 
    char.lowbyte = char.lowbyte&127     ' Bitwise And (&) the low byte with 127
    
    Char.highbyte = (Char.highbyte <<1) ' left shift the high byte 1 digit (multiplying by 2n)
    	if packedbit <> 0 then
    	Char.highbyte = Char.highbyte+1
    	endif
    
        Gosub  Lcd_GotoXY
        Lcd_Data = Char
        
        gosub Lcd_SendChar            ' puttext
        Addr = Addr + 1               ' Point to next character
        PosX = PosX + 6
        if PosX > 78 then             ' If end of line, cycle to next line
            PosY = PosY + 1           
            PosX = 0
        endif
        goto StringOut                ' Continue with rest of the string
    
    '' Original
    '    Readcode Addr, Char           ' Get a character
    '    if Char = 0 then StringDone   ' Look for Null char, Stop if found
    '    Gosub Lcd_GotoXY
    '    Lcd_Data = Char
        
    '    gosub Lcd_SendChar            ' puttext
    '    Addr = Addr + 1               ' Point to next character
    '    PosX = PosX + 6
    '    if PosX > 78 then             ' If end of line, cycle to next line
    '        PosY = PosY + 1           
    '        PosX = 0
    '    endif
    '    goto StringOut                ' Continue with rest of the string
    
      StringDone:
    return
    Please show me where have I blundered.

    Kind regards,
    Bill

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    I don't have a nokia display so I can't really try any of this.

    you have not shown how u modified the macro

    Code:
    'for @ printstr
    Addr  VAR WORD
    'Char  VAR byte ' lcdchardata[0]   [WJS] as it was
    Char  VAR word ' lcdchardata[0]    [WJS] now for modification
    
    StringOut:
    ' Edits for 16F devices.
        Readcode Addr, Char             ' Get a character
    
    
    
        if Char = 0 then StringDone     ' Look for Null char, Stop if found
    will not work as intended since either the high byte or the low byte could be a null not necessarily both
    packedbit = char.7                  ' Store bit 7 value of low byte 
    char.lowbyte = char.lowbyte&127     ' Bitwise And (&) the low byte with 127
    
    Char.highbyte = (Char.highbyte <<1) ' left shift the high byte 1 digit (multiplying by 2n)
    	if packedbit <> 0 then
    	Char.highbyte = Char.highbyte+1
    
    	endif
    
        Gosub  Lcd_GotoXY
        Lcd_Data = Char
        
        gosub Lcd_SendChar            ' puttext
        Addr = Addr + 1               ' Point to next character
    the address would now need to incremented by 2 
    and when did you send the highbyte to the screen ?
        PosX = PosX + 6
        if PosX > 78 then             ' If end of line, cycle to next line
            PosY = PosY + 1           
            PosX = 0
        endif
        goto StringOut                ' Continue with rest of the string

    if codespace is a big issue then

    Lcd_SendChar:
    lookdown Lcd_data,_
    [" !\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],CharNum
    Lcd_data = CharNum +32

    wastes 117 words of code space for no appreciable reason



    SELECT CASE lcd_data
    Case 32
    FC(0)=$00:FC(1)=$00:FC(2)=$00:FC(3)=$00:FC(4)=$00 ' // sp
    Case 33
    FC(0)=$00:FC(1)=$00:FC(2)=$2f:FC(3)=$00:FC(4)=$00 ' // !
    Case 34
    FC(0)=$00:FC(1)=$07:FC(2)=$00:FC(3)=$07:FC(4)=$00 ' // " (shown as \ in Lookdown table)
    .......................

    manages to use 1662 words of code space to store 235 words of data, it could be far more efficient

    see http://www.picbasic.co.uk/forum/showthread.php?t=23758

    where I use a 7x8 font that is stored as a packed 14bit array for pic16 chips , the posted code has routines to unpack the font
    Warning I'm not a teacher

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


    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