Skip to main content

Posts

Showing posts with the label Project

Temperature Data Logger part 4

C-Program CODE #include <p18F4550.h> #include<stdio.h> #include "delayy.h" #include "DS1820.h" #include "serTr.h" #include "VI.h" #define TRUE 1; #define FALSE 0; typedef unsigned char bool; typedef unsigned char uint8; static uint8 ROM_NO[8]; static uint8 LastDiscrepancy; static uint8 LastDeviceFlag; void DS1820(void); void FindDevices(void); uint8 OWFirst(void); uint8 OWSearch(void); void main() { int r; TXSTA = 0x20; // for asynchronous , tx enable settings SPBRG = 18; // for 12mhz baud rate. TXSTAbits.TXEN = 1; RCSTAbits.SPEN = 1; for(r=0;r<10;r++) DS1820_DelayUs(10000); //1sec delay DS1820(); // this function also contains V and I calling functions } /*****************************************/ void DS1820(void) { uint8 rslt, i,j; uint8 All_ROM[5][8]; int r,tem[9]; int cnt;...

Temperature Data Logger Part3

4.3.4 The Timing Diagrams DS1820 data is read and written through the use of time slots to manipulate bits and a command word to specify the transaction. Write Time Slots: A write time slot is initiated when the host pulls the data line from a high logic level to a low logic level. There are two types of write time slots: Write ‘1’ time slots and Write ‘0’ time slots as shown in fig 4.9. Fig 3.6: Master Write pulse for DS1820 Indications Master Active Low DS1820 Active Low PIC and DS1820 Low Resistor Pull-Up Fig 3.7: Master Read pulse for DS1820 Read Time Slots: The master generates read time slots when data is to be read from the DS1820. The data line must remain at a low logic level for a minimum of one µs to initiate read signal; output data from the DS1820 is valid for 15 µs after the falling edge of the read time slot. The master, therefore, must stop driving the I/O pin low in order to read its state 15 µs from the start of the read slot. By the en...