Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/i2c_eeprom.asm @ 455:c512a868937c
last work for 2.0: Fixing 32kB boundary read for logbook
author | heinrichsweikamp |
---|---|
date | Tue, 30 Aug 2011 16:29:21 +0200 |
parents | a76c5a3e9e96 |
children | 3091628b2742 |
comparison
equal
deleted
inserted
replaced
454:69f1f3a1c645 | 455:c512a868937c |
---|---|
125 | 125 |
126 clrf ext_ee_temp1 ; low address counter | 126 clrf ext_ee_temp1 ; low address counter |
127 clrf ext_ee_temp2 ; high address counter | 127 clrf ext_ee_temp2 ; high address counter |
128 bcf second_FD ; clear flags | 128 bcf second_FD ; clear flags |
129 bcf first_FD | 129 bcf first_FD |
130 bcf eeprom_switched_b1 | |
130 get_free_EEPROM_location3: | 131 get_free_EEPROM_location3: |
131 bsf SSPCON2, PEN ; Stop condition | 132 bsf SSPCON2, PEN ; Stop condition |
132 rcall WaitMSSP | 133 rcall WaitMSSP |
133 bsf SSPCON2,SEN ; Start condition | 134 bsf SSPCON2,SEN ; Start condition |
134 rcall WaitMSSP | 135 rcall WaitMSSP |
155 movwf SSPBUF ; control byte | 156 movwf SSPBUF ; control byte |
156 rcall WaitMSSP | 157 rcall WaitMSSP |
157 rcall I2C_WaitforACK | 158 rcall I2C_WaitforACK |
158 | 159 |
159 get_free_EEPROM_location2: | 160 get_free_EEPROM_location2: |
161 btfsc eeprom_switched_b1 ; Switched to Block1 already? | |
162 bra get_free_EEPROM_location2_x ; Yes, skip this check! | |
163 | |
164 btfsc ext_ee_temp2,7 ; Access Block1? | |
165 bsf eeprom_switched_b1 ; Yes, and set the flag so this check is skipped in the rest of this routine | |
166 btfsc ext_ee_temp2,7 ; Access Block1? | |
167 bra get_free_EEPROM_location3 ; Yes, initiate new read sequence in block1 | |
168 | |
169 get_free_EEPROM_location2_x: | |
160 bsf SSPCON2, RCEN ; Enable recieve mode | 170 bsf SSPCON2, RCEN ; Enable recieve mode |
161 rcall WaitMSSP | 171 rcall WaitMSSP |
162 btfsc first_FD | 172 btfsc first_FD |
163 bra test_2nd_FD | 173 bra test_2nd_FD |
164 bsf first_FD ; found first 0xFD? | 174 bsf first_FD ; found first 0xFD? |