Ошибка такая:
- Код: Выделить всё • Развернуть
- Error: 344 Line: 99 Program will overwrite [ 82 too long ] , in file : C:\ds18b20
Программа:
- Код: Выделить всё • Развернуть
- $regfile = "attiny2313.dat"
 $crystal = 8000000
 Declare Sub Convallt ' !!!!!! Convert T on ALL sensors
 Declare Function Decigrades(byval Sc(9) As Byte) As Integer
 Config Lcd = 16 * 2 ' дисплей 2 строки по 16 символов
 Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.2 , Rs = Portb.0 ' конфигурируем дисплей
 Config 1wire = Portd.1 ' на эту ножку подключим DS18B20 и подтягивающий резистор на 4,7 ком к + питания
 'Temp variables
 Dim B As Byte
 Dim W As Word
 Dim Dg As Integer 'DECIgrades, I call it, cause I have no space for commas on the display....
 Dim Dsid1(8) As Byte 'Dallas ID 64 bits incl CRC
 'When used like this : DsId(1) = 1wread(8)
 'DsId(1) = family code 'Ds1820 10h, DS18B20 28h, Ds18s20 10h
 'DsId(2) '48 Bits Serial, LSB
 'DsId(3)
 'DsId(4)
 'DsId(5)
 'DsId(6)
 'DsId(7) '48 Bits Serial, MSB
 'DsId(8) '8 CRC
 Dim Sc(9) As Byte 'Scratchpad 0-8 72 bits incl CRC, explanations for DS18b20
 'Sc(1) 'Temperature LSB
 'Sc(2) 'Temperature MSB
 'Sc(3) 'TH/user byte 1 also SRAM
 'Sc(4) 'TL/user byte 2 also SRAM
 'Sc(5) 'config also SRAM x R1 R0 1 1 1 1 1 - the r1 r0 are config for resolution - write FF to byte for 12 bit - others dont care
 'Sc(6) 'res
 'Sc(7) 'res
 'Sc(8) 'res
 'Sc(9) '8 CRC
 'DALLAS DS18B20 ROM and scratchpad commands''''''''''''''''''''''''''1wwrite....
 '&H 33 read rom - single sensor
 '&H 55 match rom, followed by 64 bits
 '&H CC skip rom
 '&H EC alarm search - ongoining alarm >TH <TL
 '&H BE read scratchpad
 '&H 44 convert T
 Cls
 W = 1wirecount()
 Dsid1(1) = 1wsearchfirst()
 ' First sensor identified and stored in variable
 If Dsid1(8) = Crc8(dsid1(1) , 7) Then ' Control that the received CRC match the calculated
 Locate 1 , 1
 Lcd "CRC OK Sensor 1 ID"
 Wait 1
 Locate 2 , 1
 For B = 1 To 8
 Lcd Hex(dsid1(b))
 Next
 End If
 Wait 1
 Cls
 ' Main loop
 Do
 Convallt ' "Convert ALL T on the 1w-bus"
 Waitms 750
 1wverify Dsid1(1) 'Issues the "Match ROM "
 Locate 1 , 1
 1wwrite &HBE
 Sc(1) = 1wread(9) 'read bytes into array
 If Sc(9) = Crc8(sc(1) , 8) Then
 Dg = Decigrades(sc(9))
 Locate 1 , 1
 Lcd Dg
 End If
 Loop
 End 'end program
 'Makes the Dallas "Convert T" command on the 1w-bus configured in "Config 1wire = Portb. "
 'WAIT 200-750 ms after issued, internal conversion time for the sensor''''''''''
 'SKIPS ROM - so it makes the conversion on ALL sensors on the bus simultaniously
 'When leaving this sub, NO sensor is selected, but ALL sensors has the actual
 'temperature in their scratchpad ( within 750 ms )
 Sub Convallt
 1wreset ' reset the bus
 1wwrite &HCC ' skip rom
 1wwrite &H44 ' Convert T
 End Sub
 'Makes a integer value of the first two bytes in scratchpad'''''''''''''
 'Works on DS18 B 20 , observe "B". The R0 and R1 in Sc(5) tells you how many bits are accurate
 Function Decigrades(byval Sc(9) As Byte)
 Decigrades = 0
 Decigrades = Makeint(sc(1) , Sc(2))
 Decigrades = Decigrades * 10
 Decigrades = Decigrades / 16
 End Functionh






 . Прогу нашёл другую, работает нормально
 . Прогу нашёл другую, работает нормально