??? 01/10/05 12:41 Read: times |
#84644 - Display routine Responding to: ???'s previous message |
Amey said:
However,as I am new to 8051(learning for the first time),I would be oblidged to learn more about how to write the display routine. From the reaction of some forum members you can see that the solution must be really simple. And it is! For drawing lines on a scope providing 'x', 'y' and 'z' inputs you must have two DACs, one for producing control voltage for 'x' input and another for control voltage for 'y' input. And there must be a port pin, which controls 'z' input, which makes the beam to be switched-on or off. Sometimes you can neglect the 'z' input, if you draw the line to the starting point very fast, at least much faster than you draw the lines which are to be seen. From above you see, that speed of line drawing is one issue of the problem. To achieve that the line can be seen with good contrast you should draw it rather slowly, but fast enough, that you will not see any flickering resulting from too low actualization rate. Assume you have connected an 8bit DAC at port1 for 'x' input and an 8bit DAC at port2 for 'y' input. Further assume, that for both DACs #'00000000' output signal means -5V and #'11111111' means 5V. If you now want to draw a line from 'x' = 0V to 'x' = 1V, while 'y' is kept at 'y' = 0V, then you simply must output #'10000000' at port2, while you output all values between #'10000000' and #'10011001' at port1, one after the other. So, you actually draw points, not lines! After having drawn a point, wait a period of time, so that each point becomes bright enough. If you output all values between #'10000000' and #'10011001', one after other, each with the same duration, then you get a series of bright points smearing to a line. So, your display routine for drawing a line from point (0,0) to (1,0) can look like the following: Activate 'z', means 'turn-on beam' output #'10000000' at port2 output #'10000000' at port1 wait a period of time output #'10000001' at port1 wait a period of time output #'10000010' at port1 wait a period of time . . . . output #'10011001' at port1 wait a period of time deactivate 'z', means 'turn-off beam' Kai |