Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   printf causes programs to not run (http://www.chiefdelphi.com/forums/showthread.php?t=61837)

jasonpeinko 16-01-2008 18:26

printf causes programs to not run
 
I was trying to setup a printf command in user routines fast, but when i upload it to the robot it gets stuck in program mode,

I used Jifi to upload it,

i also use mplab running under wine to compile.

psy_wombats 16-01-2008 18:54

Re: printf causes programs to not run
 
The fast loop, I believe, can't support the printf function, simply because it is a very fast loop. The printf takes a lot of time (relaying info through your serial) so the print is being called way too fast for it to finish, and causes the program error.

Should be able to fix by calling only by a timer interrupt, or when a loop count is divisible by fifty, (to call every fiftieth loop or something), or maybe use the slow loop?

kaszeta 16-01-2008 19:02

Re: printf causes programs to not run
 
Quote:

Originally Posted by psy_wombats (Post 679539)
The fast loop, I believe, can't support the printf function, simply because it is a very fast loop. The printf takes a lot of time (relaying info through your serial) so the print is being called way too fast for it to finish, and causes the program error.

I've done this successfully (when debugging shaft encoders), but wouldn't recommend it. It's very easy to crash things this way.

Quote:

Should be able to fix by calling only by a timer interrupt, or when a loop count is divisible by fifty, (to call every fiftieth loop or something), or maybe use the slow loop?
This is of course a much better solution.

gizzlyMIKE000 16-01-2008 19:03

Re: printf causes programs to not run
 
how do i post a forum?

TubaMorg 16-01-2008 19:13

Re: printf causes programs to not run
 
Quote:

Originally Posted by gizzlyMIKE000 (Post 679545)
how do i post a forum?

Do you mean how do you post a reply? Well you just did, obviously. If you mean that you would like to start a new thread, then look for the appropriate topic and look for "start a new thread"

jasonpeinko 17-01-2008 17:40

Re: printf causes programs to not run
 
i am confused on how to get this to work,

i have to it only is supost to show every 1000000 times the code runs.

jasonpeinko 17-01-2008 18:54

Re: printf causes programs to not run
 
tomorrow i will try using the default prgoram with the controller to see if it work with printf, could the problem be that my computer is not being able to handle the printf when it recieves it back?


All times are GMT -5. The time now is 13:45.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi