How to split a value

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
dawladin
Posts: 13
Joined: Mon Feb 04, 2013 12:05 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

How to split a value

Post by dawladin »

Hello fellow flowcode users and mods :)

I got a program that i hope that someone would be able to assist me on. (I've attached it below)
Okay the program needs to split a var controlled by a button, this variable is called Knapsoap1 and needs to be split up into 2 variables Soapmin and Soapsek.
When Knapsoap1 =0-59, Soapmin = 0 and Soapsek = 0-59 and when Knapsoap1 = 60, Soapmin = 1 and Soapsek=0 and so on...
But as you can see in my program it becomes quiet huge after 180 so i was wondering if there was a smartere solution.

Thank you for reading this and I hope that you got an answer :)

Regards Michael
Attachments
Eksamensprojekt -test-Power Failure Atmega 8.fcf_avr
(21.37 KiB) Downloaded 253 times

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: How to split a value

Post by JonnyW »

Hello.

If you add to a calculation:

Code: Select all

Soapmin = Knapsoap1 / 60
Soapsek = Knapsoap1 - (Soapmin * 60)
This is probably the most efficient way you can do this on a PIC.

Cheers,

Jonny

dawladin
Posts: 13
Joined: Mon Feb 04, 2013 12:05 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to split a value

Post by dawladin »

Thanks Jonnyw :)

When i look at it I feel like i should have consindered looking into simple math so that i didn't have to truble you guys :S

So sorry for that Jonny and again thanks for the reply.

Regards Michael

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: How to split a value

Post by JonnyW »

Not a problem, thats what these forums are for!

Jonny

Post Reply