Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 2 x DS1612 Temperature Kategorie: Programmierung Basic (von Hans - 4.02.2006 14:26)
Hans nutzt:  CC1-M-Unit V1.2/2.0
Hallo
I use the under mentioned programm. for reading of the temperature.
This works great
But the program give a lot of IIC ERROR:DS1612 not found
What is going wrong?
And how can I connect a second DS16219 and showed in the program
On the second line of the display.
I hope that someone can help me with this.

Hans .

'----------------------------------------------------------------------------------------------------'
'********************************************************'
'*                   WINDT SYSTEMS                      *'
'* DS1621 IIC TEMP READ v1.1 for CCIUM2.0 with CCIAB2.0 *'
'*                 2005/ H.J. WINDT                     *'
'********************************************************'
'----------------------------------------------------------------------------------------------------'
'This softare, with the C-Control I Unit M2.0 mounted on the C-Control I Application Board 2.0,'
'will read the DS1621 9 bit Temperature and display the data on the LCD as °C and °F.'
'Communication with the DS1621 is via the IIC bus.'
'Feel free to use and share this software!'
'DS1621 -->> DALLAS SEMICONDUCTOR Digital Thermometer and Thermostat'
'**************** I/O PORTS ****************'
define lcd_backlight_off port[16]
'*******************************************'
'**************** VARIABLES ****************'
define configuration        byte[1]
define iic_nack             bit[7]
define iic_nack_count       byte[2]
define iic_byte             byte[3]
define ds1621_status        byte[4]

define temp_c        word[3]
define temp_f        word[4]
'*******************************************'
'**************** CONSTANTS ****************'
define ds1621_iic_address &h90
'*******************************************'
'****************** SETUP ******************'
put 0
print"#ON_LCD#";:print"#INIT#";:print"#CLR#";:lcd_backlight_off = 0:print"#OFF#";
'*******************************************'
'***************** PROGRAM *****************'
#start
gosub get_ds1621_temperature
print"#ON_LCD#";
print"#L101#";:print"Temp. = ";temp_c/10;",";abs(temp_c-temp_c/10*10);:put&hdf:print"C  ";
print"#L201#";:print"Temp. = ";temp_f/10;",";abs(temp_f-temp_f/10*10);:put&hdf:print"F  ";
print"#OFF#";
goto start
'*******************************************'
'*************** SUBROUTINES ***************'
#get_ds1621_temperature
#ds1621_start_convert
print"#ON_IIC#";
print"#START#";
put ds1621_iic_address
put &hee
print"#STOP#";
print"#OFF#";
gosub check_iic_nack
if iic_nack_count > 6 then gosub no_ack_from_ds1621
if iic_nack then goto ds1621_start_convert
#ds1621_check_conversion_done
print"#ON_IIC#";
print"#START#";
put ds1621_iic_address
put &hac
print"#STOP#";
print"#OFF#";
gosub check_iic_nack
if iic_nack then goto ds1621_pass_check_conversion_done
print"#ON_IIC#";
print"#START#";
put ds1621_iic_address+1
get ds1621_status
print"#STOP#";
print"#OFF#";
gosub check_iic_nack
#ds1621_pass_check_conversion_done
if iic_nack_count > 9 then gosub no_ack_from_ds1621
if iic_nack then goto ds1621_check_conversion_done
if (ds1621_status and 1) = 1 then if (ds1621_status and 128) = 0 then goto ds1621_check_conversion_done
#ds1621_read_temp
print"#ON_IIC#";
print"#START#";
put ds1621_iic_address
put &haa
print"#STOP#";
print"#OFF#";
gosub check_iic_nack
if iic_nack then goto pass_ds1621_read_temp
print"#ON_IIC#";
print"#START#";
put ds1621_iic_address+1
get iic_byte
if iic_byte > 127 then temp_c = &hff00 + iic_byte else temp_c = iic_byte
temp_c = temp_c * 10
get iic_byte
if (iic_byte and 128) = 128 then temp_c = temp_c + 5
temp_f = (temp_c*10/5*9+3200)/10
print"#STOP#";
print"#OFF#";
gosub check_iic_nack
#pass_ds1621_read_temp
if iic_nack_count > 9 then gosub no_ack_from_ds1621
if iic_nack then goto ds1621_read_temp
if temp_c = -600 then goto ds1621_start_convert
return

#check_iic_nack
print"#ON_CONFIG#";
get configuration
if not iic_nack then goto pass_iic_nack_clear
iic_nack = 0
put configuration
iic_nack = 1
iic_nack_count = iic_nack_count + 1
print"#OFF#";
return
#pass_iic_nack_clear
iic_nack_count = 0
print"#OFF#";
return
'*******************************************'
'******* INITIALIZATION SUBROUTINES ********'

'*******************************************'
'****************** DATA *******************'

'*******************************************'
'************* ERROR MESSAGES **************'
#no_ack_from_ds1621
beep 1,1,1:beep 10,1,1:beep 1,1,1:beep 10,1,1
print"#ON_LCD#";
print"#CLR#";
print"IIC ERROR:";
print"#L201#";
print"DS1621 not found";
pause 300
print"#CLR#";
print"#OFF#";
return
'*******************************************

 Antwort schreiben

Bisherige Antworten:

Re: 2 x DS1612 Temperature (von Windt H.J. - 4.02.2006 18:04)
    Re: 2 x DS1612 Temperature (von Hans - 4.02.2006 18:40)
        Re: 2 x DS1612 Temperature (von Windt H.J. - 4.02.2006 19:25)
            Re: 2 x DS1612 Temperature (von Hans - 5.02.2006 13:04)
                Re: 2 x DS1612 Temperature (von Windt H.J. - 5.02.2006 13:50)
                Re: 2 x DS1612 Temperature (von Windt H.J. - 5.02.2006 13:30)
                    Re: 2 x DS1612 Temperature (von Windt H.J. - 5.02.2006 14:05)
                       Re: 2 x DS1612 Temperature (von Hans - 5.02.2006 15:39)
                          Re: 2 x DS1612 Temperature (von Hans - 5.02.2006 15:40)
                             Re: 2 x DS1612 Temperature (von Windt H.J. - 5.02.2006 16:52)
                                Re: 2 x DS1612 Temperature (von Hans - 5.02.2006 17:33)
                                   Re: 2 x DS1612 Temperature (von Windt H.J. - 5.02.2006 17:41)
                                     Re: 2 x DS1612 Temperature (von Windt H.J. - 6.02.2006 13:17)
                                       2 x DS1621 v1.3 (von Windt H.J. - 6.02.2006 13:35)
                                         Re: 2 x DS1621 v1.3 (von Hans - 8.02.2006 17:55)
                                           Re: 2 x DS1621 v1.4 (von Windt H.J. - 8.02.2006 19:13)
                                             Re: 2 x DS1621 v1.4 (von Hans - 8.02.2006 20:00)