
|
INFO - FAQ - CC2-Forum - CCPro-Forum |
|
'----------------------------------------------------------------------------------------------------' '***********************************************************************' '* WINDT SYSTEMS *' '* I2C DEVICE SEEK v1.1 for CCIUM2.01 with CCIAB2.0 *' '* H.J. WINDT *' '* 2004 *' '***********************************************************************' '----------------------------------------------------------------------------------------------------' 'Use this software to find a I2C device.' 'If a device is found then the address will be displayed on the LCD.' 'Feel free to use and share this software!' '----------------------------------------------------------------------------------------------------' '*************** INS and OUTS **************' define lcd_backlight_off port[16] '*******************************************' '**************** VARIABLES ****************' define configuration byte[1] define i2c_communication_error bit[7] define address byte[3] define number_of_errors byte[4] '*******************************************' '**************** CONSTANTS ****************' '*******************************************' '****************** SETUP ******************' lcd_backlight_off = 0 print"#ON_LCD#";:print"#INIT#";:print"#CLR#"; print" WINDT SYSTEMS"; print"#L201#"; print"I2C DEVICE SEEK"; print"#OFF#"; pause 150 number_of_errors = 0 '*******************************************' '***************** PROGRAM *****************' #start for address = 0 to 254 step 2 print"#ON_LCD#"; print"#CLR#"; print"#L101#"; print"I2C Search ADR.="; print"#L206#"; print "&d";address; print"#OFF#"; #try_i2c_again print"#ON_IIC#"; print"#START#"; put address print"#STOP#"; print"#OFF#"; gosub check_for_i2c_error if i2c_communication_error then number_of_errors = number_of_errors + 1 if number_of_errors < 4 and i2c_communication_error then goto try_i2c_again if i2c_communication_error = 0 then gosub print_i2c_device_address number_of_errors = 0 next print"#ON_LCD#"; print"#CLR#"; print"#L106#"; print"DONE!!"; pause 150 print"#CLR#"; lcd_backlight_off = 1 print"#OFF#"; end '*******************************************' '*************** SUBROUTINES ***************' #print_i2c_device_address beep 4,2,4: beep 4,2,4 print"#ON_LCD#"; print"#CLR#"; print"#L101#"; print"I2C Device Found"; print"#L201#"; print"Address = &d"; print address; print"#OFF#"; pause 300 return #check_for_i2c_error 'after return if i2c_communication_error = 0 then I2C communication error has NOT occurred' print"#ON_CONFIG#"; get configuration if i2c_communication_error = 0 then goto pass_i2c_error_clear i2c_communication_error = 0 put configuration i2c_communication_error = 1 #pass_i2c_error_clear print"#OFF#"; return '*******************************************' '****************** DATA *******************' '*******************************************' > hi@all.. habe folgendes problem! > > habe eine m-unit 2... und ein IR-Thermometer vom Conrad (Miniflash II).... aufgeschraubt und einen CLK und DATA pin gefunden --> I2C!! > > so... jetzt möchte ich mir die daten von dem Thermometer über 232 in den computer schicken! > > NUR hab ich leider die Adresse von dem Thermometer nicht. wie kann ich das am besten realisieren die adresse zu bekommen.. kenn mich leider mit I2C noch nicht so gut aus!! > > danke und lg > squarefan > |
| Antwort schreiben |