I2CWRITE not writing anything on PIC18F45K80


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    460


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    just saying... "Problem is definitely in arrays... but as soon their total length exceeds 24 bytes, issues start to appear. " doesn't seem to pan out.

    The following reads three 16-byte arrays (48 bytes total) 20K times and verifies the arrayreads. No errors.
    Same with the original two 16-byte arrays.

    Code:
    ' device = 18F45K80
    
    topline var byte [16]  'top part of the screen array
    botline var byte [16] 'bottom part of screen
    line3   var byte [16] 'more array data
    
    ix var byte
    ct var byte
    cb var byte
    c3 var byte
    
    i var word
    fail var word
    
    fail = 0
    
    for i = 0 to 20000
        ' clear arrays
        for ix = 0 to 15
            topline[ix] = 0
            botline[ix] = 0
            line3[ix]   = 0
        next ix
    
        ' read array data
        arraywrite topline,["ABCDEFGHIJKLMNOP"]
        arraywrite botline,["QRSTUVWXYZ[\]^_`"]
        arraywrite line3,  ["abcdefghijklmnop"]
    
        'read array char by char and check
        for ix = 0 to 15
            ct = topline[ix]
            if (ct-"A" <> ix) then fail = fail + 1
            cb = botline[ix]
            if (cb-"Q" <> ix) then fail = fail + 1
            c3 = line3[ix]
            if (c3-"a" <> ix) then fail = fail + 1
        next ix
    next i
    
    ' check for failure
    if (fail > 0) then
        i = fail
    endif
    Tried both PBP 3.16 and PBPL. No difference.

    I just wrote another code, which simply reads values of array and writes data on 1602LCD.
    Issue still exists
    Post the complete code that doesn't work.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    Thanks, sure
    this weekend

  3. #3
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    The "complete" code is about 700 lines (and it is not complete yet).
    Found another bug.
    I call some subroutine, which uses own set of variables (verified)
    after calling it, value of totally different variable (not used in that part of code) gets random values.

    Very disturbing.
    Can this be compiler issues or maybe faulty chip itself?

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


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    Found another bug.
    I call some subroutine, which uses own set of variables (verified)
    after calling it, value of totally different variable (not used in that part of code) gets random values.


    Very disturbing.
    Can this be compiler issues or maybe faulty chip itself?
    if you can produce a minimal, complete and verifiable example [MCVE] that demonstrates the problem it would be the first
    ever case. do continue
    Warning I'm not a teacher

  5. #5
    Join Date
    Aug 2011
    Posts
    460


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    The "complete" code is about 700 lines (and it is not complete yet)
    You just said...
    I just wrote another code, which simply reads values of array and writes data on 1602LCD.
    Issue still exists
    That's the code that's 700 lines?

    If you're having issues then continuing to add more code isn't going to help.
    You should stop, and start trimming things down bit by bit until it starts working.
    Then you'll know what to look at.

    While compiler and chip issues are always a possibility, there's a much better chance you're just doing something wrong.

  6. #6
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    No that different code
    Now I'm back to "big" code.

    I'm trying now to isolate the problem and writing all from the scratch, part by part, verifying.

  7. #7
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    What I 100% figured out, by writing the small code is the 18F issue with ST7920 LCD.
    When I turn on the graphic mode, by sending LCDOUT $FE,$2E , there are high chances that random character in text mode will be displayed in top left corner.
    I tried adjusting timings and OSC settings - no change. Same code, same PCB, same LCD - no issues with 16F1939.

Similar Threads

  1. DT_Ints with PIC18F45K80 problem
    By Zapman in forum Code Examples
    Replies: 2
    Last Post: - 20th April 2022, 02:43
  2. Replies: 9
    Last Post: - 27th January 2015, 14:57
  3. PIC18F45K80 runs way to fast.
    By bmoe79 in forum PBP3
    Replies: 3
    Last Post: - 19th December 2014, 14:24
  4. I2CWrite issue
    By robertmark68 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th September 2006, 02:30
  5. I2CWRITE writing Strings to EEPROM
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th March 2005, 20:45

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