Searching \ for '[PIC] DS18S20' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'DS18S20'.

Exact match. Not showing close matches.
PICList Thread
'[pic] ds18S20'
2005\02\10@183038 by Chris Williams

picon face

I’m trying to get a ds18S20 to be read, then the tempature relyed via the
serial port og the pic16f88, however I can’t seem to make this work right,
if anyone could help me fix it, I would be very appreciate. Thanks Chris



DSBIT EQU 0
#include <P16F88.INC>
            cblock   0x70
                        TMP0    ;
                        TMP1    ;
                        TMP2    ;
                        DSSIGN            ;
                        DSMAG            ;
                        HUNS   ;
                        TENS    ;
                        ONES   ;
                        COUNT ;
                        P1        ;
                        FSTAT  ;
            endc
            __config           
_CONFIG1,_CP_OFF&_DEBUG_OFF&_WRT_PROTECT_OFF&_CPD_OFF
&_LVP_OFF&_BODEN_OFF&_MCLR_OFF&_PWRTE_OFF&_WDT_OFF&_INTRC_IO
;SETUP
            BANKSEL         ANSEL
            MOVLW            0X00
            MOVWF           ANSEL
            MOVWF           TRISA
            MOVLW            0X24
            MOVWF           TRISB
            BANKSEL         PORTA
            BSF      STATUS,RP0
            MOVLW            0X6C                 ;01101100 4MHZ
            MOVWF           OSCCON
            MOVLW            0XC                  ;19200 baud
            MOVWF           SPBRG
            BSF      TXSTA,BRGH
            BCF      TXSTA,SYNC
            BCF      STATUS,RP0
            BSF      RCSTA,SPEN
            BSF      RCSTA,CREN
            BSF      STATUS,RP0
            BSF      TXSTA,TXEN
            BCF      STATUS,RP0
            BCF      STATUS,IRP
            CALL    GETEMP

           
START: call       NEWTEMP
            XORLW 0X00
            BTFSC  STATUS,Z
            GOTO   TRANSMIT
            MOVLW            "B"
            MOVWF           TXREG
            CALL    PPAUSE
            MOVLW            "A"
            MOVWF           TXREG
            CALL    PPAUSE
            MOVLW            "D"
            MOVWF           TXREG
            CALL    PPAUSE
            MOVLW            0X0D
            MOVWF           TXREG
            CALL    PPAUSE
            MOVLW            0X0A
            MOVWF           TXREG
            CALL    PPAUSE
            GOTO   START
           
           
           
           
TRANSMIT:       call       BIN2BCD
            MOVF   DSSIGN,0
            XORLW 0XFF
            BTFSS  STATUS,Z
            GOTO   TTEMP
TSIGN:  MOVLW            0X2D
            MOVWF           TXREG
            CALL    PPAUSE
TTEMP:            MOVF   HUNS,0
            MOVWF           TXREG
            CALL    PPAUSE
            MOVF   TENS,0
            MOVWF           TXREG
            CALL    PPAUSE
            MOVF   ONES,0
            MOVWF           TXREG
            CALL    PPAUSE
            MOVLW            0X0D
            MOVWF           TXREG
            CALL    PPAUSE
            MOVLW            0X0A
            MOVWF           TXREG
            CALL    PPAUSE
            SLEEP
            GOTO START



NEWTEMP:

            ;           Returns W<>0 if no new data ready yet
            ;           or W=0 if a new measurement has been made
            ;           Data will be saved to DSSIGN & DSMAG
            ;           TMP0..2 will be destroyed
            ;           Return W=0 if reading is OK
            ;           or W=1 if an error is encountered.
            ;           NOTE in this case DSMAG and DSSIGN will
            ;                                   be in an undefined state
            ;
            CALL    DSRX8              ; CHECK DS1820 STATUS
            ADDLW            1                      ; 255=READY => 0=READY
            BTFSS  STATUS,Z         ; Z set = READY
            RETURN                                   ; W non zero = not
ready
            ;           Get current temperature reading
            ;           and start the next conversion

GETEMP:         CALL    DSRESET
            BTFSS  STATUS,Z         ; Z BIT SET MEANS RESP. OK
            GOTO   BADTMP
            MOVLW            H'CC'                ; SKIP PROM
            CALL    DSTX8
            MOVLW            H'BE'                ; READ SCRATCH PAD
            CALL    DSTX8
            CALL    DSRX8              ; MAGNITUDE
            MOVWF           DSMAG
            CALL    DSRX8              ; SIGN (FF=-VE, 00=+VE)
            MOVWF           DSSIGN
            CALL    DSRESET                     ; SEEN ENOUGH, RESTART
            MOVLW            H'CC'                ; SKIP PROM
            CALL    DSTX8
            MOVLW            H'44'                 ; START CONVERT
            CALL    DSTX8

            ;
            ;           IF DSSIGN NOT 255 OR 0 THEN ERROR
            ;

            MOVF   DSSIGN,W
            BTFSC  STATUS,Z
            GOTO   OKTMP
            ADDLW            1
            BTFSS  STATUS,Z
            GOTO   BADTMP
OKTMP:
            CLRW                           ; W = 0 : DATA READY
            RETURN
BADTMP:
            MOVLW            1                      ; W <> 0 : ERROR
            RETURN
           

; ---------------------------------------------------------

            ;           DS1820 MACROS


INTSON:           MACRO
            ;
            ;           TURN YOUR INTERRUPTS OFF HERE
            ;
            ENDM


INTSOFF:MACRO
            ;
            ;           TURN YOUR INTERRUPTS BACK ON HERE
            ;
            ENDM


DQLOW:           MACRO
            BCF      PORTA,DSBIT   ; DQ BIT READY LO
            BSF      STATUS,RP0
            BCF      TRISA,DSBIT     ; DQ BIT NOW O/P
            BCF      STATUS,RP0
            ENDM


DQHIZ:  MACRO
            BSF      STATUS,RP0
            BSF      TRISA,DSBIT     ; DQ BIT NOW I/P
            BCF      STATUS,RP0
            ENDM


PAUSE:            MACRO            DLYF
            MOVLW            (DLYF / 5) - 1
            MOVWF           TMP0
            CALL    DLY5N
            ENDM


; ------------------------------------------------------------

            ;           DS1820 SUBROUTINES


DLY5N: NOP
            NOP
            DECFSZ           TMP0
            GOTO   DLY5N
            RETURN



DSRESET:
            ;           DESTROYS TMP0,1
            ;           RETURNS 0 IN W IF VALID RESPONSE
            ;
            DQLOW
            PAUSE 600
            INTSOFF
            DQHIZ
            PAUSE 65                     ; WAIT 67us FOR RESP BIT
            NOP
            NOP
            MOVF   PORTA,W
            INTSON
            ANDLW            1 << DSBIT
            MOVWF           TMP1
            PAUSE 300
            MOVF   TMP1,W                       ; RESPONSE IN W
            RETURN



DSTX8: MOVWF           TMP2                ; DATA TO TX
            MOVLW            8
            MOVWF           TMP1                ; LOOP COUNTER
DSTXLP:           INTSOFF
            DQLOW
            PAUSE 10
            RRF      TMP2
            BTFSC  STATUS,C
            BSF      PORTA,DSBIT   ; DQ HI IF BIT WAS 1
            INTSON
            PAUSE 70
            DQHIZ
            NOP
            DECFSZ           TMP1
            GOTO   DSTXLP
            RETURN


DSRX8: MOVLW            8
            MOVWF           TMP1
DSRXLP:           INTSOFF
            DQLOW
            PAUSE 10
            DQHIZ
            NOP
            NOP
            MOVF   PORTA,W
            INTSON
            ANDLW            1 << DSBIT       ; ->0 IF DATA BIT LOW
            ADDLW            255                   ; C IF W > 0
            RRF      TMP2
            PAUSE 60
            DECFSZ           TMP1
            GOTO   DSRXLP
            MOVF   TMP2,W
            RETURN


; ---------------------------------------------------------
BIN2BCD:
            ;in: DSMAG
            ;out HUNS. TENS, ONES
            ;uses ADD-3 algoerthm
            MOVLW            8
            MOVWF           COUNT
            CLRF    HUNS
            CLRF    TENS
            CLRF    ONES
BCDADD3:
            MOVLW            5
            SUBWF            HUNS, 0
            BTFSC  STATUS, C
            CALL    ADD3HUNS
            MOVLW            5
            SUBWF            TENS, 0
            BTFSC  STATUS, C
            CALL    ADD3TENS
            MOVLW            5
            SUBWF            ONES, 0
            BTFSC  STATUS, C
            CALL    ADD3ONES
            DECF   COUNT, 1
            BCF      STATUS, C
            RLF      DSMAG, 1
            RLF      ONES, 1
            BTFSC  ONES,4 ;
            CALL    CARRYONES
            RLF      TENS, 1
            BTFSC  TENS,4 ;
            CALL    CARRYTENS
            RLF      HUNS,1
            BCF      STATUS, C
            MOVF   COUNT, 0
            BTFSS  STATUS, Z
            GOTO   BCDADD3
            MOVF   HUNS, 0 ; add ASCII Offset
            ADDLW            h'30'
            MOVWF           HUNS
            MOVF   TENS, 0 ; add ASCII Offset
            ADDLW            h'30'
            MOVWF           TENS
            MOVF   ONES, 0 ; add ASCII Offset
            ADDLW            h'30'
            MOVWF           ONES
            RETURN
ADD3HUNS:
            MOVLW            3
            ADDWF            HUNS,1
            RETURN
ADD3TENS:
            MOVLW            3
            ADDWF            TENS,1
            RETURN
ADD3ONES:
            MOVLW            3
            ADDWF            ONES,1
            RETURN
CARRYONES:
            BCF      ONES, 4
            BSF      STATUS, C
            RETURN
CARRYTENS:
            BCF      TENS, 4
            BSF      STATUS, C
            RETURN
PPAUSE:          MOVLW            0XFF
            MOVWF           P1
PPAUSE2:        NOP
            NOP
            NOP
            NOP
            DECFSZ           P1,1
            GOTO PPAUSE2
            RETURN
            END



'[PIC] DS18S20'
2005\08\21@233741 by Neville Paintin
flavicon
face
I'd like to use a Dallas DS18S20 and display the temp on a LCD, I've found this code http://www.sxlist.com/techref/microchip/ds1820-code.htm which looks like it will get started but need help the connections to the LCD,                          Regards Neville...

                                     Check My Homepage

2005\08\22@031523 by Jan-Erik Soderholm

face picon face
Neville Paintin wrote :

> I'd like to use a Dallas DS18S20 and
>
display the temp on a  LCD...

> ... but need help the connections
>
to the LCD

What is  the problem ?

What type of LCD is it ?

(Is it a
plain HD44780 LCD ?)

Jan-Erik.



2005\08\22@035533 by Vasile Surducan

face picon face
If you are starting with DS18B20 for the first time, I suggest you to
start directly with DS18B20.

Vasile

On 8/22/05, Neville Paintin <spam_OUTpaintinTakeThisOuTspames.co.nz> wrote:
> I'd like to use a Dallas DS18S20 and display the temp on a LCD, I've found this code http://www.sxlist.com/techref/microchip/ds1820-code.htm which looks like it will get started but need help the connections to the LCD,
>
>         Regards Neville...
>
>                                      Check My Homepage
>
>
> -

2005\08\22@041047 by Tony Smith

picon face
I disagree, I think the DS18B20 is a better choice.  :-)

Tony


{Quote hidden}

2005\08\22@054137 by Vasile Surducan

face picon face
Sorry, I mean DS18B20 not DS18B20 like you want to...
:)))

Vasile

On 8/22/05, Tony Smith <ajsmithspamKILLspamrivernet.com.au> wrote:
{Quote hidden}

> -

2005\08\22@105559 by Neville Paintin

flavicon
face
The problem is I'm pretty new to this stuff, I've done the flash the LED and "Hello World" thing on the LCD and that's my lot, I've looked at the code and tried to sort out the bits I know but am having trouble finding out how the LCD is connected, yes it is a HD44780 lcd
                        Regards Neville...

                                     Check My Homepage



 ----- Original Message -----   From: Jan-Erik Soderholm   To: EraseMEpiclistspam_OUTspamTakeThisOuTmit.edu   Sent: Monday, August 22, 2005 7:15 PM
 Subject: RE: [PIC] DS18S20


 Neville Paintin wrote :

 > I'd like to use a Dallas DS18S20 and
 >   display the temp on a  LCD...

 > ... but need help the connections   >   to the LCD

 What is  the problem ?

 What type of LCD is it ?

 (Is it a   plain HD44780 LCD ?)

 Jan-Erik.



2005\08\22@110736 by Jan-Erik Soderholm

face picon face
Neville Paintin wrote :

>... but am having trouble finding out how the
LCD is
> connected, yes it is a HD44780 lcd...

Goto

http://www.epemag.
wimborne.co.uk/resources.htm

and download lcd1.pdf and lcd2.pdf.

They
are pretty good...

Regardsa,

/Jan-Erik.



2005\08\22@111256 by Kevin

flavicon
face
Uh, you could try here ...

http://www.piclist.com/techref/piclist/cheapic/worktime.htm

might want to look here also, for some other ideas.
http://www.piclist.com/techref/piclist/projects.htm

Good Luck,
Kevin

On Tue, 23 Aug 2005, Neville Paintin wrote:

> The problem is I'm pretty new to this stuff, I've done the flash the LED and "Hello World" thing on the LCD and that's my lot, I've looked at the code and tried to sort out the bits I know but am having trouble finding out how the LCD is connected, yes it is a HD44780 lcd
>
>          Regards Neville...
>
>                                       Check My Homepage
>
>
>
>   {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...