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
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
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]
Hello sir i have seen the Code library page but there is no code in bascom for EEPROM interface.![]()
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]
Thank you so much sir i will implement above code today and come back.
Bookmarks