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
How to split a value
Moderator: Benj
-
- Posts: 13
- Joined: Mon Feb 04, 2013 12:05 pm
- Has thanked: 4 times
- Been thanked: 1 time
- Contact:
How to split a value
- Attachments
-
- Eksamensprojekt -test-Power Failure Atmega 8.fcf_avr
- (21.37 KiB) Downloaded 253 times
- 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
Hello.
If you add to a calculation:
This is probably the most efficient way you can do this on a PIC.
Cheers,
Jonny
If you add to a calculation:
Code: Select all
Soapmin = Knapsoap1 / 60
Soapsek = Knapsoap1 - (Soapmin * 60)
Cheers,
Jonny
-
- 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
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
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