The text of a manual · part 9 of 15
PcOS Series 60 Multi-Station Slip Printers Programmer's Guide, pages 81 to 90
Pages 81 to 90 of 150
The original document is the PDF (1.6 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Ithaca PcOS Series 60
Page 81
Communications
PcOS Series 60
Parallel Port
Programmer's Guide
Ithaca Peripherals Incorporated
Parallel Port Parallel Port Protocol The Model 60 parallel port behaves just like any printer connected to a PC. The parallel interface accepts 8 bits of data from the host. The "STROBE" signal from the host is used to indicate that data is available. When the printer sees the "STROBE" and has accepted the data it asserts "BUSY". The "BUSY" signal indicates to the host that the printer has accepted the data and is busy working on the data. When the printer has been able to absorb the data and is ready to accept another byte, the printer asserts "ACK" (Acknowledge) and negates "BUSY" and then finally negates "ACK". The following parallel port specifications and timing should be met by the host computer. In standard PC's the strobe signal is generated by software writes to the parallel port control port. This is typically done in the BIOS or in some parallel port driver. As PC get faster and faster it is up to the software to assure that the "STROBE" signal does not get too narrow. 1 uS is about the minimum pulse width that should be sent down a cable. Shorter pulse widths (500nS) will be accepted by the printer, however the cable can introduce significant signal degeneration and skew. It is very important that the Data be valid before strobe is asserted and remain valid until after the strobe is removed. A 500 nS. setup and hold time is required by the printer. The following chart illustrates this sequence:
INIT
< ---- Rdly
Pin 16
Data
DATA Pin 2-9
Dstu--->
STROBE Pin 1
< >
>
BUSY
Data <-- Dhld
<--Tstb
Sdly -----> Bhld--->
< <
Pin 11
ACK Ahld ---->
Pin 10
<
Rdly Approx. 4 Sec. Dstu 500 nS (Min)
Bhld Approx. 5 uS
Dhld 500 nS (Min)
Ahld Approx. 5 uS
Tstb 1 uS (Min)
Sdly 3 uS (Min)
Parallel Port Data Timing
To implement flow control the "BUSY" signal is asserted by the printer outside the normal data transfer sequence. The BUSY signal has several uses but it always indicates that the printer can not accept information. The BUSY signal may happen at any time and may not adhere to the above timing chart in all cases. It is up to the host's parallel port driver to handle all possible BUSY states. It is important that the host driver does not hang-up if it takes some time for an ACK (Acknowledge) response to a "STROBE". The standard PC parallel port hardware implements an Interrupt on ACK signal to make this task easier.
Parallel Port Inquire All ENQ commands require some type of response from the printer. The serial port is bi-directional, the parallel port is not. For this reason the parallel and serial operation of ENQ commands are different. In serial operation all ENQ commands are responded to by ACK or NAK and then the command ID on the return link. In parallel operation there is no easy way to return complex information to the host. For this reason the PE (Paper Error) signal is driven in response to ENQ's. If a true PE is being signaled the ERR line will also be driven. It is, therefore, possible to distinguish between a paper error and an ENQ response. In parallel mode the printer will respond to the ENQ before the parallel port sequence is complete. When the parallel port acknowledges the ID portion of the ENQ sequence, the PE signal will be valid. The host must, however, remember what
Page 80
Rev C 7/8/2008
Page 82
Programmer's Guide
PcOS Series 60
Communications
Ithaca Peripherals Incorporated
Parallel Port status was requested as the printer has no way of signaling that information. In addition, the host must not interpret the PE signal as an error but as a response to an ENQ. The PE signal will remain valid until the next ENQ is issued or until a true paper exhaust is found. A true paper exhaust will only be reported after a line feed and will also drive the fault signal. If the PE signal is to be returned to the valid paper error state, an [ENQ] <4> can be issued. PE DATA
Valid ID
Next
STROBE BUSY ACK
PE to ENQRequest Timing There is an important performance effect on the printer of ENQ commands. The priority of communications in the printer is very high. ENQ commands are processed at the high priority of the input ISR24. The priority of the communications is the second highest, the highest is a motor control timer. It is possible in parallel mode for the host computer to send ENQ commands so fast that the printer does not have any time for printing (or do anything else). ENQ commands must be paced to allow the printer time to get to its idle task. The pacing of ENQ's should average no more than 100 per second.
Parallel Port [ESC] Q . The parallel port is difficult to operate in a bi-directional mode. The [ESC] Q command requires that a response be returned to the host when the command is complete. To do this a busy/acknowledge sequence was chosen. This was done because it gives two ways for a programmer to deal with the response. 1) The [ESC} Q command can be sent to the printer and it's acknowledge waited for in a polling loop. This procedure is simple and relatively easy to implement. It however, suffers from a performance problem because the PC must be dedicated to looking for the response. 2) The [ESC} Q command can be sent to the printer and it's acknowledge picked up by a interrupt from the ACK parallel port interrupt. This procedure is more complicated that polling. However, it allows an interrupt service routine to handle the responses. Please note that some PC's share this interrupt with the CRT (EGA Displays). ESC Preceeded Q
DATA
Data
Data Next
Q Wait
STROBE for [ESC] Q Command
BUSY ACK
The above timing diagram is the relative timing of the and parallel port [ESC]Q response. For applications that do not have control over the parallel port, the [ESC]q and [ENQ] commands may be easier to implement.
24ISR - Interrupt Service Routine.
Rev C 7/8/2008
Page 81
Page 83
Communications
PcOS Series 60
Parallel Port
Ithaca Peripherals Incorporated
Programmer's Guide
Parallel Port Connector The INIT\ (Initialize) printer input acts as a hardware reset to the printer. This signal must be inactive (high) for about 4 seconds before the printer will respond to information input. The PE signal is asserted by the printer whenever the journal paper is exhausted and an attempt is made to print on the journal. The PE signal is also asserted in response to [ENQ] commands. If the printer does not have a journal this signal is only used for [ENQ] commands. The ERR\ signal is asserted if a head jam occurs or if the PE signal is asserted for a true paper error. NOTE: The "AUTOFD" (Auto feed Pin 14) and "SLIN" (Select input Pin 17) signals are not used by the series 60 printers. Pin 1
STROBE
Clock Data to printer
Host to Printer
Pin 2-9
D0 - D7
Data
Host to Printer
Pin 10
ACK\
Printer Accepted Data
Printer to Host
Pin 11
BUSY
Printer is Busy
Printer to Host
Pin 12
PE
Paper Out / Status
Printer to Host
Pin 13
SLCT
Printer Selected
Printer to Host
Pin 14
AUTOFD
Auto feed paper
Host to Printer
Pin 15
ERR\
Printer Error
Printer to Host
Pin 16
INIT\
Initialize the Printer
Host to Printer
Pin 17
SLIN
Select Printer
Host to Printer
Pin 18-25
GND
Ground Parallel Port Pin-outs
Page 82
Rev C 7/8/2008
Page 84
Programmer's Guide
PcOS Series 60
Ithaca Peripherals Incorporated
Communications Serial Port
Serial Port Serial Port Features The serial port features are as follows: Baud Rates Bit Patterns Flow Control
300, 600, 1200, 2400, 4800, 9600, 19.2K 8 Bit No Parity, 8 Bit Odd, 8 Bit Even, 7 Bit No Parity, 7 Bit Odd, 7 Bit Even DRT and XON/XOFF
It should be noted that the 7 bit no parity is in fact an 8 bit format. The implementation of the hardware UART in the Intel 8051 family will not implement a true 7 bit no parity format. If the host provides a true 7 bit no parity format, it must be configured with 2 stop bits.
Serial Port Pin-out Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 Pin 9
DCD RX TX DTR GND DSR RTS CTS SSD
Data Carrier Detect Receive Data Transmit Data Data Terminal Ready Signal Ground Data Set Ready Request To Send Clear To Send Secondary Data
Because both the host and the printer are DTE's (Data Terminal Equipment) they use the same serial port pin-outs. If the cable that is used to connect the host to the printer is a pin-to-pin interconnect it will not work. For this reason a null modem or turn-around cable must be used to interconnect the host and the rinter.
Rev C 7/8/2008
Page 85
Communications
PcOS Series 60
Serial Port
Ithaca Peripherals Incorporated
Programmer's Guide
Serial Port Protocol The serial Port supports two flow control standards, XON/XOFF and Ready/Busy (sometimes called DTR or hardware handshake.) The Ready/Busy protocol uses the DTR (Data Terminal Ready) signal to indicate to the host computer that the printer is not ready to accept data. The host should stop sending data to the printer as soon as possible. Because the host may not notice the DTR signal until it has transmitted several bytes of data to the printer, the printer will continue to except up to 19825 bytes of data after it indicates that it is not ready. The figure below illustrates how the Ready / Busy protocol works.
Serial Port Flow Control Using DTR Communications Port
Serial Data In Serial Data Out
Data Inquire Responce
(Not Used For Flow Control)
Data Buffer Getting Full
Clear
DTR
First out Buffer
Data
2K
DTR Set
First In
Printer Control Software
Buffer Getting Empty Select Key
RTS
RTS -> Request To Send DTR -> Data Terminal Ready The following flow chart illustrates the communications driver getting data from the serial port and placing the data in the buffer using DTR or XON/XOFF flow control.
At the top of the flow diagram the driver is waiting for data. When data is received from the host it is checked to see if it is an ENQ command. If the data is an ENQ it is responded to and placed in the buffer. If not the data is placed in the FIFO. The FIFO is then checked to see if it is full before the internal pointer is incremented. If it is not full the pointer is incremented in preparation for the next data byte. The FIFO is then checked to see if it is getting full by checking the amount of information in the buffer to see if it has passed a high water mark. If it has the communications driver is notified and it will reset DTR indicating to the host that no more data should be sent.
Serial Port Flow Control Communications XON/XOFF Control Port
Serial Data In
Data
Serial Data Out
Send XOFF
DTR RTS (Not Used For Flow Control)
Buffer Getting Full
First In First out Buffer 2K
Send XON
Buffer Getting Empty
Send
Select Key
XON or XOFF
RTS -> Request To Send DTR -> Data Terminal Ready
25The buffer is really 2200 bytes long with a 200 byte pad.
Page 84
Data
Inquire Commands
Rev C 7/8/2008
Data
Printer Control Software
Page 86
Programmer's Guide
PcOS Series 60
Ithaca Peripherals Incorporated
Communications Serial Port
The following flow diagram illustrates how the print controller takes information from the FIFO. At the top of the chart the print control software asks for data. If there is no data in the buffer a "no data flag" is returned. The print software must then wait for data. If there is data in the FIFO it is read from the FIFO and pointers are updated. The FIFO is then checked to see how much information is left in the buffer. If the buffer is below a low water mark (about 100 bytes left) communications driver is notified and DTR is re-asserted. If XON/XOFF flow control is being used the flow is very similar to DTR flow except that DTR is not used and XON and XOFF control characters are transmitted back to the host on the serial link. XON/XOFF has an advantage in that only three wires are required to interconnect to a printer. The disadvantage is that a serial port receiver driver must be written for the host.
Wait for data from the host
Is this an ENQ Request?
Yes
Obtain ENQ Status from print controller Place ENQ Responce in transmit que.
No
Place Data in FIFO Buffer
Optional path if ENS's are being stripped. Yes
Is FIFO Full?
Update FIFO pointers
Is FIFO past the High water mark?
Yes
Clear the DTR Signal or transmit XOFF
No DTR - Data Terminal Ready
Rev C 7/8/2008
Page 87
Communications Serial Port
PcOS Series 60
Ithaca Peripherals Incorporated
Programmer's Guide
The following flow diagram illustrates how the print control software takes data from the FIFO and controls flow control. The print controller is always looking for data if the printer is "ON-LINE" and not printing. It continuously asks the FIFO if it has any data. If there is no data in the FIFO it does some housekeeping like keyboard scanning, etc. If there is data, it processes it. The flow control is done when the data is taken from the FIFO and the amount of data in the FIFO is less than a prescribed amount. This low water mark is set based on the expected environment. The series 60 printer sets this at 200 characters. This gives the host application time to get more data to the printer before the printer uses up what it has. When XON/XOFF protocol is implemented, it is possible for the host to miss an XON or an XOFF. To prevent this from causing a communications lockup, the printer will send an XOFF for every character received after the high water mark is reached. Whenever the printer detects that the serial data link is inactive it will send out an XON. This results in an XON being sent out about every 2 Seconds. When the printer is selected or de-selected (with the "SELECT" key), an XON or XOFF will also be sent. This happens even if the internal data buffer is past the high water mark26. This is done to allow the host to know that the "SELECT" key has been pressed. If the buffer is full and an XON is sent the next character sent by the host will cause an XOFF to be sent. The data that was sent by the host will not be lost unless the 200 character pad buffer is used up.
The Print controller needs data to print or a command to decode.
Is there any data in the FIFO?
Loop through idle task and then look for more data.
No
Return to print controller with no data available.
Yes
Set DTR or Transmit XON
Get Data from FIFO
Move FIFO pointers to the next data byte.
Is the FIFO below the Low Water mark?
No
Return Data to print controller.
DTR Data Treminal Ready
Print Controller using data
26If the host sends more information it will be responded to by an XOFF.
mode too many times it is possible for the buffer to overflow
Page 86
Rev C 7/8/2008
If the printer is selected and de-selected in this
Page 88
Programmer's Guide
PcOS Series 60
Ithaca Peripherals Incorporated
Communications Serial Port
Serial Port [ESC] Q The Serial port handles [ESC] Q responses by transmitting an [ETX] (03H or <3>). The following flow chart illustrates this sequence: Hose Sends an [ESC]Q to the printer. Printer Receives the [ESC]Q and places in in the input buffer.
Printer process previous commands.
Host Continues to prepair for the next command.
The [ESC]Q command is on the output of the input buffer.
Has the printer completed the previous command?
No
Yes
Send an [ETX] to the Host Host Receives the [ETX]
Remove [ESC]Q command from QUE
Rev C 7/8/2008
Page 89
Communications Serial Port
PcOS Series 60
Ithaca Peripherals Incorporated
Programmer's Guide
Serial Port Inquire The serial port inquire is more straight forward than parallel mode. The serial ACK or NAK responses follow a uniform format, the ACK or NAK is always followed by the command ID that requested it. This makes the design of the host application easier because the response can be identified and always follows the same format. In serial mode the Series 60 printer will always accept data. This is true even if the DTR signal is invalid for "buffer full" or for "off-line" It is, therefore, possible for the printer to respond to ENQ commands if the printer is offline or if the printers buffer is full. (NOTE: ENQ commands go into the print buffer, this prevents an ENQ that is part of graphics from being lost. This could cause a true buffer overflow. When this happens unexpected results can occur. The [ESC]y command can be used to prevent ENQ commands from go into the buffer. The following is an example of a Host/Printer inquiry response exchange The Host sends an [ENQ]<5> (Front slip sensor status) to the printer. The printer responds with an [ACK}<5> indicating that the request was 5 and the status is TRUE (no slip in position).
Host Sends an [ENQ]<5> to the printer asking for front sensor status.
Host Receives the Responce and decodes it.
Host Then sends an [ENQ]<6> asking for the rear sensor status.
The Host then sends an [ENQ]<6> (Rear sensor status) to the printer. The printer responds with [NAK] <6> indicating that the request being responded to is 6 and is FALSE (Paper is present). An effect on the printer by ENQ commands is performance. The priority of communications in the Host printer is very high. ENQ commands are processed at the receives the 27 responce and high priority of the input ISR . It is possible at 19200 decodes it. baud for the host computer to send ENQ commands so fast that the printer does not have any time for printing (or do any thing else). ENQ commands must be paced to allow the printer time to get to its idle task.
Printer Receives the request and preprocesses it. Printer Responds with an [ACK]<5> indicating that the front sensor is not covered.
Printer Receives the request and preprocess it.
Printer Responds with a [NAK]<6> indicating that the front sensor is covered.
In serial mode it is very IMPORTANT that the response to an ENQ be received by the host before another command is issued to the printer. When an ENQ is received by the printer, the printer may do some complicated processing at a very high priority. During this time the printer disables it’s interrupts. This means that any data sent to the printer during this time may be lost.
27ISR - Interrupt Service Routine.
Page 88
Rev C 7/8/2008
Page 90
CFG60 Users Guide
PcOS Series 60
Ithaca Peripherals Incorporated
Overview
Remote Printer Reset Reset in Serial Mode It is possible to generate a printer reset in serial mode. The <ENQ]<10> command will request that the printer reset (This is not a hardware reset). It will, however, completely initialize the hardware and software but will not recover from a loss of software control. The command flow is as follows: 1.
The [ENQ]<10> will be acknowledged and then the software will reset.
2.
The Printer will be placed off-line.
3.
The hardware and software will be reinitialized.
4.
The printer will then go back on-line. Any information sent to the printer while it is off-line will be lost.
Reset in Parallel Mode In parallel mode driving the INIT signal on the parallel port for 100 nS will generate a hardware reset. As long as the INIT signal is low the printer will remain reset. It will take about 2 seconds for the printer to recover from a reset.
Power Cycle Recovery There are times when the host needs to know if the printer was power cycled. An example would be changing the receipt tape. It is not necessary to turn the printer off to change the receipt. However, if the operator does, any information sent to the printer before the power cycle will be lost. The Series 60 printer has a flag that is set after a reset. This flag stays set until it is requested by the host at which time it will be reset. The [ENQ]<11> command reads this flag. If this command returns [ACK], the power has been cycled and all unprinted information has been lost. If the print operation is critical, it is a good idea to check this flag before and after all transactions. An alternate approach is to check the flag after every off-line to on-line transition.
Rev C 7/8/2008
Page lxxxix