Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

1-wire Search ROM routine

Status
Not open for further replies.

Inkwaterman

Member level 1
Joined
Apr 28, 2004
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
360
search rom

Hi !
I have to interface a PIC to a 1-wire bus with 3 devices.

I have just used some 1-wire devices , but I haven't used a 1-wire bus.

Has anybody done a 1-wire Search ROM routine ?

If it's possible , can you post me your source code ?

Tnx
 

irfanahh

Newbie level 3
Joined
May 5, 2006
Messages
3
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,309
rom search

Hi,
i am making also a interface between Microcontroller MSP430f149 and multilple ibuttons devices through Transport DS2484. search algorithem now i am writing but this is not complet...i am also finding some guy who has some ideas about it...if u got some solution plz inform me also..irfan
 

    V

    Points: 2
    Helpful Answer Positive Rating

Inkwaterman

Member level 1
Joined
Apr 28, 2004
Messages
32
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
360
one wire search rom

Hi !

in my case I had to interface some 1-wire devices with a Microchip PIC, for did it I used a PIC's PIN , without any Transport DS2484.

If you want I can post you my code, it works well .

The only thing that you have to do is to adapt it to your requirements ..

Regards
 

irfanahh

Newbie level 3
Joined
May 5, 2006
Messages
3
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,309
search rom ds1820

Hi..


it will be nice if u send me ur code...i will change it according to my requirement...because basic search algorithum work on the same way..i am waiting ur answer thanks alot irfan
 

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
ds18s20 search rom

I have a 1-wire Search ROM routine write in CCS. If you are interested, i post it.
 

stroma

Advanced Member level 4
Joined
Apr 25, 2002
Messages
114
Helped
9
Reputation
18
Reaction score
6
Trophy points
1,298
Activity points
837
onewire search rom

hi martinisonline,

i'm interested too. can you post you code?

best regards,
stroma
 

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
routine c one wire

I atached a complete working project i made some time ago. It's about the DS1820 (Digital temperature sensor) that works over a onewire bus.

It includes:
onewire.c driver
ds1820.c driver
main.c file of project.

It will search all devices atached to the bus, and indexes them. If one device is disconnected or connected, it will perform a new search index.

the files have some comments in english and most of them in portuguese. If you have some problem, post it.
 

stroma

Advanced Member level 4
Joined
Apr 25, 2002
Messages
114
Helped
9
Reputation
18
Reaction score
6
Trophy points
1,298
Activity points
837
ds18s20 rom code

nice work- very useful for me, thanks a lot

best regards,
stroma
 

snoopy

Member level 1
Joined
Sep 14, 2004
Messages
32
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
273
ds18b20 search rom

Tnx for code, I tried and compiler could not find LCD driver and header for 1820.

Is it possible to upload this too.

Regards

BOjan
 

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
ccs one wire routines

The driver for ds1820 is already attached in the previous post. you need to put it in the C:\???????\PICC\Drivers. or define in the options in ccs another directory for the drivers.

The driver for flex_LCD wasn't made by me, but it has usefull coments. it's easy to understand.
 

khongai

Full Member level 4
Joined
May 20, 2005
Messages
230
Helped
16
Reputation
32
Reaction score
11
Trophy points
1,298
Activity points
2,919
ds18s20 search rom microchip

you can find at maxim website
 

snoopy

Member level 1
Joined
Sep 14, 2004
Messages
32
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
273
www. search-roms .com

Finaly I made, very useful, TNX
Your CODE is working in my test board. But now I have new problems.

I do not have debagger circuit for testing code step by step.

Which variable present temperature ?

Bojan
 

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
pic one wire search

At main.c file after "lcd_init()":

procurar(); -> search all devices in the bus

convert_temp(); -> send to the bus the code to start a temperature conversion to all devices.

read_temp(dados, i); -> read the value of device 'i' and save it in the variable 'dados'

trata_temperatura(dados); -> Do a math calculation to get the extended resolution (see ds1820 datasheet, pag. 4) and put the value at "inteiro" and "decimal"


the value of temperature is known after the function 'trata_temperatura(dados);"
Value: AA,BB ºC where: AA -> "Inteiro" and BB -> "Decimal"

You need to format the printf like the example at main.c:
printf(lcd_putc,"Int.: %02u,%02u 'C ",inteiro, decimal);

i had 2 sensors. one inside and other outside the room. The Int.: in the lcd is the inside temp. and the Ext.: is the outside temp.
 

snoopy

Member level 1
Joined
Sep 14, 2004
Messages
32
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
273
1wire search rom

HI

I was successful to read 64 bit ROM adress from my 18S20 and manualy write it to program.
Program detect the sensor, but does`t show correct temperature. LCD alveys show
3,39 C even to worm sensor with fingers.

Any idea where is problem?

Regards Bojan
 

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
1 wire search rom

probably the problem is the funtion "read_temp(dados, i)". After the funtion "procurar()", the program 'enumerates' the devices (1, 2, 3, ...).


go to the onewire.c driver, at funtion "void FindDevices(void)" delete the \* and *\:

//******************************************************************************
// DESCRIÇAO: Procura novos dispositivos no bus
//
// INPUT: Nada
//
// OUTPUT: Nada

//------------------------------------------------------------------------------
void FindDevices(void)
{
int8 m;

if(!ow_reset())
{
if(First()) // Begins when at least one part found
{
numROMs = 0;

do
{
numROMs++;

for (m=0;m<8;m++)
{
FoundROM[numROMs][m] = ROM[m]; // Identifies ROM no. on device
}
/* <---DELETE THIS
printf("\r\nEndereco do dispositivo No %u: ",numROMs);

printf("%X%X%X%X%X%X%X%X\n\r",
FoundROM[numROMs][7],FoundROM[numROMs][6],FoundROM[numROMs][5],
FoundROM[numROMs][4],FoundROM[numROMs][3],FoundROM[numROMs][2],
FoundROM[numROMs][1],FoundROM[numROMs][0]);
*/ <---DELETE THIS
} while (Next() && (numROMs<10)); // Continues until no additional
// devices found.
// printf(lcd_putc,"\fTotal Disp.: %u",numROMs);
// delay_ms(500);
}
}
// putc('\n'); putc('\r');
}
//******************************************************************************

now you can view in hyperterminal the rom code and the device number (I assume that you are using rs232)

At main.c edit one of the "IFs" with your DS18S20 rom code.

my example:
//edit---------------------|-------------------------------|------------------------------|---...
if(FoundROM[7]==0xe1 && FoundROM[6]==0x00 && FoundROM[5]==0x08 && FoundROM[4]==0x00 && FoundROM[3]==0xc4 && FoundROM[2]==0x8f && FoundROM[1]==0xbb && FoundROM[0]==0x10){
//se o chip do interior corresponde ao ROM //E1000800C48FBB10 <-- Rom code


After this, if you have problems, post your code.
 

soulraven

Newbie level 6
Joined
Feb 13, 2009
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Campulung Muscel, Romania
Activity points
1,349
1-wire search routine

hello, I tried the code above, just go try to adapt to ds18b20 ..... which have to adjust .... comments are in Spanish and do not understand
 

abric

Newbie level 1
Joined
Feb 9, 2008
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,285
hello,
i done the "rom search" routine in assembler
contact me at ---abric.jy@libertysurf.fr---
or go to the french site "pic mcu" of "BIGONOF" in application from "abric jean-yves"
 

lorac_241

Newbie level 1
Joined
Jan 9, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,284
I'm from Spain and the comments are in Portuguese, not in Spanish ¬¬ Learn languages before talking so bravely.
 

avh

Newbie level 1
Joined
Jan 10, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,285
Thanks to martinisonline I made ROM search work for the Rabbit RCW5600W module. Needed tweaked timing and disabling interrupts at critical moments. (used an oscilloscope for debugging :)

PS: I found you really need a 4k7 pull-up, I got inconsistent results with a 10k resistor.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top