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,
Debugging works but testing on eblocks doesnt
Moderator: Benj
Debugging works but testing on eblocks doesnt
- Attachments
-
- GIPPPPPPPPPP.fcf
- (16 KiB) Downloaded 255 times
- JohnCrow
- 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
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.
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
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.
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 !
Re: Debugging works but testing on eblocks doesnt
thnx, for your help, i did what you said buutt it didnt work maybe i did somerhing wrong
- Dan81
- 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
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
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