Page 1 of 1

One Wire Fails

Posted: Sat Sep 17, 2016 11:34 am
by johnsondav
HI everyone

I have been trying to get this 'One Wire - DS18B20' component to work on my project without success. It worked using FC5. So, I have downloaded the sample Single One Wire Demo and tried to compile that using FC7, same problem. This is what the compiler reports using the Demo file:
Registered to: johnsondav
Licence key: XXXXXX
http://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe --chip=16F1937 "SingleOneWire.c" --MSGDISABLE=359,1273,1388
SingleOneWire.c: FCD_0bbd1_OneWire1__Get_Next_ID()
637: break;
^ (345) unreachable code (warning)
.

Memory Summary:
Program space used B26h ( 2854) of 2000h words ( 34.8%)
Data space used B4h ( 180) of 200h bytes ( 35.2%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
Data stack space used 0h ( 0) of 110h bytes ( 0.0%)
Configuration bits used 2h ( 2) of 2h words (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)

Microchip MPLAB XC8 C Compiler (Free Mode) V1.36
Build date: Jan 14 2016
Part Support Version: 1.36
Copyright (C) 2016 Microchip Technology Inc.
License type: Node Configuration
The unreachable warning prevents the device from allowing data been read by the PIC. I have checked to see if the bus is active using a scope and data is clearly been sent on the bus, either from the PIC or from the device. Not sure which, the scope does not show this. However, the read-out is always zero. Any help would be greatly appreciated.

Dave

Re: One Wire Fails

Posted: Sat Sep 17, 2016 12:58 pm
by Benj
Hi Dave,

Please can you attach your flowcode project file and we will take a look for you.

Re: One Wire Fails

Posted: Sat Sep 17, 2016 1:30 pm
by johnsondav
Hi Benj

Thanks for having a look. However, its not just my project its also the Demo component program as well.
SingleOneWire.fcfx
(10.52 KiB) Downloaded 402 times
I can not get either demo or project to work. with this component.

Dave

Re: One Wire Fails

Posted: Sat Sep 17, 2016 5:15 pm
by johnsondav
Hi Benj

I have done a bit more experimental work to try and find what specifically is going wrong. It appears to me, all though I am no expert, that with the modification to the Demo program, the error is with the CRC element of the compiler. Therefore, I have switched to the XC8 Ver 1.38 compiler which has some updates to the CRC in Ver 1.37 release. This has not change the end result. I am still getting the zero result displayed or with the CRC branch enabled in the demo file 'CRC error' displayed.

Re: One Wire Fails

Posted: Mon Sep 19, 2016 10:38 am
by Benj
Hello,

I have just tried the example from the URL below on a 16F1937 running at 19.6608MHz and it seems to be working fine in v7 to read a DS18S20+ sensor.

http://www.matrixtsl.com/wikiv7/index.p ... 82b7c71023

Are you powering the sensor or using the parasitic power option?
SingleOneWire.c: FCD_0bbd1_OneWire1__Get_Next_ID()
645: break;
^ (345) unreachable code (warning)
This is normal and can be ignored.

Re: One Wire Fails

Posted: Mon Sep 19, 2016 12:50 pm
by johnsondav
Hi Benj

My sincere apologies. The fault is all mine. The chip I am using is a PIC18F4550 and the compiler warning through me to believe the compiler had not done as I wanted. However, that is not the case as every thing is working once I made a change to the crystal clock settings. Communication to the DS18B20 is now working correctly. The PIC18F4550 has a PLL clock which MUST be setup correctly before the timings are correct for this device. At least that's what I think was wrong.

Once again, thank you and sorry to have wasted your time. A bit more learned.

Re: One Wire Fails

Posted: Mon Sep 19, 2016 1:00 pm
by Benj
Brilliant, glad it's working correctly for you now.

Re: One Wire Fails

Posted: Fri Dec 08, 2017 8:00 pm
by Ulises72
Hi Johnsondav, can you tell me how to configure the 18F4550 chip so that the DS18BB20 will work? I have the problem of CRC error, I have this bug in version 7 and 6, in version 5 it works very well.

regards