V4.2 OneWire Variable type declarations dont look correct

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
gggwww
Posts: 54
Joined: Wed Sep 09, 2009 12:50 am
Has thanked: 1 time
Contact:

V4.2 OneWire Variable type declarations dont look correct

Post by gggwww »

Ben,

I've been working from Eric's DS1820 program as the basis for understanding why I have been unable to get my replication of his experience to work properly.

I created a stripped down version of Eric's program that reads one DS1820. In the program I included LCD diagnostic statements to report return values from the DS functions available in V4.2 of Flowcode

One of the problems encountered is that the V4.2 Flowcode specifys that the variable return values from some of the functions are BYTE's. This looks incorrect as the LCD call diagnostic reports a character of 3 horizontal hashes ( one on top of another) - changing this return variable to an integer reports a 0. This is further supported by Eric's program specifying them as integers instead of bytes as V4.2 of Flowcode indicates they should be.

I would greatly appreciate your help in looking at my simple program that still wont function.

Im very focused on getting this to work and any help would be grealy appreciated.

I have attached the file

Thanks !!
Attachments
DS18S20gw.fcf
(9 KiB) Downloaded 279 times

Eric
Posts: 99
Joined: Tue Nov 06, 2007 11:04 pm
Been thanked: 1 time
Contact:

Re: V4.2 OneWire Variable type declarations dont look correct

Post by Eric »

Hello George,

I tried your program and it actualy works. It needs of course to be refined but the basic principles are correct.
Now I am even more convinced that you have a hardware problem somewhere.
Look at the attached diagram with simulation. I had to make some changes to make it run on my hardware ( lcd to portD, sensors to portA0, pic18F452 )
I also tested it on my hardware and there it gave the same results.
snap0430.jpg
(113.51 KiB) Downloaded 1037 times
2 of the 5 DS18 sensors are connected to PORTA0. Your program reads out device 1, which is the boiler sensor ( devicecount starts at 0 )
The temperature of that sensor is set at 47.0 Β°C.
Here I made some correction to your program. If you multiply the value by 10 and devide it afterwards by 16, then you get the temp value directly in Β°C with a resolution of 0.1 Β°C. You just need to convert this value to string and add a decimal comma.
I also removed the getpadbyte instruction. It is not necessary if you only want to read the temperature on a DS18B20.
In my original program this was needed to allow mixed sensors DS18S20 and DS18B20.

So, I think you are on the right track.
Just figure out what is wrong with your hardware.

Best regards,

Eric
Attachments
DS18S20gw.fcf
(8.5 KiB) Downloaded 332 times

gggwww
Posts: 54
Joined: Wed Sep 09, 2009 12:50 am
Has thanked: 1 time
Contact:

Re: V4.2 OneWire Variable type declarations dont look correct

Post by gggwww »

Eric,

Thanks for taking the time to put your reply together !!!

I wired up exacty as in your schematic - checked and double checked

I get all 0's when I run it - including a 0 for get temperature - i added a loop around the code to see if I could get any number other than 0 to show up for temperature - no success

I tried both a 0 and a 1 for device number with same result

Interesting that with no DS18B20 connected the results are the same - it's as if port A0 doesnt see the DS

I tried 5 separate DS18B20's to rule out a defective component and also 2 PIC18F452's - same result

Occasionally I would get random numbers on the LCD to the right of the print string diagnostic calls ?? - thought I may have an intermittent connection - checked all and all ok -

Interesting that some of the functions ( like get count) would occasionally hang up and stop program execution and I needed to hard reset to get the code to run to completion -

Other than adding a loop I made no changes to the code we are looking at.

I tried a 4.7K pullup and a 5.6K pullup on the DQ line of the DS and no impact

All supply voltages to PIC and DS are ok at 5.06V - all hardware checks out

Could it be a flowcode setting for the 18F452? Im using a PICKit2 from MicroChip.

This one is a tough one - LM34's with LInear outputs to A/D sure are easier to implement

I would really like to get the DS going -

Please dont feel obligated to spend any more time on this but would certainly appreciate any other thoughts you may have

Best Regards,
George

Eric
Posts: 99
Joined: Tue Nov 06, 2007 11:04 pm
Been thanked: 1 time
Contact:

Re: V4.2 OneWire Variable type declarations dont look correct

Post by Eric »

George,

What crystal frequency do you use?
It can be a timing problem.
I use 8 Mhz.
Also: try adding delays of 100 ms after each command


Eric

Post Reply