+ Reply to Thread
Results 1 to 6 of 6

Thread: External memory interface in Bascom

  1. #1
    Moderator tibbu is an unknown quantity at this point tibbu's Avatar
    Join Date
    Apr 2008
    Location
    India
    Posts
    286

    Default External memory interface in Bascom

    Hello Binu sir,

    I have done a simple code in BASCOM for a clap switch. My problem is that after power failure the relay resets to off position. I want to store port status into external memory. Pls help me how to do this.

    Thank you

    Optimus Prime is here with you

  2. #2
    Administrator Binu is an unknown quantity at this point Binu's Avatar
    Join Date
    Jun 2007
    Location
    Nagercoil, Tamilnadu, India.
    Posts
    6,126

    Default

    Use some I2C EEPROM chips. They are easy to interface with 8051.
    Also you can get sample code with the examples of bascom.
    Check the code library page for more details.

    [Check out the new 8051 blog]

  3. #3
    Moderator tibbu is an unknown quantity at this point tibbu's Avatar
    Join Date
    Apr 2008
    Location
    India
    Posts
    286

    Default

    Hello sir i have seen the Code library page but there is no code in bascom for EEPROM interface.

  4. #4
    Administrator Binu is an unknown quantity at this point Binu's Avatar
    Join Date
    Jun 2007
    Location
    Nagercoil, Tamilnadu, India.
    Posts
    6,126

    Default

    Here's the sample code to read and write a byte from I2C EEPROM
    'sample of writing a byte to EEPROM AT2404
    Sub Write_eeprom(adres As Byte , Value As Byte)
    I2cstart 'start condition
    I2cwbyte Addressw 'slave address
    I2cwbyte Adres 'asdress of EEPROM
    I2cwbyte Value 'value to write
    I2cstop 'stop condition
    Waitms 10 'wait for 10 milliseconds
    End Sub


    'sample of reading a byte from EEPROM AT2404
    Sub Read_eeprom(adres As Byte , Value As Byte)
    I2cstart 'generate start
    I2cwbyte Addressw 'slave adsress
    I2cwbyte Adres 'address of EEPROM
    I2cstart 'repeated start
    I2cwbyte Addressr 'slave address (read)
    I2crbyte Value , 9 'read byte
    I2cstop 'generate stop
    End Sub


    [Check out the new 8051 blog]

  5. #5
    Moderator tibbu is an unknown quantity at this point tibbu's Avatar
    Join Date
    Apr 2008
    Location
    India
    Posts
    286

    Default

    Thank you so much sir i will implement above code today and come back.

  6. #6
    Moderator tibbu is an unknown quantity at this point tibbu's Avatar
    Join Date
    Apr 2008
    Location
    India
    Posts
    286

    Default

    Thank you binu sir. my problem is solved.


+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts