Shop OBEX P1 Docs P2 Docs Learn Events
Modify serial data flow from PC to Printer — Parallax Forums

Modify serial data flow from PC to Printer

ArchiverArchiver Posts: 46,084
edited 2004-05-21 21:31 in General Discussion
Hi all, I need to interrupt the data sent from a PC to a printer by a
serial interface. there are certain characters when detected should
change to another character such as when ever a "Q" and "W" are
detected, the output will print a "2" and "3".
In other words: whenever the ASCII code for a Q and W is detected, it
will change them to the codes for the 2 and 3 and let the other codes
pass to the printer unchanged. I think it might take a long time to
check each character as it passes through the stamp but that would
not be a problem.
The number of lines sent to the printer is between 4 lines, if that
might help.

Keep up the good work....
Thanks very much,
Basil

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-05-21 21:31
    --- In basicstamps@yahoogroups.com, "basilmelbourne"
    <basilmelbourne@y...> wrote:
    > Hi all, I need to interrupt the data sent from a PC to a printer by
    a
    > serial interface. there are certain characters when detected should
    > change to another character such as when ever a "Q" and "W" are
    > detected, the output will print a "2" and "3".
    > In other words: whenever the ASCII code for a Q and W is detected,
    it
    > will change them to the codes for the 2 and 3 and let the other
    codes
    > pass to the printer unchanged. I think it might take a long time to
    > check each character as it passes through the stamp but that would
    > not be a problem.
    > The number of lines sent to the printer is between 4 lines, if
    that
    > might help.
    >
    > Keep up the good work....
    > Thanks very much,
    > Basil


    Basil,

    What you're asking to do is not too complicated but, you are
    correct to consider the speed issue. I've done it at 9600 baud with a
    BS2sx but was handling something like 20 bytes at a time.

    When you say 4 lines, do you mean 4 lines of 80 chars each? Also
    what speed are you trying to run at. Slower is better!

    The procedure is to grab a chunk of data and process each
    character but not waste too much time if the character is not
    required to change. Then spit the character out to the printer. The
    LOOKDOWN and LOOKUP commands can be helpful.

    Tom Sisk
Sign In or Register to comment.