??? 03/14/05 09:20 Read: times |
#89614 - OK, here it is! Responding to: ???'s previous message |
Mehdi said:
So,Come to help solving rahul's problem OK, this is what he say he needs to do: Rahul Sadagopan said:
my while(1) has all the characters that need to be printed ... i dont want charaters printing beyond the margin ... this sequence of printing and paper feeding has to be done infintely long.
http://www.8052.com/forum/read.phtml?id=88937 So he's doing the familiar printer self-test pattern: 0123456789abcdefghijklmnopqrstuvw xyzABCDEFGHIJKLMNOPQRSTUVWXYZ`!"£ $%^&*()_+=-[{]}#~'@;:/?.>,<|0123 456789abcdefghijklmnopqrstuvwxyzA BCDEFGHIJKLMNOPQRSTUVWXYZ`!"£$%^& etc, etc,...This can be very easily implemented in a perfectly straightforward loop with no need for any timers, unstructured jumps, or other kludges: character_to_print := first printable character -- Start with the 1st printable character in the printer's character set characters_printed := 0; -- We haven't printed anything yet! -- Infinite loop to continuously print all characters from the printer's character set, -- inserting line breaks where required repeat { print character_to_print; -- Count another character printed; -- Check if we now need to insert a line break increment characters_printed; if characters_printed >= max characters per line then { print newline; characters_printed := 0 -- Now back at the start of a line } -- Prepare to print the next character from the character set; -- If we've just done the last character, start again at the first increment character_to_print; if character_to_print > last printable character then { character_to_print := first printable character } } foreverThe above assumes a character printer, but exactly the same principle would apply if you're driving the dots directly - you just count columns instead of characters. instead of saying your idea is incorrect I didn't say it was incorrect; I said it was bad idea - especially when the aim can be achieved in such a simple & straightforward manner! |