![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Experienced Member
|
I have noticed that there are two different libraries. The chip I got is the DS1820. NO S or B in the name. What I did find is that the DS18S20 lib worked in Swordfish. I modified it for the 18F1320 chip and read the input on PortA<0>. I tested the circuit with melting and boiling water. in the ice it came down to about 0.5°C, but the boiling water only got to 87°C. Up here in Johannesburg (being about 1650m above sea level) it's normal for water to start boiling in a kitchen kettle at 90°C
Code:
Device = 18F1320
Clock = 8
// import modules...
Include "IntOSC_1320.bas"
Include "convert.bas"
Include "LCD.bas"
Include "DS18S20.bas"
Include "utils.bas"
Dim
TempA As ShortInt,
TempB As Byte // for the DS18S20.bas lib this is a WORD
SetPin(PORTA.0)
// Find() will search the bus for a single DS1820 device
// and load its ROM ID into the DS1820 public variable RomID - you
// could do this manually. For example, RomID = MyRomID...
SetAllDigital
If Not Find Then
LCD.Cls // Clear the LCD screen
LCD.WriteAt(1,1,"No device found") // Send some text to the LCD
Else
While true
ConvertAll
GetTemp(TempA, TempB)
LCD.WriteAt(1,1,Convert.DecToStr(TempA),".",DecToStr(TempB)," C") //
LCD.WriteAt(2,1,GetTempAsStr, " C") // The same as the line above
DelayMS(500)
Wend
EndIf
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
The DS18S20 uses a bandgap temperature sensing rather than the dual-oscillator architecture used by the DS1820, this difference is invisible to the user
The main difference between the two parts is the temperature conversion time: DS1820 = 500ms (max) and DS18S20 = 750ms (max) In most applications, DS18S20 is software compatible with the DS1820
__________________
Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
I wasn't trying to ninja pommies post, just providing a different solution that didn't involve system libraries
__________________
Spency. PIC Micro's - Your mind is the limit PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net |
|
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
Mike. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Brown-out reset on LF PIC | bananasiong | Micro Controllers | 10 | 17th May 2007 12:33 AM |
| 74LS90 power-on auto reset | Torben | Electronic Projects Design/Ideas/Reviews | 17 | 20th December 2006 04:18 AM |
| vx-5r reset problem | tom muleady | General Electronics Chat | 2 | 5th July 2006 06:01 PM |
| uC 'network' reset circuitry | rockin_rick | Electronic Projects Design/Ideas/Reviews | 8 | 30th May 2006 01:03 AM |
| How to reset SCR used for triggering camera flash | shootfirst | Electronic Projects Design/Ideas/Reviews | 20 | 28th September 2005 08:40 PM |