Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/13/09 07:25
Read: times


 
#164544 - You would do banded output
Responding to: ???'s previous message
Richard Erlacher said:
I'd be interested in seeing how you'd present a line graph of, say, 1024 data points for each of 8 data sets using an 805x using only 8kB of presumably external read/write memory, then present the same data again in a pie chart or bar graph. I think the field could, and should, be narrowed somewhat.

That wouldn't be a problem. Note that I did write 4-8kB of RAM besides the measurements data. The figure was for bitmap memory.

With 1k horisontal resolution (8 inches wide paper and 120 DPI), and a 24-pin printer head, a single head pass would require 3k of RAM.

In this case, the printer has a 9-pin head. 48 bit * 120 DPI * 8" would require 5760 byte and allow for 5 head passes.

There really is no need to consider the total amount of data to store a full image. A dot-matrix printer only cares about row-by-row output. And even switching to a page printer makes no much difference - a laser printer would have enough memory to wait until the full graph has been generated and transmitted. An ink-jet printer may be problematic, because delays between multiple head passes may affect the print quality.

I did a lot of similar work once on a Z80 machine with 16kB RAM. The Z80 is a bit more general-purpose but a 8051 shouldn't have a problem either, as long as the OP has a very basic knowledge of computer graphics. No problem at all to produce full-page graphs.

But even when moving to the PC, early MS-DOS and Win 3.1 applications normally had to do banded output since the 640kB of RAM was to a large part crammed by the application(s), leaving a minimum of RAM for data.

Settling for a bar graph would make the task trivial, since no computer-graphics knowledge would be needed at all. But almost any form of graph can be generated with very little RAM and a minimum of compuations - most draw primitives would use integer DDA - Digital Differential Analyzer - i.e. all you need to do is to compute integer differences, make a comparison and decide to move horisontally or vertically for your next pixel. So you can to a large part avoid multiplications, divisions, or trigonometry. The algorithms can be googled for, so you don't even need to understand the math behind their operation. And any entry-level computer graphics book will contain the algorithms together with an explanation how they work.

In the end, I don't think you would bee too interested in seeing the code. This is just one more example of a problem that may sound hard until you know the solution. Then it suddenly becomes borderline trivial. The graphing primitives are quite small, but you would add a clipping layer where the code runs through all measurements data and only draws the part that is visible in a single band. After ejecting the band, you draw and emit the next band until the full graph has been printed. Then you finalize the output with a form feed.

Some clipping is best to do before/above the drawing primitives. Some clipping may be better done below the primitives. If you draw a perfect circle using DDA, you may decide to clip on-the-fly when drawing. If you draw a circle as a number of straight lines, then you can perform the clipping before drawing the line segments.

List of 19 messages in thread
TopicAuthorDate
How to print graphs on a printer at centronix port by 8051            01/01/70 00:00      
   Assume nothing!            01/01/70 00:00      
      Specifications donot provide protocols            01/01/70 00:00      
         So you need the technical specifications!            01/01/70 00:00      
            Its a low cost Standalone system            01/01/70 00:00      
               Google            01/01/70 00:00      
         the protocol            01/01/70 00:00      
            some links            01/01/70 00:00      
         The signaling protocol is well-defined            01/01/70 00:00      
            Actually quite simple to use a matrix printer.            01/01/70 00:00      
               Questions of definition            01/01/70 00:00      
                  A graph normally requires graphics            01/01/70 00:00      
                     Indeed, but one is a subset of the other.            01/01/70 00:00      
                        You would do banded output            01/01/70 00:00      
                           suppose the data is presented in portrait format ...            01/01/70 00:00      
                              Band size doesn't matter so much            01/01/70 00:00      
                                 It only feeds in portrait format            01/01/70 00:00      
                                    No            01/01/70 00:00      
                                       You're right within the scope of your thinking            01/01/70 00:00      

Back to Subject List