Mercurial > public > hwos_code
comparison src/i2c.asm @ 18:4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
author | heinrichsweikamp |
---|---|
date | Wed, 03 Jul 2013 11:37:47 +0200 |
parents | 11d4fc797f74 |
children | 9b7dd3103545 |
comparison
equal
deleted
inserted
replaced
17:1f096c3d4b27 | 18:4e3f133dfbf4 |
---|---|
238 rcall I2C_TX | 238 rcall I2C_TX |
239 movlw 0x00 | 239 movlw 0x00 |
240 rcall I2C_TX | 240 rcall I2C_TX |
241 ; movlw b'01101001' ; ConfigA: 3Hz, 8 Samples averaged, Test Mode (Positive Bias) | 241 ; movlw b'01101001' ; ConfigA: 3Hz, 8 Samples averaged, Test Mode (Positive Bias) |
242 movlw b'01101000' ; ConfigA: 3Hz, 8 Samples averaged | 242 movlw b'01101000' ; ConfigA: 3Hz, 8 Samples averaged |
243 ; movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged | 243 rcall I2C_TX |
244 rcall I2C_TX | 244 movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) |
245 movlw b'00100000' ; ConfigB, 1090Gauss Gain | 245 swapf i2c_temp,F |
246 ; movlw b'10000000' ; ConfigB, 440Gauss Gain | 246 comf i2c_temp,F |
247 bcf STATUS,C | |
248 rlcf i2c_temp | |
249 movf i2c_temp,W | |
250 clrf i2c_temp | |
247 rcall I2C_TX | 251 rcall I2C_TX |
248 movlw b'00000000' ; Continous Mode | 252 movlw b'00000000' ; Continous Mode |
249 rcall I2C_TX | 253 rcall I2C_TX |
250 bsf SSP1CON2,PEN ; Stop condition | 254 bsf SSP1CON2,PEN ; Stop condition |
251 rcall WaitMSSP | 255 rcall WaitMSSP |
259 movlw 0x3C ; address | 263 movlw 0x3C ; address |
260 rcall I2C_TX | 264 rcall I2C_TX |
261 movlw 0x00 | 265 movlw 0x00 |
262 rcall I2C_TX | 266 rcall I2C_TX |
263 movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged | 267 movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged |
264 rcall I2C_TX | 268 ; movlw b'00111001' ; ConfigA: 75Hz, 2 Samples averaged, Test Mode (Positive Bias) |
265 movlw b'00100000' ; ConfigB, 1090Gauss Gain | 269 rcall I2C_TX |
270 movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) | |
271 swapf i2c_temp,F | |
272 comf i2c_temp,F | |
273 bcf STATUS,C | |
274 rlcf i2c_temp | |
275 movf i2c_temp,W | |
276 clrf i2c_temp | |
266 rcall I2C_TX | 277 rcall I2C_TX |
267 movlw b'00000000' ; Continous Mode | 278 movlw b'00000000' ; Continous Mode |
268 rcall I2C_TX | 279 rcall I2C_TX |
269 bsf SSP1CON2,PEN ; Stop condition | 280 bsf SSP1CON2,PEN ; Stop condition |
270 rcall WaitMSSP | 281 rcall WaitMSSP |