I2CWRITE not writing anything on PIC18F45K80


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    No, there is no wiring error and when using HIGH or LOW statements, I can pull these pins up and down as normal.
    I mean, maybe there is some config error for 18F, which prevents I2CREAD/I2CWRITE from working?

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


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    to be clear

    provided it is wired correctly and the chip is pcf8574 the original code works just fine
    Warning I'm not a teacher

  3. #3
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    Change CONFIG XINST setting to OFF.

    Very few compilers are compatible with ON

  4. #4
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    Yes, you were right!
    Also XINST messes with LCDOUT.
    When XINST=ON, then DEC/HEX/BIN etc. modifiers of LCDOUT statement do not work.

    But why this is not mentioned in manual?
    Also, turning off XINST means we're turning off these extended instructions of 18F, so loosing all advantages these series have?

  5. #5
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    XINST changes the way some instructions work, so unless you have a compiler that supports it (like almost none), always set it off.

    You're not missing out on anything.

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


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    I've compared this code on 16F1939 @ 16 Mhz and 18F45K80 @ 64 Mhz and see zero improvement in speed (screen redraw time). I'm doing something wrong, or it should be that way? Here's config for 18F:

    Code:
    OSCTUNE.6 = 1 ; Enable 4x PLL
    OSCCON = %01110000
    ANCON1=0 'DISABLE ADC D3-D2-D1-D0-
    ANCON0=0
    ADCON0=0
    TRISC=%00000000 'set PORTC as output all
    TRISD=%00000000 'set PORTD as output all
    TRISB=%00000000 'set PORTB as output all
    TRISA=%00000000 'set PORTA 2 as input, others as output
    TRISE=%0000000  'set PORTE as output all
    define OSC 64
    And this is the main code (ST7920 library with custom fonts)

    Code:
    topline	var byte [18]
    arraywrite topline, ["SOMETEXT HERE  123"]
    C=0
    gosub GCODER
    arraywrite topline, ["SOMETEXT HERE  567"]
    c=8
    gosub gcoder
    arraywrite topline, ["SOMETEXT HERE  890"]
    c=16
    gosub gcoder
    C=24
    arraywrite topline, ["SOMETEXT HERE  XXX"]
    GOSUB GCODER
    stop
    
    
    
    
    GCODER:
    FOR X=0 TO 17 step 2	'READ ARRAY INTO VARIABLE, ARRAY MEMBER CHAR=EEPROM OFFSET	
    Y=(topline[x]-65)*8
    Z=(topline[x+1]-65)*8 'READ  INTO VARIABLE AS TWINS
    FOR I=0 TO 7	'HELPER LOOP FOR CHARACTER READING
    READ Y+I,A 'READ EEPROM BYTES INTO VAR
    READ Z+I,B
    LCDOUT $FE,$80+i+c 'UPDATE Y POSITION
    LCDOUT $FE,$80+x/2 'UPDATE X POSITION
    if topline[x]=32 then a=0
    if topline[x+1]=32 then b=0 'blanker
    LCDOUT a
    LCDOUT b 'WRITE TO SCREEN
    NEXT I
    NEXT X
    return

  7. #7
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: I2CWRITE not writing anything on PIC18F45K80

    It could be that the LCDOUT dominates the execution time, although I'd be surprised if it's "0 difference"

    Do you still have CONFIG FOSC = INTIO1?
    With that, you can measure the CLKOUT on the RA6/OSC2 pin just to verify the settings.

Similar Threads

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

Members who have read this thread : 1

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