Debugging works but testing on eblocks doesnt

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
iman05
Posts: 7
Joined: Mon Feb 14, 2011 5:41 pm
Has thanked: 1 time
Contact:

Debugging works but testing on eblocks doesnt

Post by iman05 »

Hi guys,
i just wrote a simpel programm on flowcode V4 for the pic 16f88.
when i debugg the programm it works perfectly, but when i load it into the eblocks and i want it to test it there with the lcd and push buttons it gives no respons. I gave the screen and the buttons power and i switched the button on eblocks to kristal, so could please someone tell me why it doesnt want to work on eblocks?

greetings,
Attachments
GIPPPPPPPPPP.fcf
(16 KiB) Downloaded 255 times

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Debugging works but testing on eblocks doesnt

Post by JohnCrow »

Hi Iman

Think this statement is your problem

Acceleration = (Speed2-Speed1)/(Time1+Time2)

You have acceleration designated a float variable
You cannot do the math in this way, it has caught me out when using floats myself

look in the help file for full info, but this is the basic way to do it

define a couple of extra variables

speed3 = fsub(speed2,speed1)
time3 = fadd(time1, time2)

Acceleration = fdiv(speed3, time3)
Note commas between the variables not + or - signs

You have used float to string to print to the lcd which is the correct way.

All variables in a float calculation have to be floats, so you will need to change them to float

Also,changing these variables means you have to use the float math in the other parts of the program.

Done a quick mod to you code, but found it wont fit in a 16F88,as floats take up a lot more space. Ive tried it in a 16F877a seems to run the same on the hardware as in flowcode simulation.
GIPPPPPPPPPP-float.fcf
(17 KiB) Downloaded 251 times
One other thing you will find wont work on hardware is printing "m/s²"
You will have to look up the ascii code for the "²" and print it by using the print ascii statement. The table of printable symbols is on the lcd eblock data sheet.
Different LCDs may have a differnet code for some of the non alphabet type characters.

Good look with the project, let us know if it works
1 in 10 people understand binary, the other one doesn't !

iman05
Posts: 7
Joined: Mon Feb 14, 2011 5:41 pm
Has thanked: 1 time
Contact:

Re: Debugging works but testing on eblocks doesnt

Post by iman05 »

thnx, for your help, i did what you said buutt it didnt work maybe i did somerhing wrong

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 268
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: Debugging works but testing on eblocks doesnt

Post by Dan81 »

Hello Iman

what do you mean by "doesn't work'" ?

I think calculation Acceleration = (Speed2-Speed1)/(Time1+Time2) is wrong

Acceleration = (Speed2-Speed1)/(Time2-Time1) should be better.

If you want accuracy, timer interrupt and RB0 interrupt (or PortChange) are more adapted.

Daniel

Post Reply