24c256 by atmel


Closed Thread
Results 1 to 5 of 5

Thread: 24c256 by atmel

  1. #1
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27

    Question 24c256 by atmel

    Hello pic friends!
    One simple question. Is it possible somehow to read and write
    24C256 eeprom from Atmel with i2cread and i2cwrite commands?
    the protocol is 2 wire, not i2C but it looks similar?

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yes it is possible. 2 wires or I2C is often the same thing. Same for SPI, 3 wire interface and Microwire.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27


    Did you find this post helpful? Yes | No

    Question How?

    Why then this piece of code doesn't work on Atmel 24C256 and works with
    24LC32A from Microchip? I get five times 04 on LCD in case of Atmel chip.
    The hardware configuration is the same: pin1,2,3,8 on Vcc,4 on gnd, 5 SDA amd 6 scl with 4K7 pull ups. Pic is 16F876 with 20MHz crystal.
    Code:
    define LOADER_USED 1
    define OSC 20
    define LCD_EREG PORTC
    define LCD_EBIT 1
    
    Symbol SDA = PORTC.2     
    Symbol SCL = PORTC.3    
    addr_EE var word          
    value var byte
    CTRL_EE con %10101110   
    
    ADCON1=7
    TRISA=$00
    
    lcdout $fe,1
    main:
    
    
        lcdout "Writing..."
        pause 200
        
        value=1
        addr_EE=0
        I2CWrite sda, scl, CTRL_EE, addr_EE, [value]
        pause 10
        
        value=2
        addr_EE=1
        I2CWrite sda, scl, CTRL_EE, addr_EE, [value]
        pause 10
        
        value=3
        addr_EE=2
        I2CWrite sda, scl, CTRL_EE, addr_EE, [value]
        pause 10
        
        value=4
        addr_EE=3
        I2CWrite sda, scl, CTRL_EE, addr_EE, [value]
        pause 10
        
        value=5
        addr_EE=4
        I2CWrite sda, scl, CTRL_EE, addr_EE, [value]
        pause 10
        
        lcdout $fe,1,"Finished"
    
    lcdout $fe,1
    for addr_EE=0 to 4
        I2CRead sda, scl, CTRL_EE, addr_EE, [value]
        lcdout dec2 value," "
    next 
    pa: goto pa
    end
    Thanks for answers!

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's no A2 assignement for this one...how about if you change...
    Code:
    CTRL_EE con %10101110
    to
    Code:
    CTRL_EE con %10100110
    be sure you also set WP (pin 7) to GND.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27


    Did you find this post helpful? Yes | No

    Smile It works!

    Thank you very mach Mister E!
    It works now! i was in a hurry and didn't look at datasheet with enough
    attention.
    Thanks again.

Similar Threads

  1. Pic Vrs Atmel speed
    By shawn in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th April 2008, 21:50
  2. 16f877 to 24c256
    By TheBorgCollecti in forum mel PIC BASIC
    Replies: 0
    Last Post: - 12th October 2007, 18:53
  3. SPI configuration PIC versus Atmel
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th July 2007, 19:17
  4. data from rs232 via pic16f877 to 24c256 (i2C) on-the-fly
    By agucollins in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th March 2005, 12:01
  5. data from pc thru rs232 via 16f877 to 24c256 on-the-fly
    By agucollins in forum mel PIC BASIC
    Replies: 1
    Last Post: - 24th March 2005, 17:26

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