| Author |
Message |
balu
Guest
|
Posted:
Wed Mar 09, 2005 12:48 am Post subject:
ds1620 to pic |
|
|
hai can any one help me out in giving hints to write a programme for
pic and ds1620 temperature sensor to communicate
|
|
| Back to top |
|
 |
Chris
Guest
|
Posted:
Wed Mar 09, 2005 1:31 am Post subject:
Re: ds1620 to pic |
|
|
balu wrote:
| Quote: | hai can any one help me out in giving hints to write a programme for
pic and ds1620 temperature sensor to communicate
|
Google
PIC +DS1620
Look at the third entry
http://www.rentron.com/CCS_C/SERLED_C.htm
It's already done for you. Code, schematic, everything.
Google is your friend.
Chris |
|
| Back to top |
|
 |
Byron A Jeff
Guest
|
Posted:
Wed Mar 09, 2005 2:01 am Post subject:
Re: ds1620 to pic |
|
|
In article <1110307736.617920.107440@g14g2000cwa.googlegroups.com>,
balu <balakrishnavakamalla@gmail.com> wrote:
| Quote: | hai can any one help me out in giving hints to write a programme for
pic and ds1620 temperature sensor to communicate
|
I have some DS1620 code on my PIC page:
http://www.finitesite.com/d3jsys
Look in the projects area for the thermostat.
BAJ
|
|
| Back to top |
|
 |
petrus bitbyter
Guest
|
Posted:
Wed Mar 09, 2005 5:25 am Post subject:
Re: ds1620 to pic |
|
|
"balu" <balakrishnavakamalla@gmail.com> schreef in bericht
news:1110307736.617920.107440@g14g2000cwa.googlegroups.com...
| Quote: | hai can any one help me out in giving hints to write a programme for
pic and ds1620 temperature sensor to communicate
|
http://www.parallax.com/dl/docs/prod/appkit/ds1620Thermometer.pdf
petrus bitbyter |
|
| Back to top |
|
 |
balu
Guest
|
Posted:
Wed Mar 09, 2005 5:22 pm Post subject:
Re: ds1620 to pic |
|
|
hello chris,byron and petrus,, thanx for the info given,, i got almost
a clear idea |
|
| Back to top |
|
 |
balu
Guest
|
Posted:
Fri Mar 18, 2005 3:22 am Post subject:
Re: ds1620 to pic |
|
|
hai evryone, itz me again, i have written some code to activate ds1620,
still it is not working. actually this code doesnt show the temperature
readings, but it will just check weather some signal is comming from
ds1620. so if any one can spare for 5 mins please have a look and
suggest me where the problem is and why iam not able to get the ouput.
/*ds1260.c iam using pic 16f876 which has two 7 segment led displays*/
#include <16F876.h>
#device 16F876 ICD=TRUE
#use delay(clock=4000000)
#fuses XT,NOWDT, NOPROTECT, NOPUT, NOBROWNOUT
#define led_delay 500
#define digitbit 49 /* for left display LB0 = (8x6)+1 */
#define digitbit1 48 /* for right display RB0 = (8x6)+0 */
#define clk_c0 56 /* portc 0 bit */
#define rst_c1 57 /* portc 1 bit */
#define ip_c5 61 /* portc 5 bit the i/p of ds1620 is been
connected to 5th pin of pic*/
#define input 0xff
#define output 0x00
#define port_c 0x07
/*#define temp 0x22, i havent defined temp variable it automatically
taking 22h for temp, so the below tempmsb has been caluculated like 22*
8+7=183*/
#define tempmsb 183
#define config 0x0c
#define valbit 176 /* here the 22 byte 0th bit same as above*/
#define seg7zero 0x3f
#define seg7one 0x06
#define rstdelay 5
/* write function*/
void write_ds1620(byte adrs)
{
byte i;
int value;
for(i=0; i<8; i++)
{
output_low(clk_c0);
adrs =adrs>>1;
value=adrs&0x01;
if(value==0x01)
{
output_high(ip_c5);
}
else
output_low(ip_c5);
output_high(clk_c0);
delay_us(1);
}
delay_us(rstdelay);
}
void main()
{
while(1)
{
byte rawtemp,temp=0x02;
int i;
int cnt = 0;
set_tris_c(0xdc); /*11011100*/
delay_us(rstdelay);
output_high(rst_c1);
write_ds1620(config);
write_ds1620(0x02);
write_ds1620(0xee);
write_ds1620(0xaa);
output_low(rst_c1);
set_tris_c(0x20); /* reading from ds 1620*/
output_high(rst_c1);
for(i=0; i<8; i++)
{
output_low(clk_c0);
temp=temp/2; /*22h*/
if(bit_test(*port_c,0x05))
output_high(tempmsb);
else
output_low(tempmsb);
output_high(clk_c0);
delay_us(1);
}
output_low(rst_c1);
delay_us(rstdelay);
/*stop conversion*/
set_tris_c(0xdc);
write_ds1620(0x22);
/*display*/
/*following checks the lsb of temp register where the reading has taken
from the ds1620 . if any data is comming it will get some value in the
register so it checks the lsb of the temp(22h) register and displays
according to lsb.*/
set_tris_c(0x00);
if(bit_test(*temp,0x00))
{
output_high(digitbit1);
output_c(seg7one);
delay_us(led_delay);
}
else
{
output_high(digitbit);
output_c(seg7zero);
delay_us(led_delay);
}
}/*while*/
}/*main*/ |
|
| Back to top |
|
 |
balu
Guest
|
Posted:
Fri Mar 18, 2005 3:26 am Post subject:
is this code for ds1620 is right |
|
|
hai evryone, itz me again, i have written some code to activate ds1620,
still it is not working. actually this code doesnt show the temperature
readings, but it will just check weather some signal is comming from
ds1620. so if any one can spare for 5 mins please have a look and
suggest me where the problem is and why iam not able to get the ouput.
/*ds1260.c iam using pic 16f876 which has two 7 segment led displays*/
#include <16F876.h>
#device 16F876 ICD=TRUE
#use delay(clock=4000000)
#fuses XT,NOWDT, NOPROTECT, NOPUT, NOBROWNOUT
#define led_delay 500
#define digitbit 49 /* for left display LB0 = (8x6)+1 */
#define digitbit1 48 /* for right display RB0 = (8x6)+0 */
#define clk_c0 56 /* portc 0 bit */
#define rst_c1 57 /* portc 1 bit */
#define ip_c5 61 /* portc 5 bit the i/p of ds1620 is been
connected to 5th pin of pic*/
#define input 0xff
#define output 0x00
#define port_c 0x07
/*#define temp 0x22, i havent defined temp variable it automatically
taking 22h for temp, so the below tempmsb has been caluculated like 22*
8+7=183*/
#define tempmsb 183
#define config 0x0c
#define valbit 176 /* here the 22 byte 0th bit same as above*/
#define seg7zero 0x3f
#define seg7one 0x06
#define rstdelay 5
/* write function*/
void write_ds1620(byte adrs)
{
byte i;
int value;
for(i=0; i<8; i++)
{
output_low(clk_c0);
adrs =adrs>>1;
value=adrs&0x01;
if(value==0x01)
{
output_high(ip_c5);
}
else
output_low(ip_c5);
output_high(clk_c0);
delay_us(1);
}
delay_us(rstdelay);
}
void main()
{
while(1)
{
byte rawtemp,temp=0x02;
int i;
int cnt = 0;
set_tris_c(0xdc); /*11011100*/
delay_us(rstdelay);
output_high(rst_c1);
write_ds1620(config);
write_ds1620(0x02);
write_ds1620(0xee);
write_ds1620(0xaa);
output_low(rst_c1);
set_tris_c(0x20); /* reading from ds 1620*/
output_high(rst_c1);
for(i=0; i<8; i++)
{
output_low(clk_c0);
temp=temp/2; /*22h*/
if(bit_test(*port_c,0x05))
output_high(tempmsb);
else
output_low(tempmsb);
output_high(clk_c0);
delay_us(1);
}
output_low(rst_c1);
delay_us(rstdelay);
/*stop conversion*/
set_tris_c(0xdc);
write_ds1620(0x22);
/*display*/
/*following checks the lsb of temp register where the reading has taken
from the ds1620 . if any data is comming it will get some value in the
register so it checks the lsb of the temp(22h) register and displays
according to lsb.*/
set_tris_c(0x00);
if(bit_test(*temp,0x00))
{
output_high(digitbit1);
output_c(seg7one);
delay_us(led_delay);
}
else
{
output_high(digitbit);
output_c(seg7zero);
delay_us(led_delay);
}
}/*while*/
}/*main*/ |
|
| Back to top |
|
 |
|
|
|
|