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,

    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

  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

    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

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


    Did you find this post helpful? Yes | No

    Default @ printstr woes with 16F1847

    Hi Richard,

    I've studied your hints and hacked away all day with no success, I've concluded it's beyond me so will give up on this idea. I spent a lot of time looking at your ssd1306 code also and suspect it could be modified to use on the 84x48 pixel Nokia display, but that too is over my head. I have fully functioning code working on an 18F so will use it instead, I just have to manufacture another pcb to scale up from dip18 to dip28, kicking myself for not doing that in the first place.

    I'm not wasting more time on this because it is overtaken by Mister_e's code, which I mentioned earlier works flawlessly on a F88, but has similar issues with a 16F1847 as this thread. If you haven't done already please take a look at the "Using Nokia LCD" post - if it can be made to work on this chip it opens the door to a lot more projects. Over 200,000 views on this thread shows there are a lot of folks interested in these cheap graphic displays so I think it is worth doing.

    PM me your address and I'll post a display module with 16F1847 to you for your use as a small token of appreciation for your ongoing contributions, you should get it next week.

    Kind regards,
    Bill

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


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    I'll post a display module with 16F1847 to you for your use as a small token of appreciation for your ongoing contributions, you should get it next week.
    A generous offer , when I get it I will see if I can port my ssd1306 code to that display.
    it does not look too difficult [famous last words]
    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

    No problem, I just packed it in a small padded Jiffy bag and will post tomorrow - check your PM.

    Did you take a look at Mister_e's work on the "Using Nokia LCD" by chance? You sound like you are the man to take it from its 99% to that last 1% (and, fingers crossed, able to work with the 16F1847). Steve did a great job but I fear he is no longer around such is the deafening silence, hope I'm wrong.

    Kind regards,
    Bill

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


    Did you find this post helpful? Yes | No

    Default Re: Code verification errors 16F1847

    Did you take a look at Mister_e's work on the "Using Nokia LCD" by chance?
    I have looked but its chief issue for me is the way the font is stored/retrieved ,for a pic16 with limited resources
    its just too inefficient. if it ports to the method I used for the ssd1306 controller then it will be a better result.
    not only that imho usercommand [a sadly underused feature ] makes nicer code
    Warning I'm not a teacher

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