SHIFTOUT (not SEROUT) vs DEBUG (typo, sorry!)
xanatos
Posts: 1,120
I see that SEROUT SHIFTOUT is spec'd (for the BS2sx) at 42kb/sec, and DEBUG is 9600b/s. I'm not missing anything there, correct? SEROUT SHIFTOUT should, for a given character string, take about 22% of the time (or be ~ 4.3x faster than) the DEBUG statement. Yes? Any hidden timing overhead I'm not taking into account?
Thanks,
Dave
Thanks,
Dave
Comments
With SEROUT you have to specify the baudrate. It's not automatically 42 kBaud. Also, SEROUT to "pin" 16 does not automatically open the debug window the way DEBUG does.
-Phil
Dave
Thanks. I must have really just worded my whole question wrong! I was using debug to reflect data derived from a quadrature encoder setup. Using debug, the counter slipped counts if I spun the encoder wheel at much more than one or two revolutions per second. HOWEVER, the debug statement was only to display data at the development phase of the project. The actual data will be displayed on an MC14489 5-digit decoder/driver/multiplexer, which uses SHIFTOUT, so in my development, DEBUG and SHIFTOUT are indeed related :-) I have subsequently determined that the SHIFTOUT statement does allow a significantly faster turning of the wheel than the DEBUG statement allowed, and so my worries about maximum wheel speed have been laid to rest. With SHIFTOUT running now, I can get about 5 revolutions of the wheel per second before I get count slips, and that should be faster than it will ever see in normal use.
This would have been a lot smoother of a question if I had worded it better to begin with! :-) To those why tried to help, Thank You, and sorry for the poor wording. I think if I had described WHY I was comparing DEBUG and SHIFTOUT to begin with it would have been much better...
Dave
As a note I have some code that reads an encoder and updates a display as well. It was listed in the Solder Pot Controller Project, however to make up for some timing loss on the encoder I was using a BS2px24 Module.
Thanks. And I'm also using the BS2px with the pretty-much single line quadrature reading code that XORs the channels to increment or decrement as necessary. Very slick! This I believe was your line:
Can't get much more efficient than that! Thanks for putting that out there, it works fantastically well.
And just to put the DEBUG thing to rest once and for all, I was only using it to check my data in development... I program one task at a time, and often in development DEBUG is perfect to see if I'm getting the right numbers without adding a lot of other code and circuitry for display or other processing of my data. It's a rare program of mine when a DEBUG survives to the final product! :-)
Thanks again,
Best,
Dave
Thanks for sharing all the details of things. I bet others who read this will benefit from the knowledge and experience. As for the code, I believe I borrowed that 1-line code trick from Jeff Martin, but it was so long ago I don't remember the details. We all learn from someone. Take care!