nikhildascl
Full Member level 3
- Joined
- Apr 15, 2012
- Messages
- 150
- Helped
- 15
- Reputation
- 30
- Reaction score
- 14
- Trophy points
- 1,318
- Location
- Kerala, India
- Activity points
- 2,115
How to use flash memory of 89C51 to save and read data?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 Read_EEPROM: Acall I2C_Start Mov A,#0A0h Acall I2C_Write Mov A,Dph Acall I2C_Write Mov A,Dpl Acall I2C_Write Acall I2C_Start Mov A,#0A1h Acall I2C_Write Acall I2C_Read Acall I2C_Stop Ret Write_EEPROM: Push Acc Acall I2C_Start Mov A,#0A0h Acall I2C_Write Mov A,Dph Acall I2C_Write Mov A,Dpl Acall I2C_Write Pop Acc Acall I2C_Write Acall I2C_Stop Ret I2C_Start: Setb SDA Nop Nop Nop Nop Setb SCL Nop Nop Nop Nop Clr SDA Nop Nop Nop Nop Clr SCL Ret I2C_Stop: Clr SDA Nop Nop Nop Nop Clr SCL Nop Nop Nop Nop Setb SCL Nop Nop Nop Nop Setb SDA Ret I2C_Write: Mov B,#08h I2C_Write_B: Rlc A Mov SDA,C Setb SCL Clr SCL Setb SDA Djnz B,I2C_Write_B Mov C,SDA Setb SCL Clr SCL Ret I2C_Read: Mov B,#08h I2C_Read_B: Mov C,SDA Setb SCL Mov C,SDA Rlc A Clr SCL Djnz B,I2C_Read_B Mov C,SDA Setb SCL Clr SCL Ret
I don't know for this. It depends on any simulator's facility.Ok friend. How we can see the data locations in simulation? Is that possible?
Code ASM - [expand] 1 2 3 4 5 6 7 8 ;To write data to EEPROM location 1234h, source at accumulator Mov Dptr,#1234h Mov A,#15h Acall Write_EEPROM ;------------------------------------------------------- ;To read data from EEPROM location 5678h, result is at accumulator Mov Dptr,#5678h Acall Read_EEPROM