Page 1 of 1

Debugging works but testing on eblocks doesnt

Posted: Tue May 03, 2011 5:42 pm
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,

Re: Debugging works but testing on eblocks doesnt

Posted: Tue May 03, 2011 8:19 pm
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 295 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

Re: Debugging works but testing on eblocks doesnt

Posted: Wed May 04, 2011 7:37 am
by iman05
thnx, for your help, i did what you said buutt it didnt work maybe i did somerhing wrong

Re: Debugging works but testing on eblocks doesnt

Posted: Wed May 04, 2011 9:20 am
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