Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use a frequency of 1 MHz DS18S20 heat sensor?

Status
Not open for further replies.

vasili35

Newbie level 4
Joined
Apr 13, 2011
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,354
Friends DS18S20 with my application would be a question?

I share this code, the internal oscillator frequency of 1 MHz at 4 MHz, but I want to work out hard as a highly value = 32.765. I can not make that calculation formula. I've tried so hard to fix but could not find any solution .. Could you explain this to me if you have an idea? Thank you.


Code:
        Device = 18F452
        WATCHDOG = OFF
        ALL_DIGITAL TRUE 

        LCD_DTPIN = PORTD.4	
        LCD_RSPIN = PORTD.2
        LCD_ENPIN = PORTD.3
        LCD_INTERFACE = 4     
        LCD_LINES = 2
        LCD_TYPE = 0
        
  
        Symbol DQ = PORTA.3   
        Dim Temp As Word  
        Dim D As Byte
        Dim C As Byte         
        Dim CPerD As Byte    
        Print $FE,$40,$06,$09,$09,$06,$00,$00,$00,$00
        Cls                  
   
     
        start:    
        OWrite DQ, 1, [$CC, $44]  
        
        Repeat 
        DelayMS 25              
        ORead  DQ, 4, [C]                
        Until C <> 0             
        
        OWrite DQ, 1, [$CC, $BE]  'scratchpad 

        ORead DQ, 2,[Temp.LowByte,Temp.HighByte,C, C, C, C, C, CPerD]


        Print At 1, 2, Dec (Temp>>1), ".", Dec (Temp.0 * 5),0,"C"
 
 
        GoTo start
 

Have a look at this Maxim **broken link removed**. It covers how to read 1-wire devices using software. Also make sure you have a pull-up resistor on the hardware pin.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top