'*********************************************************** '** ** '** SRF08 Demonstration Software for the PICAXE-28x ** '** showing how to change the SRF08 I2C address ** '** ** '** Copyright 2003 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - May 2003 ** '** ** '*********************************************************** ' NEW_ADDRESS can be set to any of E0, E2, E4, E6, E8, EA, EC, EE ' F0, F2, F4, F6, F8, FA, FC, FE symbol NEW_ADDRESS = $EC main: i2cslave $00,i2cfast,i2cbyte ' Define General Broadcast i2c address for the SRF08 writei2c 0,($A0) ' 1st command in address change sequence writei2c 0,($AA) ' 2nd writei2c 0,($A5) ' 3rd writei2c 0,(NEW_ADDRESS) ' The new address for the SRF08 ' now show range reading to prove address change is OK i2cslave NEW_ADDRESS,i2cfast,i2cbyte ' use new i2c address for the SRF08 loop: writei2c 0,(81) ' Send Ranging command to get range in cm pause 100 ' Wait for ranging to complete readi2c 2,(b5, b4) ' Read the Range debug w2 ' Display Range, Note b5-b4 are w2 high-low bytes goto loop