Hi Gordon,
Thanks to Bruce.
Here you can find an example in which you can see the code for DS1620.
http://www.rentron.com/PicBasic/SERLED.htm
-----------
Hi Gordon,
Thanks to Bruce.
Here you can find an example in which you can see the code for DS1620.
http://www.rentron.com/PicBasic/SERLED.htm
-----------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
' PicBasic Pro program to read DS1620 3-wire temperature sensor
' and display temperature on LCD
' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
Define LOADER_USED 1
Include "MODEDEFS.BAS"
' Define LCD pins
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
' Alias pins
RST var PORTC.0 ' Reset pin
DQ var PORTC.1 ' Data pin
CLK var PORTC.3 ' Clock pin
' Allocate variables
temp var word ' Storage for temperature
Low RST ' Reset the device
ADCON1 = 7 ' Set PORTA and PORTE to digital
Low PORTE.2 ' LCD R/W line low (W)
Pause 100 ' Wait for LCD to start
Lcdout $fe, 1, "Temp in degrees C" ' Display sign-on message
' Mainloop to read the temperature and display on LCD
mainloop:
RST = 1 ' Enable device
Shiftout DQ, CLK, LSBFIRST, [$ee] ' Start conversion
RST = 0
Pause 1000 ' Wait 1 second for conversion to complete
RST = 1
Shiftout DQ, CLK, LSBFIRST, [$aa] ' Send read command
Shiftin DQ, CLK, LSBPRE, [temp\9] ' Read 9 bit temperature
RST = 0
' Display the decimal temperature
Lcdout $fe, 1, dec (temp >> 1), ".", dec (temp.0 * 5), " degrees C"
Goto mainloop ' Do it forever
End
or read http://www.melabs.com/resources/samp...pbp/temp3x.bas
Thanks precision
This code looks very clean and striaght forward.
This should be easy to apply to my project.
Gordon
Hi Gordon,
I see from your other post regarding ISP Pro that you purchased PICBasic. Did you get the PICBasic Compiler or did you get the PIC Basic Pro version. There are distinct differences between the 2 programs.
Just trying to save you the time of using the above program with PIC Basic.
BobK
Why not try here:
http://www.rentron.com/PicBasic/one-wire3.htm
simply ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Thanks for the link ace. I purchased the pro after reading Chuck Hellebuyck's
book "Programming Pic Microcontrollers with PicBasic". Just seemed like PBP
was the way to go when using LCDs and a few other features.
Gordon
Bookmarks