I'm having difficulties creating a program for the interface between mbed cpu and DS1620. All I need to is to get the temperature from DS1620. I'm very new to this and any help would be great.
#include "mbed.h"
Serial RS232(p9,p10); //tx,rx
DigitalOut nrst(p8);
SPI spi(p5, p6, p7);
int main (){
int temperature = -315;
RS232.printf("Continuous reading from DS1620\n\r");
//set clock and spi format
spi.format(8,0);
spi.frequency(20000);
while(1){
nrst = 0;
wait_us(100);
//initial converstion DS1620
nrst = 1;
spi.write(0xEE);//Start converstion
wait_us(50);
//start reading from DS1620
spi.write(0xAA);//Start read
temperature = spi.write(0x00);
RS232.printf("Temperature is %d\n\r",temperature);
wait(2.0);
}
}
I'm having difficulties creating a program for the interface between mbed cpu and DS1620. All I need to is to get the temperature from DS1620. I'm very new to this and any help would be great.
#include "mbed.h"
Serial RS232(p9,p10); //tx,rx
DigitalOut nrst(p8);
SPI spi(p5, p6, p7);
int main (){
int temperature = -315;
RS232.printf("Continuous reading from DS1620\n\r");
//set clock and spi format
spi.format(8,0);
spi.frequency(20000);
while(1){
nrst = 0;
wait_us(100);
//initial converstion DS1620
nrst = 1;
spi.write(0xEE);//Start converstion
wait_us(50);
//start reading from DS1620
spi.write(0xAA);//Start read
temperature = spi.write(0x00);
RS232.printf("Temperature is %d\n\r",temperature);
wait(2.0);
}
}