PIC16F690 - 24LC08B: they won't talk...


Results 1 to 17 of 17

Threaded View

  1. #1
    xnihilo's Avatar
    xnihilo Guest

    Unhappy PIC16F690 - 24LC08B: they won't talk...

    Hello,

    I'm p....d off right now.
    I'm using a PIC16F690.
    I'm trying to store and read back 1 databyte to a 24LC08B EEPROM.
    I connected the EEPROM accroding to the schematics found in PBP manual (I2C section).
    It does not seem to work.
    I've checked to see if I had VDD and VSS at eeprom pins, alright, I use 4.7k WPU; alright.
    I don't see what can be wrong. I paste snippets related to this code section.

    What's funny is that when I display the value of the value read after the write I get "0" which is not the initial value of the variable before the write. It means it can read (assuming the read walue is "0" but it cannot write (= write value '33' at first position in EEPROM... Why?

    Could someone have a look?

    Variable declaration:

    Code:
    ep_address VAR BYTE
    eep_control VAR BYTE
    
    checkwrite var BYTE         'used to check external EEPROM (in mag) operations

    Registers setting
    Code:
    OSCCON = %01110001	'int osc, hs, 8mhz
    ''''''CMCON0 =  %00000111			'comparators OFF, val = 7
    
    CM1CON0.7 = 0           'comparator1 disabled
    CM2CON0.7 = 0           'comparator2 disabled
    
    ANSEL = %00000000			'choose digital i/o, val = 0
    OPTION_REG = %01111111 			'enable internal porta weak pullups resistors (no weak pull-up available for porta.3), p12. they bring pin to High state; to set a change, pull pin to ground
    
    
    'First PORT then TRIS, see Mid-range MCU DS !!!
    
    TRISA = %011011 	'a5 is output (to lcd pins), A4 is input from supplier (score request)
    TRISC = %00000000
    TRISB = %0000
    
    WPUA =  %000111 			'enable weak pull ups individually on portA
    'Rem: porta.3 (MCLR) has no internal weak pullups, we add an external 10k WPU !!!!
    '100k wpd on A4
    WPUB = %0000
    
    
    PORTA = %001111 			'set pins logic
    PORTB = %0000
    PORTC = %00000000 			'set pins logic
    'porta pins with weak pullups will be set to high (i.e. 5v by the pullups)

    Variables initialization

    Code:
    eep_address = 0
    eep_control = %10100000 'block 0 (of 0-3), byte 0 (of 0 to 255)
    The code section writing and checking EEPROM

    Code:
        'routine that checks if the external eeprom (the mag) is connected to the supplier
        'it writes than reads back the test value (33)
        checkwrite = 33
        eep_address = 0     'use storage byte 1 of 255 fo rthe test
        I2CWRITE PORTC.6,PORTC.7,eep_control,eep_address,[checkwrite]    'store maxitem value in the mag external EEPROM
        PAUSE 15        'hadware dependent
        I2CREAD PORTC.6,PORTC.7,eep_control,eep_address,[checkwrite]    'store maxitem value in the mag external EEPROM
        LCDOUT $fe,1,"I2C:",#checkwrite
        PAUSE 2000
        IF (checkwrite != 33) then
            LCDOUT $fe,1,"couldn't write"
            PAUSE 4000
            checkwrite = 0
            GOTO endofroutine
        ENDIF
        checkwrite = 66
    Last edited by xnihilo; - 22nd May 2008 at 01:36.

Similar Threads

  1. PIC16F690 code help please
    By hysteria92 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 24th February 2010, 16:17
  2. PIC16f690 LCD Not Working
    By hhosteam in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 3rd June 2009, 06:26
  3. Replies: 1
    Last Post: - 19th February 2009, 13:35
  4. Replies: 0
    Last Post: - 13th February 2009, 03:34
  5. gps rikaline x5 to pic16f690
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 9th May 2008, 11:21

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