Summary of the invention
Realization POS machine parallel interface data of the present invention receives the device and the using method of also output print, so its purpose provides a kind of device and using method that can reconfigure, realize printing parallel port Data Receiving, processing and the output of highly compatible according to POS machine and type of printer overcoming the problems referred to above and deficiency.
Realization POS machine parallel interface data of the present invention receives the also device of output print, is directly to connect an independent device between the parallel port of existing POS machine and printer.The data interface module of described device meets the IEEE1284 standard, to realize the immediate data transmission between POS machine and the printer parallel port., after input print command of POS machine parallel port and data, after the processing of described device, be sent to and carry out print command and output data in the printer by the input interface of described device.
The principle of work of described device is:
Parallel port input circuit module in the hardware layer, parallel port output circuit module are set up the physical connection with POS machine and printer parallel port respectively, with parallel port input interface, the parallel port output interface of setting up print command and data.
Input in the operating system layer/go out driver module realizes data call and transmission between hardware layer and application layer.
Print command in the application layer and data input processing module, by operating system layer data are called in to processing module from the parallel port input interface and to finish corresponding operating, export printer to through the parallel port output interface and carry out print command through printing the instruction and data output processing module then.
Described device, its parallel port input interface and parallel port output interface are based on the port of IEEE1284 standard, and the data-transmission mode of existing compatible IEEE1284 standard generally includes Compatibility, Nibble, Byte, EPP, ecp mode.
Use described device, according to the POS machine that is connected and the data-transmission mode of printer, print command in the application layer of described device and data input processing module can be provided with and upgrade, thereby finish the equipment disposition of described device, make the mode of operation of parallel port input driver module and parallel port output driver module keep consistent with POS machine and printer.Even variation has taken place in POS machine that is connected and type of printer, still can realize upgrading by the configuration flow of described device, thereby under the prerequisite that does not change the hardware and software driver, realize compatibility, to reach the purpose of between plurality of data transmission modes, switching.
Realization POS machine parallel interface data of the present invention receives the also device of output print, and its hardware includes:
CPU (central processing unit) connects and monitoring parallel port input block, data storage cell and parallel port output unit by address/data bus.
Described data storage cell embeds print data memory block and pattern configurations memory block in the operating system district.By print command in the above-described application layer and data input processing module, be provided with and upgrade according to printer and POS machine data transmission mode, thereby set up the pattern configurations interface and realize data transmission under the corresponding modes.
Realization POS machine parallel interface data of the present invention receives the also device of output print, and its using method is:
Described device is connected respectively on the parallel port of POS machine and printer;
Check BIOS in POS machine and the printer parallel port mode of operation in being provided with, this pattern is write in the pattern configurations memory block in the data storage cell;
When described device started operation, os starting was promptly from pattern configurations memory block read mode state, and write the pattern configurations interface of parallel port output unit and parallel port input block respectively according to this pattern;
Parallel port input block and parallel port output unit carry out work by the pattern that configuration interface writes automatically, read print command and the data that the POS machine sends from the parallel port input block, carry out print command through exporting printer after the data processing again to;
Data-transmission mode as POS machine and printer changes, parallel port mode of operation in then being provided with according to BIOS is directly changed the configuration file in the pattern configurations memory block, to keep parallel port input driver module and the mode of operation of parallel port output driver module and consistent the getting final product of pattern of POS machine and printer;
Repeat the execution of setting, change and the print command of above-mentioned configuration file.
As the described using method of above-mentioned content, can be connected the POS machine and the printer of multiple transmission mode based on the parallel port input block of IEEE1284 standard and parallel port output unit, can realize the compatible of all parallel port transmission modes and adapt to by the configuration file in the data storage cell again.
Further design proposal, behind the configuration mode in the setting data storage unit, the workflow that described device starts operation is:
System start-up is promptly from pattern configurations memory block read mode state, and writes the pattern configurations interface of parallel port output unit and parallel port input block respectively according to this pattern;
Parallel port input block and parallel port output unit carry out work by the pattern that configuration interface writes automatically;
Application program drives by the parallel port input and reads in print command and the data that receive from the parallel port input block, and deposits the print data memory block of data storage cell in;
Data processing module in the application program is handled the data in the print data district;
Application program drives by parallel port output and the parallel port output unit sends to printer with print command and the data that dispose.
In sum, using the described realization POS machine parallel interface data reception and the device of output print and the advantage and the beneficial effect of using method is:
1, by upgrading, revises the read mode state in the described pattern configurations memory block, can after the system start-up operation, determine required configuration interface voluntarily, thereby compatible, adaptation multiple POS machine and printer based on the IEEE1284 standard, both improve work efficiency, increased configurability again.
2, described apparatus and method, need not to transplant other types POS machine system and needn't recompile, save resource and time.
3, described apparatus and method need not to change the parallel port driver, thus the system update time short, need not to change and test, work efficiency is higher.
Embodiment
Embodiment 1, and as shown in Figure 1, realization POS machine parallel interface data of the present invention receives the also device of output print, is directly to connect an independent device between the parallel port of existing POS machine and printer.
The data interface module of described device meets the IEEE1284 standard, to realize the immediate data transmission between POS machine and the printer parallel port.
The primary structure of described device comprises:
Hardware layer, the parallel port input circuit module in the hardware layer, parallel port output circuit module are set up the physical connection with POS machine and printer parallel port respectively, with parallel port input interface, the parallel port output interface of setting up print command and data.
Operating system layer, the input in the operating system layer/go out driver module realizes data call and transmission between hardware layer and application layer.
Application layer, print command in the application layer and data input processing module, by operating system layer data are called in to processing module from the parallel port input interface and to finish corresponding operating, export printer to through the parallel port output interface and carry out print command through printing the instruction and data output processing module then.
Described device, its parallel port input interface and parallel port output interface are based on the port of IEEE1284 standard, and the data-transmission mode of existing compatible IEEE1284 standard generally includes Compatibility, Nibble, Byte, EPP, ecp mode.
As shown in Figure 2, described realization POS machine parallel interface data receives the also device of output print, and its hardware configuration mainly includes:
CPU (central processing unit) connects and monitoring parallel port input block, data storage cell and parallel port output unit by address/data bus.
Data storage cell embeds print data memory block and pattern configurations memory block in its operating system district.By print command in the above-described application layer and data input processing module, be provided with and upgrade according to printer and POS machine data transmission mode, thereby set up the pattern configurations interface and realize data transmission under the corresponding modes.
In conjunction with Fig. 1 and Fig. 2, described realization POS machine parallel interface data receives also, and the using method of the device of output print is, according to the POS machine that is connected and the data-transmission mode of printer, print command in the application layer of described device and data input processing module are provided with and upgrade, thereby finish the equipment disposition of described device, make the mode of operation of parallel port input driver module and parallel port output driver module keep consistent with POS machine and printer.
The using method of described device, its flow process is:
Described device is connected respectively on the parallel port of POS machine and printer;
Check BIOS in POS machine and the printer parallel port mode of operation in being provided with, this pattern is write in the pattern configurations memory block in the data storage cell;
When described device started operation, os starting was promptly from pattern configurations memory block read mode state, and write the pattern configurations interface of parallel port output unit and parallel port input block respectively according to this pattern;
Parallel port input block and parallel port output unit carry out work by the pattern that configuration interface writes automatically, read print command and the data that the POS machine sends from the parallel port input block, carry out print command through exporting printer after the data processing again to;
Data-transmission mode as POS machine and printer changes, parallel port mode of operation in then being provided with according to BIOS is directly changed the configuration file in the pattern configurations memory block, to keep parallel port input driver module and the mode of operation of parallel port output driver module and consistent the getting final product of pattern of POS machine and printer;
Repeat the execution of setting, change and the print command of above-mentioned configuration file.
As shown in Figure 3, using said apparatus and method carries out the flow process that is provided with of load module and is:
1, opens the POS machine, enter CMOS the interface is set, check the mode of operation of parallel port among its SuperIO.Be generally SPP, EPP or ecp mode, it is SPP that present embodiment is set its mode of operation.
2, write the configuration file (lpmode.txt) of the mode of operation of described device, write mode of operation SPP.The content of configuration file is:
# input serial ports pattern
InputMode:SPP
# output serial ports pattern
OutputMode:SPP
Wherein, the working method of the capable appointment of InputMode load module is written to this file in the fixing position of equipment by the flash disk mode (or other modes) of upgrading.
3, restart facility, beginning initiating hardware and operating system;
4, after os starting finishes, call the application program fcr.exe of acquiescence by automatic batch processing script;
5, fcr.exe at first reads the content in the lpmode.txt file, and the working method of judging the input parallel port that needs setting is SPP;
6, the fcr.exe application program sends the order of change mode of operation by the ioctrl function to parallel port input driver;
As: ioctrl (parin_fd, MODE_SET, MODE_SPP);
7, input driver in parallel port is according to the command parameter of importing above, to the pattern of parallel port input hardware module interface is set and writes corresponding pattern.That suppose that hardware module selects for use is Winbond W83977EF, then its ECR (Extended Control Register, the address is base+402h) should be changed to 0x20, and then, this module can be printed and port communications with SPP pattern POS machine.
As shown in Figure 4, when using described device, be to be unit with a byte (being assumed to 0x5A) from POS machine input data, be sent to described device with SPP pattern parallel port, its flow process is:
1, POS machine application software writes a byte 0x5A to the parallel port driver, and POS machine parallel port drives the data register that data is write the parallel port of described device, and parallel port hardware is put into data on the line of parallel port, simultaneously, puts the strobe signal low;
2, the hardware module of described device detects strobe level step-down, and the busy signal is put height, reads in a byte (byte of reading in this moment is 0x5A) from data line, and triggers an interruption, and input driver in notice parallel port has been received a byte;
3, parallel port input driver Interrupt Process function, the data register of importing hardware module from the parallel port reads in a byte (0x5A), and data is write in the data buffer of this driving;
4, application program fcr.exe drives buffer zone from the parallel port and reads in a byte (0x5A), and deposit in the chained list that should use by the read function;
For example: read (parfd , ﹠amp; Byte, 1);
5, the data processing module of application program fcr.exe is handled the data link table that reads in.
As the mode of operation of device is EPP or ECP as described in setting, and then only is in that the stage is set is different.
For the EPP pattern, the InputMode when setting load module changes EPP into and gets final product.
For ecp mode, InputMode changes ECP into and gets final product.
As shown in Figure 5, using the flow process that method of the present invention is provided with output module is:
1, open the POS machine, enter CMOS the interface is set, check the mode of operation of parallel port among its SuperIO, setting its mode of operation is SPP;
2, write the mode of operation configuration file (lpmode.txt) of described device, write mode of operation SPP.
File content is: # input serial ports pattern
InputMode:SPP
# output serial ports pattern
OutputMode:SPP
Wherein, the working method of the capable appointment of OutputMode load module is written to this file in the fixing position of equipment by the flash disk mode (or other modes) of upgrading;
3, restart described device, beginning initiating hardware and operating system;
4, after os starting finishes, call the application program fcr.exe of acquiescence by automatic batch processing script;
5, fcr.exe at first reads the content in the lpmode.txt file, and the working method of judging the output parallel port that needs setting is SPP;
6, the fcr.exe application program sends the order of change mode of operation by the ioctrl function to the parallel port output driver program;
As: ioctrl (parin_fd, MODE_SET, MODE_SPP);
7, the parallel port output driver program is according to the command parameter of importing above, to the pattern of parallel port output hardware module interface is set and writes corresponding pattern.That suppose that hardware module selects for use is WinbondW83977EF, then its ECR (Extended Control Register, the address is base+402h) should be changed to 0x20, and then, this module can be with SPP pattern printer communication.As shown in Figure 6, from described device to the flow process of printer output print command and data be: still a byte is that unit exports, and is sent to printer with the SPP pattern from set-top box.
1, the fcr.exe application program was taken out a byte from handled data link table;
2, module is imported out by the write function in the parallel port of fcr.exe application program, writes out a byte to the parallel port output driver program; For example: write (lp_fd , ﹠amp; Byte, 1);
3, the parallel port output driver program receives this byte, and is written in the data register of parallel port output hardware module;
4, output hardware module in parallel port is put into this byte on the data line of output port, and simultaneously, it is low that the strobe signal is set;
5, printer receives a byte, simultaneously, removes the busy signal.
In addition, for other two kinds of pattern EPP and ECP, just in that the stage is set is different.
For the EPP pattern, during being provided with of output mode, InputMode changes EPP into and gets final product.
For ecp mode, during being provided with of output mode, InputMode changes ECP into and gets final product.