Little Bit stuck with my project

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
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Little Bit stuck with my project

Post by Jordy101091 »

Hi all,

I'm a little but stuck here,
Im being busy with aquarium controller and I have my DS1820 and keypad working correctly.
What I'm trying to do is to set the temperature trash hold of my ds1820 so it let me know when the temperature is to high.

I want to use my keypad for this, and i'm trying to let It work like so:

In the menu I have made these changeable variables:

TempL: >>>>> The lowest temperature that the water can reach
TempM: >>>>> The goal temperature
TempH: >>>>> The highest temperature that the water can reach

Now I want to enter with my keypad 3 digits So it will look like this:

TempL: 248 this represents 24,8 degree celsius

This value needs to be stored into the eeprom memory and after that it need to be send to the DS1820.

The problem I'm having is How do I convert thees 3 digits into one number so:

By typing 2, 4, 8 and do something magic and then this number 248 will be stored into the eeprom

I hope you can help me,

Regards Jordy
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Little Bit stuck with my project

Post by medelec35 »

Jordy101091 wrote: Now I want to enter with my keypad 3 digits So it will look like this:

TempL: 248 this represents 24,8 degree celsius

This value needs to be stored into the eeprom memory and after that it need to be send to the DS1820.

The problem I'm having is How do I convert thees 3 digits into one number so:

By typing 2, 4, 8 and do something magic and then this number 248 will be stored into the eeprom

I hope you can help me,

Regards Jordy
Hi Jordy,
Take a look here:
http://www.matrixmultimedia.com/mmforum ... 140#p17422

Martin
Martin

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: Little Bit stuck with my project

Post by Jordy101091 »

Thanks Martin,

Now It works but I have some trouble to get the following work:

Setting the temperature works great but I don't want to just put in 245 I want it to be like this 24,5*C
I have managed to get this to work in the flowcode simulator but on the hardware it doesn't work at all.

The cursor jumps immediately to position 9,1 before I entered the first 2 digits and also the display doesn't show any digits @ all.
Hope you can have a look into this and maybe find a problem.

Check you mail box :wink:

Regards Jordy Kleian
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Little Bit stuck with my project

Post by medelec35 »

I have altered your flowchart and returned it via PM, since you want it kept private.

Martin
Martin

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: Little Bit stuck with my project

Post by Jordy101091 »

Hi, Martin

The problem is still present, I have run the program in the simulator and it operating correctly.
But on the hardware, if I enter the first digit the cursor jumps immediately to position 9,1.

I dont know what the problem is, maybe you want to have a second look.

Thanks Jordy Kleian
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Little Bit stuck with my project

Post by medelec35 »

Hi Jordy,
Unfortunately I don't have the hardware required to run the code, So it's difficult.
I am going though your code at the moment.

From experience, the problem of simulation is different from running on your hardware is usually cause by variables not being initialised before being read.
If you read a variable 1st, then on real hardware a random number is assigned to it!
Whereas within Flowcode, all variables are initialised to 0 (I am going to make a suggestion about this).
Benj wrote:Rule of thumb to follow when working with variables on micros is:

Do I read the variable before I write to the variable?

If you do then you must initialise the variable.

So in your case try adding this to beginning of ds1820_set_temperature macro

Code: Select all

keypad_press = 0
Try going though the rest of your code, and if reading variable 1st, make sure it is initialised with a value like 0 first.

I'm not saying it will solve your problem, but until I have gone though the code, It's worth a try.

Martin
Martin

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: Little Bit stuck with my project

Post by Jordy101091 »

Thanks,

I just wanted to post a reply to says its all working fine, I dint read you comment @ all :lol:
But what you say is correct, I have just put a calculation block @ the begging of the DS1820_temp_set macro with the following calculation:

keypad_press = 0

and uploaded it again and it works just fine.

thanks again for you support

Regards Jordy
the will to learn, should not be stopped by any price

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Little Bit stuck with my project

Post by medelec35 »

Your welcome.

That's great!.
Glad It's working.
You had two issues rather than just the initialising.
So you would be best keeping the modifications I made for you.

Thanks for letting us know.

Martin
Martin

Post Reply