spolsky-joel@CS.Yale.EDU (Joel Spolsky) (03/29/90)
Hi yall, a quick question; we've got this HP Plotter attached to COM1 (over RS232) and I have tried to program it with plotter = fopen("COM1"); fprintf (plotter, "..."); but every once in a while some buffer overflows and I get nasty DOS "Write error on COM1, Abort Retry Ignore Fail" messages scribbled all over my otherwise extremely beautiful VGA graphic screen. What am I doing wrong? Do I have to write my own routines to write one character at a time to the UART and check when it is ready for another? will this solve my problem at all? or is there an easier way? Many thanks, +----------------+----------------------------------------------------------+ | Joel Spolsky | bitnet: spolsky@yalecs.bitnet uucp: ...!yale!spolsky | | | internet: spolsky@cs.yale.edu voicenet: 203-436-1538 | +----------------+----------------------------------------------------------+ #include <disclaimer.h>
jdudeck@polyslo.CalPoly.EDU (John R. Dudeck) (03/30/90)
In article <20621@cs.yale.edu> spolsky-joel@CS.Yale.EDU (Joel Spolsky) writes: >Hi yall, a quick question; we've got this HP Plotter attached to COM1 >(over RS232) and I have tried to program it with > > plotter = fopen("COM1"); > fprintf (plotter, "..."); > >but every once in a while some buffer overflows and I get nasty DOS >"Write error on COM1, Abort Retry Ignore Fail" messages scribbled all >over my otherwise extremely beautiful VGA graphic screen. > >What am I doing wrong? Do I have to write my own routines to write one >character at a time to the UART and check when it is ready for >another? will this solve my problem at all? or is there an easier way? I don't have a plotter around to verify this, but I would bet that the plotter has a buffer that is getting overrun, and it is trying to do flow control, which the PC is getting upset about. It sounds to me that the flow control is working, but the PC is timing out because of the slowness of the plotter. This can by fixed by the proper parameters to the MODE command. In my DOS 4.01 manual it says that to error is the default, but you can do MODE COM1:96,N,8,1,B or MODE COM1:96,N,8,1,p for older DOS versions. (You should use the appropriate parameters for your plotter). The B or p makes it retry instead of timing out. Another possible thing to look for is an improperly connected cable. There is probably one line being used for flow control. Typically it comes out of pin 20 on a 25-pin connector on the plotter, and goes into pin 5 on the PC side on a 25-pin connector. If the plotter doesn't support hardware flow control, then it most likely uses X-on-X-off flow control. The PC doesn't have built-in support for this, but you can easily add it with an X-on-X-off driver from SIMTEL. -- John Dudeck "You want to read the code closely..." jdudeck@Polyslo.CalPoly.Edu -- C. Staley, in OS course, teaching ESL: 62013975 Tel: 805-545-9549 Tanenbaum's MINIX operating system.