PDA

View Full Version : problem with ds1620



santamaria
- 23rd April 2005, 16:40
i am using the pic 16f628.This is my code

define OSC 4

TEMP VAR WORD
DQ VAR PORTA.2
CLK0 VAR PORTA.0
RST VAR PORTA.3
REG VAR BYTE
TRISA=0
CMCON=%00000111


LOOP:
PAUSE 1000
REG=0
TEMP=0

PAUSE 100


RST=1
SHIFTOUT DQ,CLK0,0, [$0C,$02]
RST=0
pause 10
RST=1
shiftout DQ,CLK0,0,[$EE]
RST=0
PAUSE 1000
RST=1

shiftout DQ,CLK0,0, [$AA]
SHIFTIN DQ,CLK0,1, [TEMP\9]
RST = 0

TEMP=TEMP
RST=1
SHIFTOUT DQ,CLK0,0 ,[$01,$44]
RST=0
PAUSE 10
RST=1
SHIFTOUT DQ,CLK0,0 , [$A1]
SHIFTIN DQ,CLK0,1, [REG\8]
RST=0
GOTO LOOP
the problem is the value that i recieve is not the correct.and when i sent value for HT register and i ask later to read it it sent me wrong number.the number that gives me is 15 dec both temp and HT register
can anyone hepl me.i am using also the microcode debuger and the clock it doesn't change from low to high.is this normal?

Macgman2000
- 23rd April 2005, 17:46
Have you tried to "Include modedefs.bas"


Best Regards,
Nick

Acetronics2
- 23rd April 2005, 18:11
Hi, Santa

Have a look to the Basic Stamp 1 application notes ( ch.23 : DS 1620 digital thermometer ... )

This is page 189 from the Basic stamp programming manual 1.9 ...

Download it from Parallax inc.

- and do not forget the "Include modedef ...."

Alain

PS: another version
' Sous-programmes de dialogue avec un DS 1620
' connecte comme indique figure 7.15
' Version pour Basic Stamp II ou II-SX

' Definition des constantes et variables

CLK con 15
DQ con 14
RST con 13

wcfg con $0C
cpucont con 2
startc con $EE
rtemp con $AA

temp var word

' Initialisation

low RST
high CLK
pause 100 ' attente prise en compte DS 1620
high RST
shiftout DQ, CLK, lsbfirst, [wcfg, cpucon]
low RST
pause 50 ' attente prise en compte DS 1620
high RST
shiftout DQ, CLK, lsbfirst [startc]
low RST
pause 1000 ' attente d'une seconde

' Lecture de la temperature mesuree par le DS 1620

lecture:
high RST
shiftout DQ, CLK, lsbfirst [rtemp]
shiftin DQ, CLK, lsbpre [temp\9]
low RST

' La temperature mesuree par le DS 1620
' est disponible dans temp codee sur 9 bits

Listing 7.6

jojokatada
- 23rd April 2005, 19:04
PBP have new command owin which is much efficient than shiftout check my previous post i have complete but using pic16f84a

Acetronics2
- 23rd April 2005, 19:19
Hi, jojo

Do you feel sure not to mix DS 1620 and DS 1820 ???

I'm not so sure ...

Alain

jojokatada
- 24th April 2005, 07:42
sorry i am wrong i thought ds1820

sufian
- 24th April 2005, 12:27
Hi
I designed a datacable for Ericsson T28
I used a max3232 in this cable
I connect the com of the computer to Ericsson though this cable
and the result on the Hyper terminal was : the program of the mobile show on the hyper terminal and this program still forever .
so when i try to send At commad the mobile don't response and still send the data of the program.
are there anyone can help me and say to me how can i send the command from hyper terminal to Ericsson by this cable.
please i want help as soon as posible.
my email: [email protected]

mister_e
- 24th April 2005, 18:13
Sufian

You can't ask that question here... look and read all this thread (http://www.picbasic.co.uk/forum/showthread.php?t=219) and you'll find all you need.

santamaria
- 24th April 2005, 21:17
Have you tried to "Include modedefs.bas"


Best Regards,
Nick


i don't think so is modedefs because i use the same values for that but i will do it because you never know.can you explain me how syncronus data works?maby i will find what its going wrong

thanks all for your support