Using Multiple DS18S20 and one wire library

General discussion on mikroC.
Author
Message
shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#16 Post by shanpuru » 04 Dec 2009 11:39

Hi,

Still no luck.

Two DS18S20 is connected on RE2/AN7/CS pin.

If I disconnect both the devices, still the following program detects a device, if connect the wires, it still detects but is not able to read the address of the one wire device.

#define ow_DQPin PORTE.F2 // One Wire Bus pin assignment
#define ow_Reg TRISE.F2

ADCON1 = 7;

void ow_Pull_Low(){
ow_Reg = 0;
ow_DQPin = 0;
}

void ow_Float_High() {
ow_Reg = 1;
ow_DQPin = 1;
}

char Ow_Init() {
Ow_Pull_Low(); // pull 1-wire low for reset pulse
delay_us(510); // Wait > 480us

Ow_Float_High(); // Release data pin (set to input for high) float 1-wire high
delay_us(70); // Wait > 60us for presence pulse, allowing for device variation

if (ow_DQPin == 0) {
usart_write_constStr(TxtBuffer,"Init OK");newline();
delay_us(420); // wait-out remaining initialisation window, end of presence pulse
return 1; //Init OK
} else {
usart_write_constStr(TxtBuffer,"Init Fail");newline();
delay_us(420); // wait-out remaining initialisation window, end of presence pulse
return 0; //Init Fail
}


}

Please help me find where it is going wrong.

Thank You.

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#17 Post by Mince-n-Tatties » 04 Dec 2009 13:10

shanpuru wrote:Hi,

I am using PIC16F877A.

I have dowloaded MikroC Pro but the following lines are giving error.

ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;

Thank You.
replace the above 4 lines with

Code: Select all


    ADCON0 = 0;
    ADCON1 = 7;
    CMCON  = 7;

shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#18 Post by shanpuru » 07 Dec 2009 10:45

Here is the full code.

Please help in understanding where could be the issue.

PIC - PIC16F877A

#define ow_DQPin PORTE.F2 // One Wire Bus pin assignment
#define ow_Reg TRISE.F2

#define DS1820_Tvalue 0 //Temperature LSB (AAh)
#define DS1820_TSign 1 //Temperature MSB (00h) EEPROM
#define DS1820_Thigh 2 //TH Register or User Byte 1
#define DS1820_Tlow 3 //TL Register or User Byte 2
#define DS1820_CntRemain 6 //OUNT REMAIN (0Ch)
#define DS1820_CntPerC 7 //COUNT PER °C (10h)
#define DS1820_CRC 8 //CRC check value

unsigned char TxtBuffer[20]; //buffer for USART output
char i,j; //general purpose counter etc
char ByteTxt[4]; //general purpose to convert byte to txt for display
char scratchPad[9]; //scratchPad memory of DS1820
char DS1820_ROM[8]; //
char temp; //temperature after conversion from DS1820

int rslt,cnt;

//only temporary for using mikroC library
char byteC;

int key;

#include "C:\Downloads\1-wireLib_mC\mC\Program\p16F877A\SerOut16.h"
#include "C:\Downloads\1-wireLib_mC\mC\Program\p16F877A\ByteToHex18.h"

void NewLine() {
Usart_Write(13); Usart_Write(10);
}

void ow_Pull_Low(){
ow_Reg = 0;
ow_DQPin = 0;
}

void ow_Float_High() {
ow_Reg = 1;
ow_DQPin = 1;
}

//******************************************************************************/
// Read bit on one wire bus
char read_bit(void) {
ow_Pull_Low();//output_low(DQ);
delay_us(1); // 1uS min. Original code relied on 8051 being slow
ow_Float_High();//output_float(DQ);
delay_us(10); // Wait at least 15mS from start of time slot ******************************************
if (ow_DQPin == 0) {
return 0;
} else {
return 1;
}
//return(input(DQ)); // Delay to finish time slot (total 60 to 120uS)
} // must be done next.
/******************************************************************************/
void write_bit(char bitval)
{
ow_Pull_Low();//output_low(DQ);

if(bitval == 1) {
delay_us(1); // 1uS min. Original code relied on 8051 being slow
ow_Float_High();//output_float(DQ);
}
delay_us(60); // Wait for end of timeslot
ow_Float_High();//output_float(DQ);
}

char read_byte(void)
{
char i;
char val = 0;

for(i=0;i<8;i++)
{
if(read_bit()) val |= (0x01 << i);
delay_us(51); // To finish time slot
}

return val;
}
/******************************************************************************/
void write_byte(char val)
{
char i;
char temp;

for (i=0;i<8;i++)
{
temp = val >> i;
temp &= 0x01;
write_bit(temp);
}
//delay_us(105);
}

/******************************************************************************
* Function: ow_Init()
* Dependencies: ow_Pull_Low(); ow_Float_High()
* Input: #define for the ow_DQPin, ow_Reg
* Output: returns 1=Init OK (presense pulse detected); 0=Init Failed
* Overview:
* Notes: From the source info, this initialisation will only work for
* a single permanently connected device
* also, interrupts will possibly interfer with the timing needed
* interacting with the DS1820, .: should be turned off at start
* of routine, and then back on afterward
*****************************************************************************/
char Ow_Init() {
Ow_Pull_Low(); // pull 1-wire low for reset pulse
delay_us(510); // Wait > 480us

Ow_Float_High(); // Release data pin (set to input for high) float 1-wire high
delay_us(70); // Wait > 60us for presence pulse, allowing for device variation

if (ow_DQPin == 0) {
usart_write_constStr(TxtBuffer,"Init OK");newline();
delay_us(420); // wait-out remaining initialisation window, end of presence pulse
return 1; //Init OK
} else {
usart_write_constStr(TxtBuffer,"Init Fail");newline();
delay_us(420); // wait-out remaining initialisation window, end of presence pulse
return 0; //Init Fail
}


}

/******************************************************************************
* Function: ow_Read_PwrSupply()()
* Dependencies: write_byte(); read_byte()
* Input: #define for the ow_DQPin, ow_Reg
* Output: returns 0=parasite power supply; 1=external power supply
* Overview:
* Notes:
*****************************************************************************/
char Ow_Read_PwrSupply(){
char i;

Ow_Init(); //
write_byte(0xCC); // Issue command SKIP_ROM
write_byte(0xB4); // Issue command READ_POWER_SUPPLY
i=read_byte();
if (i==0) {
return 0; //Parasite
} else {
return 1; //External"
}
}

/******************************************************************************
* Function: ow_Read_ScratchPad(char sPad[8])
* Dependencies: write_byte(); read_byte()
* Input: #define for the ow_DQPin, ow_Reg
* Output:
* Overview:
* Notes:
*****************************************************************************/
void Ow_Read_ScratchPad(char sPad[8]){
char i;

Ow_Init(); //
write_byte(0xCC); // Issue command SKIP_ROM
write_byte(0xBE); // Issue command READ_SCRATCHPAD
for (i=0;i<8;i++) {
sPad = read_byte();
}
}

/******************************************************************************
* Function: ow_Read_ROM(char ROM[8])
* Dependencies:
* Input: #define for the ow_DQPin, ow_Reg
* Output:
* Overview:
* Notes: This function is only useful for a single device on the one-
* bus - otherwise data collision.
*****************************************************************************/
void Ow_Read_ROM(char DS_ROM[8]){
char i;

Ow_Init(); //
write_byte(0x33); // Issue command READ_ROM
DS_ROM[0] = read_byte(); // device family code
for (i=1;i<7;i++) { // device serial number
DS_ROM = read_byte();
}
DS_ROM[7] = read_byte(); // CRC
}

/******************************************************************************
* Function: Ow_Set_Temp_Alarms()
* Dependencies:
* Input: #define for the ow_DQPin, ow_Reg
* Output:
* Overview:
* Notes:
*****************************************************************************/
void Ow_Set_Temp_Alarms(char Thigh, char Tlow){
char i;
char sPad[8];

Ow_Init(); // Master issues reset pulse.
write_byte(0xCC); // Master issues Skip ROM command
write_byte(0x4E); // Master issues Write Scratchpad command.
write_byte(Thigh); // Master sends two data bytes to scratchpad (TH and TL)
write_byte(Tlow);
Ow_Init(); // Master issues reset pulse
write_byte(0xCC); // Master issues Skip ROM command
Ow_Read_ScratchPad(sPad); // Master issues Read Scratchpad command.
// still need to implement the following
// The master then recalculates the CRC of the first eight data bytes from the
// scratchpad and compares the calculated CRC with the read CRC (byte 9).
// If they match, the master continues; if not, the read operation is repeated.
// this will require setting a flag, and using some sort of counter for how many
// tries before returning temp alarms failed to set
Ow_Init(); // Master issues reset pulse
write_byte(0xCC); // Master issues Skip ROM command
write_byte(0x48); // Master issues Copy Scratchpad command.
// Copies TH and TL data from the scratchpad to EEPROM.
Ow_Float_High(); // DQ line held high by strong pullup
delay_us(15); // > 10ms while copy operation is in progress.
}

/******************************************************************************
* Function: Ow_Read_Temp(char sPad[8])
* Dependencies:
* Input: #define for the ow_DQPin, ow_Reg
* Output:
* Overview:
* Notes: The temperature data is read from the DS1820 and returned in
* the variable sPad - the actual display of the temperature data
* is left to the calling routine (manipulate first byte of sPad etc)
* as the display is likely to be specific depending upon output
* device, USART, LCD etc.
*****************************************************************************/
void Ow_Read_Temp(char sPad[8]){
char i;

Ow_Init(); // Master issues reset pulse.
write_byte(0xCC); // Master issues Skip ROM command
write_byte(0x44); // Master issues Convert T command
// if in parasite power mode, DQ line held high by strong pullup
// Master applies strong pullup to DQ for the duration of the conversion (tconv).
// however, not needed if in external power
// this needs to be implemented using call to power_type

Ow_Read_ScratchPad(sPad);

// still need to implement the following
// The master then recalculates the CRC of the first eight data bytes from the
// scratchpad and compares the calculated CRC with the read CRC (byte 9).
// If they match, the master continues; if not, the read operation is repeated.
// The master also calculates the TEMP_READ value and stores the contents of the COUNT
// REMAIN and COUNT PER °C registers.
// this will require setting a flag, and using some sort of counter for how many
// tries before returning temp alarms failed to set

Ow_Init(); // Master issues reset pulse

// still need to implement the following
// CPU calculates extended resolution temperature using the equation in the
// OPERATION — MEASURING TEMPERATURE section of this datasheet.
}

void display_scratchPad_data(){
temp = scratchPad[DS1820_Tvalue]>>1; //right bit shift to get rid of fractional temp, bit 0
usart_write_constStr(TxtBuffer,"T= ");
ByteToStr(temp,ByteTxt);
Usart_Write_Str(ByteTxt);
usart_write_constStr(TxtBuffer,".");
if (scratchPad[DS1820_Tvalue] & 0x0001) { //bit 0 = 1 then fractional = 0.5 else = 0.0
usart_write_constStr(TxtBuffer,"5");
} else {
usart_write_constStr(TxtBuffer,"0");
} // scratchPad[DS1820_TSign] = 1 indicates negative temp, =0 indicates positive temp
usart_write_constStr(TxtBuffer,"°C ");
usart_write_constStr(TxtBuffer,"Counts Remain= ");
ByteToStr(scratchPad[DS1820_CntRemain],ByteTxt);
Usart_Write_Str(ByteTxt);
// usart_write_constStr(TxtBuffer," Counts/°C ");
// ByteToStr(scratchPad[DS1820_CntPerC],ByteTxt); //should always be 0x10 for DS1820
// Usart_Write_Str(ByteTxt);
usart_write_constStr(TxtBuffer," T High Alarm= ");
ByteToStr(scratchPad[DS1820_Thigh],ByteTxt);
Usart_Write_Str(ByteTxt);
usart_write_constStr(TxtBuffer," T Low Alarm= ");
ByteToStr(scratchPad[DS1820_Tlow],ByteTxt);
Usart_Write_Str(ByteTxt);
newLine();
}
//************************************************************************************************************************
//************************************************************************************************************************
// global search state
unsigned char ROM_NO[8];
int LastDiscrepancy;
int LastFamilyDiscrepancy;
int LastDeviceFlag;
unsigned char crc8;
unsigned char Found_ROMs[8][8]; //**************** MINE ADDED

const unsigned char dscrc_table[] = {
0, 94,188,226, 97, 63,221,131,194,156,126, 32,163,253, 31, 65,
157,195, 33,127,252,162, 64, 30, 95, 1,227,189, 62, 96,130,220,
35,125,159,193, 66, 28,254,160,225,191, 93, 3,128,222, 60, 98,
190,224, 2, 92,223,129, 99, 61,124, 34,192,158, 29, 67,161,255,
70, 24,250,164, 39,121,155,197,132,218, 56,102,229,187, 89, 7,
219,133,103, 57,186,228, 6, 88, 25, 71,165,251,120, 38,196,154,
101, 59,217,135, 4, 90,184,230,167,249, 27, 69,198,152,122, 36,
248,166, 68, 26,153,199, 37,123, 58,100,134,216, 91, 5,231,185,
140,210, 48,110,237,179, 81, 15, 78, 16,242,172, 47,113,147,205,
17, 79,173,243,112, 46,204,146,211,141,111, 49,178,236, 14, 80,
175,241, 19, 77,206,144,114, 44,109, 51,209,143, 12, 82,176,238,
50,108,142,208, 83, 13,239,177,240,174, 76, 18,145,207, 45,115,
202,148,118, 40,171,245, 23, 73, 8, 86,180,234,105, 55,213,139,
87, 9,235,181, 54,104,138,212,149,203, 41,119,244,170, 72, 22,
233,183, 85, 11,136,214, 52,106, 43,117,151,201, 74, 20,246,168,
116, 42,200,150, 21, 75,169,247,182,232, 10, 84,215,137,107, 53};

//--------------------------------------------------------------------------
// Calculate the CRC8 of the byte value provided with the current
// global 'crc8' value.
// Returns current global crc8 value
//
unsigned char docrc8(unsigned char value) {
// See Application Note 27
crc8 = dscrc_table[crc8 ^ value];
return crc8;
}
//--------------------------------------------------------------------------
// Perform the 1-Wire Search Algorithm on the 1-Wire bus using the existing
// search state.
// Return TRUE : device found, ROM number in ROM_NO buffer
// FALSE : device not found, end of search
//
int OWSearch() {
int id_bit_number;
int last_zero, rom_byte_number, search_result;
int id_bit, cmp_id_bit;
unsigned char rom_byte_mask, search_direction;
// initialize for search
id_bit_number = 1;
last_zero = 0;
rom_byte_number = 0;
rom_byte_mask = 1;
search_result = 0;
crc8 = 0;
// if the last call was not the last one
if (!LastDeviceFlag) {
// 1-Wire reset
if (!Ow_Init()) { //OWReset()) {
// reset the search
LastDiscrepancy = 0;
LastDeviceFlag = 0;//FALSE;
LastFamilyDiscrepancy = 0;
return 0;//FALSE;
}
// issue the search command
write_byte(0xF0); //OWWriteByte(0xF0);
// loop to do the search
do {
// read a bit and its complement
id_bit = read_bit(); //OWReadBit();
cmp_id_bit = read_bit(); //OWReadBit();
// check for no devices on 1-wire
if ((id_bit == 1) && (cmp_id_bit == 1)) {
break;
} else {
// all devices coupled have 0 or 1
if (id_bit != cmp_id_bit) {
search_direction = id_bit; // bit write value for search
} else {
// if this discrepancy if before the Last Discrepancy
// on a previous next then pick the same as last time
if (id_bit_number < LastDiscrepancy) {
search_direction = ((ROM_NO[rom_byte_number] & rom_byte_mask) > 0);
} else {
// if equal to last pick 1, if not then pick 0
search_direction = (id_bit_number == LastDiscrepancy);
}
// if 0 was picked then record its position in LastZero
if (search_direction == 0) {
last_zero = id_bit_number;
// check for Last discrepancy in family
if (last_zero < 9) LastFamilyDiscrepancy = last_zero;
}
}
// set or clear the bit in the ROM byte rom_byte_number with mask rom_byte_mask
if (search_direction == 1) {
ROM_NO[rom_byte_number] |= rom_byte_mask;
} else {
ROM_NO[rom_byte_number] &= ~rom_byte_mask;
}
// serial number search direction write bit
write_bit(search_direction); //OWWriteBit(search_direction);
// increment the byte counter id_bit_number and shift the mask rom_byte_mask
id_bit_number++;
rom_byte_mask <<= 1;
// if the mask is 0 then go to new SerialNum byte rom_byte_number and reset mask
if (rom_byte_mask == 0){
docrc8(ROM_NO[rom_byte_number]); // accumulate the CRC
rom_byte_number++;
rom_byte_mask = 1;
}
}
}
while(rom_byte_number < 8); // loop until through all ROM bytes 0-7
// if the search was successful then
if (!((id_bit_number < 65) || (crc8 != 0))) {
// search successful so set LastDiscrepancy,LastDeviceFlag,search_result
LastDiscrepancy = last_zero;
// check for last device
if (LastDiscrepancy == 0) LastDeviceFlag = 1;//TRUE;
search_result = 1;//TRUE;
}
}
// if no device found then reset counters so next 'search' will be like a first
if (!search_result || !ROM_NO[0]) {
LastDiscrepancy = 0;
LastDeviceFlag = 0;//FALSE;
LastFamilyDiscrepancy = 0;
search_result = 0;//FALSE;
}
return search_result;
}

//--------------------------------------------------------------------------
// Find the 'first' devices on the 1-Wire bus
// Return TRUE : device found, ROM number in ROM_NO buffer
// FALSE : no device present
//
int OWFirst() {
// reset the search state
LastDiscrepancy = 0;
LastDeviceFlag = 0;//FALSE;
LastFamilyDiscrepancy = 0;
return OWSearch();
}

//--------------------------------------------------------------------------
// Find the 'next' devices on the 1-Wire bus
// Return TRUE : device found, ROM number in ROM_NO buffer
// FALSE : device not found, end of search
//
int OWNext() {
// leave the search state alone
return OWSearch();
}

//--------------------------------------------------------------------------
// Verify the device with the ROM number in ROM_NO buffer is present.
// Return TRUE : device verified present
// FALSE : device not present
//
int OWVerify() {
unsigned char rom_backup[8];
int i,rslt,ld_backup,ldf_backup,lfd_backup;
// keep a backup copy of the current state
for (i = 0; i < 8; i++)
rom_backup = ROM_NO;
ld_backup = LastDiscrepancy;
ldf_backup = LastDeviceFlag;
lfd_backup = LastFamilyDiscrepancy;
// set search to find the same device
LastDiscrepancy = 64;
LastDeviceFlag = 0;//FALSE;
if (OWSearch()) {
// check if same device found
rslt = 1;//TRUE;
for (i = 0; i < 8; i++) {
if (rom_backup != ROM_NO) {
rslt = 0;//FALSE;
break;
}
}
} else {
rslt = 0;//FALSE;
}
// restore the search state
for (i = 0; i < 8; i++)
ROM_NO = rom_backup;
LastDiscrepancy = ld_backup;
LastDeviceFlag = ldf_backup;
LastFamilyDiscrepancy = lfd_backup;
// return the result of the verify
return rslt;
}

//--------------------------------------------------------------------------
// Setup the search to find the device type 'family_code' on the next call
// to OWNext() if it is present.
//
void OWTargetSetup(unsigned char family_code) {
int i;
// set the search state to find SearchFamily type devices
ROM_NO[0] = family_code;
for (i = 1; i < 8; i++)
ROM_NO = 0;
LastDiscrepancy = 64;
LastFamilyDiscrepancy = 0;
LastDeviceFlag = 0;//FALSE;
}

//--------------------------------------------------------------------------
// Setup the search to skip the current device type on the next call
// to OWNext().
//
void OWFamilySkipSetup() {
// set the Last discrepancy to last family discrepancy
LastDiscrepancy = LastFamilyDiscrepancy;
LastFamilyDiscrepancy = 0;
// check for end of list
if (LastDiscrepancy == 0)
LastDeviceFlag = 1;//TRUE;
}

// Sends Match ROM command to bus then device address
char Ow_MatchRom(unsigned char ROM_SerialNum[8]) {
int i;

if (Ow_Init()) { // Master issues reset pulse.
write_byte(0x55); // Master issues Match ROM command
for (i=0;i<8;i++){
write_byte(ROM_SerialNum); // Send ROM code
};
return 1;
} else {
return 0;
}
}

void main() {
ADCON0 = 0;
ADCON1 = 7; // set all PORT E to digital I/O
CMCON = 7;

//Initializes USART
Usart_Init(2400);
Usart_Write_ConstStr(TxtBuffer,"--- my routines ---");NewLine();

// find ALL devices
newLine(); usart_write_constStr(TxtBuffer,"List all devices"); newLine();
cnt = 0;
rslt = OWFirst();
while (rslt) {
// print device found
usart_write_constStr(TxtBuffer,"Device #");
IntToStr(cnt++,ByteTxt);
usart_write_Str(ByteTxt);
usart_write_constStr(TxtBuffer," ROM ");
for (i=0;i<8;i++) {
Found_ROMs[cnt][i]= ROM_NO[i];// store found ROM serial
ByteToStr(ROM_NO[i],ByteTxt);
Usart_Write_Str(ByteTxt);
usart_write_constStr(TxtBuffer,",");
}
newline();
rslt = OWNext();
}
usart_write_constStr(TxtBuffer,"Total Found ");

IntToStr(cnt,ByteTxt);
usart_write_Str(ByteTxt);

newline();
/*
do {
for (i=1;i<=cnt;i++){
for (j=0;j<8;j++) ROM_NO[j]=Found_ROMs[i][j];
Ow_Init(); // Master issues reset pulse.
if (Ow_MatchRom(ROM_NO)) {
write_byte(0x44); // Master issues Convert T command
delay_ms(500);
// if parasite powered, would need delay 500ms here
Ow_Init(); // Master issues reset pulse.
if (Ow_MatchRom(ROM_NO)) {
write_byte(0xBE); // Issue command READ_SCRATCHPAD
for (j=0;j<8;j++) {
scratchPad[j] = read_byte();
}
usart_write_constStr(TxtBuffer,"Dev#");
ByteToStr(i,ByteTxt);
usart_write_Str(ByteTxt);
usart_write_constStr(TxtBuffer," ");
//display_scratchPad_data();

temp = scratchPad[DS1820_Tvalue]>>1; //right bit shift to get rid of fractional temp, bit 0
usart_write_constStr(TxtBuffer,"T= ");
ByteToStr(temp,ByteTxt);
Usart_Write_Str(ByteTxt);
usart_write_constStr(TxtBuffer,".");
if (scratchPad[DS1820_Tvalue] & 0x0001) { //bit 0 = 1 then fractional = 0.5 else = 0.0
usart_write_constStr(TxtBuffer,"5");
} else {
usart_write_constStr(TxtBuffer,"0");
}
newLine();
}
}
}
usart_write_constStr(TxtBuffer,"--------------");
newLine();
delay_ms(1000);
} while (1);
*/
}

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

#19 Post by tihomir.losic » 08 Dec 2009 14:09

Mince-n-Tatties wrote:
shanpuru wrote:Hi,

I am using PIC16F877A.

I have dowloaded MikroC Pro but the following lines are giving error.

ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;

Thank You.
replace the above 4 lines with

Code: Select all


    ADCON0 = 0;
    ADCON1 = 7;
    CMCON  = 7;
Hello,

the third line form upper quote is not neccesary, so please remove CMCON = 7;

I tested your program without that third line, and it works excellent. Program tested with PIC16F877, as you wrote, and of course temperature sensor DS1820.

And, if you want complete project, please open the support ticket at: http://www.mikroe.com/en/support/, and write to me, i will send files to you.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#20 Post by shanpuru » 09 Dec 2009 16:38

Hi Losic,

I am not able to trace your email id.

I have registered this issue on support site.

Thank You

shanpuru
Posts: 39
Joined: 20 Nov 2009 18:42

#21 Post by shanpuru » 16 Dec 2009 07:42

Hi,

This has started working after changing the Clock to 4Mhz.

It does not work at 8Mhz or higher.

Please help me understand the relation between Clock and timing for one wire.

Thank You.

prancius
Posts: 148
Joined: 26 Sep 2007 21:52

Re: Using Multiple DS18S20 and one wire library

#22 Post by prancius » 08 Nov 2014 23:30

Yes your code is working only with 4MGz.

Did you find why it is not working in 8MGz?

Regards,
Pranas

Post Reply

Return to “mikroC General”