-
Ordering information
Call us or mail us for inquiries & availability: info@mtronixtech.com
-
Search projects by Price
-
Project Categories
- Robots and Robotics
- GSM based Projects
- GPS based Projects
- RFID based Projects
- Energy Saving
- Wireless Communication
- DTMF based projects
- SMS based projects
- RF Remote
- Mobile Controlled
- Power Saver
- Sensor based Projects
- Alcohol Sensor
- heartbeat Sensor
- Humidity Sensor
- Infrared Sensor
- Level Sensor
- Light Sensor
- LPG Gas Sensor
- Moisture Sensor
- Temperature Sensor
- Vibration Sensor
- Weight Sensor
-
Search projects by Application
Project Videos:
Landrover Robot Operated by Cellphone
Industrial Automation using Cellphone
Password based door locking
Automatic room light controller
Temperature controlled fan
Electronic voting machine
Search by Components
89c51 89s51 89s52 89v51RD2 555 ADC0808 ADC0809 AT24c16 AT24c64 AT89s52 Battery BC547 Bulb Buzzer Darlington Pair DC motor Decoder EEPROM Fan GPS GSM IR LED Keypad L239D LCD Display LDR LED LM35 LM358 Matrix keypad MAX232 Motor Driver MQ6 PC Interface Relay RFID Card RFID Reader RFID Tags Sim300 sim900 SR86 SR87 Stepper Motor SYHS220 TSOP1738
Assembly code for EEPROM 24c16
Sample code for EEPROM 24c16.
Following code can be using for 8051 and 8052 ICs like: 89c51, 89c52, 89s51, 89s52, 89c2051.
And with little bit modification, this assembly program can be used for: 24c02, 24c04, 24c08, 24c32
;========================================================== ; Pin Definations ;========================================================== eeprom_scl_pin equ a4h ;scl p2.4 eeprom_sda_pin equ a5h ;sda p2.5 ;========================================================== ; Main Program starts from here ;========================================================== mov memory_address1,#00h mov memory_address2,#00h mov eeprom_data,#05 call write_data mov memory_address1,#00h mov memory_address2,#00h call read_data mov 5dh,3ch loop jmp loop ;========================================================= ; Sub routines starts from here ;========================================================= write_data call eeprom_start mov a,#a0h call send_data mov a,memory_address1 ;location address call send_data mov a,memory_address2 ;location address call send_data mov a,eeprom_data ;data to be send call send_data call eeprom_stop ret ;========================================================= read_data call eeprom_start mov a,#a0h call send_data mov a,memory_address1 ;location address call send_data mov a,memory_address2 ;location address call send_data call eeprom_start mov a,#a1h call send_data call get_data call eeprom_stop ret ;========================================================= eeprom_start setb eeprom_sda_pin nop setb eeprom_scl_pin nop nop clr eeprom_sda_pin nop clr eeprom_scl_pin ret ;========================================================= eeprom_stop clr eeprom_sda_pin nop setb eeprom_scl_pin nop nop setb eeprom_sda_pin nop clr eeprom_scl_pin ret ;========================================================= send_data mov r7,#00h send rlc a mov eeprom_sda_pin,c call clock inc r7 cjne r7,#08,send setb eeprom_sda_pin jb eeprom_sda_pin,$ ; call eeprom_delay call clock ret ;========================================================= get_data mov r7,#00h setb eeprom_sda_pin get mov c,eeprom_sda_pin call clock rlc a inc r7 cjne r7,#08,get setb eeprom_sda_pin call clock mov 3ch,a ret ;========================================================= clock setb eeprom_scl_pin nop nop clr eeprom_scl_pin ret ;========================================================= eeprom_delay mov 33h,#11 ;delay of 3 msec eeprom_delay_1 mov 32h,#ffh djnz 32h,$ djnz 33h,eeprom_delay_1 ret ;===================================================== ; Program ENDS here ;=====================================================