|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: printf() inside interrupt routine?
usbcd36 - I was debugging my driver and wanted to be able to see every byte printed out in the order it arrived. Eventually I discovered this was not possible to do because of how blazingly fast the camera sends tracking data.
So I am essentially doing what you suggest, storing the values and printing out a select few in the slow loop. Before today I was completely unaware of how processor intensive a printf statement is. I have a blinking LED that's supposed to blink every 250 loops in the fast loop (which is around 250ms) and it works. But when I have even ONE printf statement in the fast loop it slows down to around one blink per second. So ONE printf statement slowed the program down by about a factor of 4! The IFI people weren't kidding when they insctructed in the manual to use only short printf statements for debugging! Thanks, Nathan |
|
#2
|
||||
|
||||
|
Re: printf() inside interrupt routine?
If you reeeeealy need to do this, there any open source programs (google rs-232 monitor) that use the multiple serial ports on a PC to monitor a link. Most of them will log all the data coming and going to a text file.
HTH |
|
#3
|
||||
|
||||
|
Re: printf() inside interrupt routine?
Cool, thanks. I may look into that..
|
|
#4
|
||||
|
||||
|
Re: printf() inside interrupt routine?
Quote:
-Kevin |
|
#5
|
||||
|
||||
|
Re: printf() inside interrupt routine?
I thought that's what printf did?
|
|
#6
|
|||||
|
|||||
|
Re: printf() inside interrupt routine?
Printf converts the data you pass to it into a human-readable string format. For instance, the value 100 would be converted into the following three characters: '1' '0' '0'. What Kevin is suggesting is for you to simply send the byte values themselves out of the serial port. This can be done very quickly and won't impact the ISR very much. You can then read those values into the computer and view them at your leisure, or record them and process them with an additional application (which may be quite useful for what it seems you're trying to do).
|
|
#7
|
||||
|
||||
|
Re: printf() inside interrupt routine?
As Adam pointed out, and assuming you're using my serial port driver, it's as simple as this:
Code:
// first, find out how much data, if any, is present in
// serial port 1's received data queue?
byte_count = Serial_Port_One_Byte_Count();
// have we received any data?
if(byte_count > 0)
{
// we have fresh data, so read each received byte one at a time
for(j = 0; j < byte_count; j++)
{
// get the next data byte
data = Read_Serial_Port_One();
// send it out the other serial port
Write_Serial_Port_Two(data);
// work with camera data here
}
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Routine declaration syntax error (Or: Where's wlado?) | Astronouth7303 | Programming | 15 | 24-03-2004 05:51 |
| printf isn't printf-ing. Help! | Meandmyself | Programming | 14 | 15-02-2004 16:27 |
| Pre-Match/Post- Match Pit Routine | Mark_lyons | General Forum | 14 | 31-03-2002 15:19 |
| Master uP Initialization Routine | Ulibrium | Technical Discussion | 5 | 24-01-2002 16:43 |