Porgramming a decimal number For LCD Using flowcode V4.5

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
DannyBerry
Posts: 29
Joined: Tue Aug 30, 2011 9:20 pm
Has thanked: 11 times
Been thanked: 1 time

Porgramming a decimal number For LCD Using flowcode V4.5

Post by DannyBerry »

Can anybody show a way to put in a number with a decimal in it for a 16x2 LCD using flowcode? I know what the binary address is ..11100010....just don't know how to go about entering it into flowcode file.

Thanks,
Danny

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by Werner »

Hi Danny, I don’t know if this will help you but I just broke the number down and did two PrintString’s to the LCD for numbers each side to the decimal point. I did a third PrintString (“.”) write for the decimal point.
Have a great day!
Werner
Attachments
PrintString_382x600.jpg
PrintString_382x600.jpg (63.56 KiB) Viewed 15078 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

i was wondering that also, i have this huge fcf i've been working on the last couple days,--> in the main menu when you select dynamic by hitting the up button once, then the enter/exit button once, then scroll with up down to see numbers, ......you'll see i made it print number "variable pulsewidth", the number is in 100 u/s increments from 100u/s to 20m/s, so (3=point3m/s) (31=3.1m/s) (156=15.6m/s) and so on, i would like to use string manipulation to simply put a decimal before the last number in this menu selection only, so later i can use a print string to add text so it makes sense to other people that use this project or wants to build it, how ever i've never done a string manipulation prior .... to note this file takes minutes to open because of how many macros i used, how ever it does work good on hardware, thanks
Attachments
off time set part.fcf
fuel injector flowbench menu based
(219.59 KiB) Downloaded 409 times

DannyBerry
Posts: 29
Joined: Tue Aug 30, 2011 9:20 pm
Has thanked: 11 times
Been thanked: 1 time

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by DannyBerry »

Werner wrote:Hi Danny, I don’t know if this will help you but I just broke the number down and did two PrintString’s to the LCD for numbers each side to the decimal point. I did a third PrintString (“.”) write for the decimal point.
Have a great day!
Werner
That's what was needed...Thanks Werner :D

Have a great day also!

Danny

DannyBerry
Posts: 29
Joined: Tue Aug 30, 2011 9:20 pm
Has thanked: 11 times
Been thanked: 1 time

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by DannyBerry »

Hi Werner,

I can't make out what the 4th macro from the bottem says: PrintNumber(length..?..digit)

Also I think the first one at the top says: PrintASCII("AT:") is this correct...what I mean is It's hard to read..

Thanks,

Danny

DannyBerry
Posts: 29
Joined: Tue Aug 30, 2011 9:20 pm
Has thanked: 11 times
Been thanked: 1 time

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by DannyBerry »

OK Werner,

Here's my interpretation...Of what you show in the Jpeg...Now can you get it to count for me or make corrections to what I have.

I got it to simulate in flowcode showing 00.00 :D


Thanks,

Danny
Attachments
Number with decimal.fcf
(8 KiB) Downloaded 355 times

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by Werner »

DannyBerry wrote: I can't make out what the 4th macro from the bottem says: PrintNumber(length..?..digit)

Also I think the first one at the top says: PrintASCII("AT:")
It says "LCDDisplay(0)Printumber(TotalPc)" TotalPc in reference to one of my variables.

Yes Danny, you are correct. For my program I needed a reference as to where something was so i stated for example: "AT: 15.75" like 15 3/4" inch. If I get time I will have a look at your program tonight.
Have a great day!
Werner
Last edited by Werner on Sat Dec 10, 2011 2:23 am, edited 1 time in total.
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

what me and danny are trying to do is to put a decimal before the last number, like in file, but the number may be single, double, or tripple digit.... werner,im totally confused by your variables, could you modify the file below
Attachments
string manipulation question.fcf
(5.5 KiB) Downloaded 381 times

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by Werner »

Hi Brandon and Brother Danny, Sorry I confused you! :? I just grabbed a little code from a large program hoping to give you an idea. After looking at it I should have given you more sorry. I am sure one of my Buddy’s listed in my signature would have a much better way of doing it but this is the way I did it: :oops: Get keypad numbers than split the number into two variables, one for left side of decimal and one for right side of decimal. My trick was to put the decimal point in a fixed position on the LCE like 4,0. Then when you go to display to LCD using if statements. Please take a look at the program below and go to the Macro NumberCalc tab this is where the number manipulation takes place I think you will see what I did? Sorry I can’t better describe it Buddy!! This program is for an auto wire cutter. Basically you enter the number of pc you want than enter the length you would like the wire cut to. If you run the program you have to push the Blade up button in order for the program to continue. Input how many and length and hold the blade button down so the program will go. The program of course runs much faster on the pic so I would not enter a length number more than 10 pc and 01.00” or it will take too long to complete. :lol: You will be able to see how the program displays the decimal number. I hope this gives you some ideas Buddy! :roll:
Have a great day Buddy!
Werner
Attachments
work11.fcf
(81.86 KiB) Downloaded 427 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by Werner »

Ok Ok Ok I got it….. or should I say my Professor and John have it correct! Please take a look at: http://www.matrixmultimedia.com/mmforum ... 326#p20326it is exactly what you want and simply wonderful! You can do it easy using Left$ and Right$ to display. Thanks again to Martin and John!! That was easy!! :lol:
Your Friend,
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

nope totally confused still, the only way im gonna understand this is if someone modifys my "string manipulation help" file, reason why is because thats the only thing in the flowchart, i tried reverse engineering it but it left me scratching my head, thanks for trying to help me out on that

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by Werner »

Sorry Buddy, This may be the easyest way for you to get what you are looking for? The Flowcode file is just part of what I think you need but might give you an idea? I will PM you and I will try getting you there on the phone I am short on time tonight. :D
Have a great evening Buddy!
Werner
Attachments
string manipulation question2.fcf
(7 KiB) Downloaded 272 times
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

werner, that one is easy because your creating 2 variables and naming the outputs then deciding which line to put them on, in this case it would be simplier to just print string on it as it would work the same way, i gave a bad example file should have used this example
Attachments
should have used this one.fcf
my bad!
(6 KiB) Downloaded 223 times

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

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by medelec35 »

Hi Brandon,
Werner wrote: You can do it easy using Left$ and Right$ to display.
Werner was spot on!
You can use Left$ and Right$ to display!
I have modified your flowchart using Left$ and Right$ string manipulation.
Format is
Right$(String,number of chars)

E.g

Code: Select all

Decimal_Number = Right$(PulseWidthString, 1)
If PulseWidthString = "32" then the 1st char on the right is 2
so Decimal_Number = 2
Format is
Left$(String,number of chars)
If the above said

Code: Select all

Decimal_Number = Left$(PulseWidthString, 1)
If PulseWidthString = "32" then the 1st char on the left is 2
so Decimal_Number = 3

Martin
Attachments
should have used this one2.fcf
(9.5 KiB) Downloaded 248 times
Martin

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

thanks martin, i knew werner linked me the right deal but i couldnt get past the variables, thanks for fixing this file for me, but is there any way to do that so it doesnt erase the line

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

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by medelec35 »

Your welcome Brandon.
brandonb wrote: is there any way to do that so it doesnt erase the line
Do you mean like this?

Martin
Attachments
should have used this one3.fcf
(9 KiB) Downloaded 222 times
Martin

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by Werner »

Thanks Martin! Great examples! It always makes things much easier when you have a great example!
I think Brandon can run with this. :D
Have a great day Guys!
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

martin, i havent had time to study it yet but it works great in simulation although it doesnt compile, has string left error codes, below is the full project, some of the features dont work in simulation
Attachments
pic flow string.fcf
(229.5 KiB) Downloaded 257 times

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

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by medelec35 »

Hmm odd that Flowchart has accepted a integer argument rather than correct string argument in the string calculation box.
Still I have corrected flowchart, and should compile ok.

I will correct the your other flowchart soon when i get a chance.

Martin
Attachments
should have used this one3.fcf
(9 KiB) Downloaded 236 times
Martin

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

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by medelec35 »

I have corrected pic flow string.fcf so it compiles ok, and I have added a call to timer2 module at the bottom of main (needs removing before sending to chip!) since timer1 and timer2 do not simulate (thank goodness they all simulate in V5 :P )

So if you run your flowchart and make sure it works the way you have intended.

Anything that's not working, if you let me know I will see if I can correct it for you.

Or even better, burn to chip. nothing beats testing on hardware.

Martin
Attachments
pic flow string.fcf
(229.61 KiB) Downloaded 226 times
Martin

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times

Re: Porgramming a decimal number For LCD Using flowcode V4.5

Post by brandonb »

hey martin, your the man, that worked great, i cant thank you enough, you know im probably gonna have some questions on this flowcode for sure, you said
Hmm odd it flowchart accepted a integer argument rather than correct string argument in the string calculation box
this chip is weird, i ran into a couple problems also, i can't run lcd off d port,i cant have tmr0&tmr1 running together, but tmr0&tmr2 runs fine together, i also cant have a port interrupt and a int on pin interrupt at the same time, i understand how the int/port one could cause an issue because the pin B0 would share two different interrupts..... dont worry about changing the files, i modified the end of the file to eliminate a zero and added a string, this is a awsome project, and no way possible could i have done it with out you..... <<<i updated file 12/12/11>>>
Attachments
1939 flow extended.fcf
(226.48 KiB) Downloaded 271 times

Post Reply