Computer spring machine is used to production spring of dedicated equipment. Press Board, as a human-computer interaction of operation interface, up with entered operation command, edit spring processing program and the modified data of function, on computer spring machine of operation control up with important role. in actual application in the, for convenient operation, need will press Board of press characters of and directly of, this makes using standard of PC keyboard not too may, so development a cheap and General of press Board on is has significance. in PC machine in the, Keyboard and a host of communication using PS/2 Protocol. because computer spring forming machine controller is a standard industrial PC controllers, have a standard keyboard interface, in order to keep the design simple and generic, keyboard interface using the standard here, and to keys using PS/2 Protocol of communication between Board and spring, Design selection of SCM as the key chip keys of identification and the sending and receiving of data. This paper describes the design and detailed method of achieving this key board.
I. key design
Press Board used film Panel switch form, film Panel switch design simple, operation convenient, placed easy, directly posted in a surface on can using, plus its waterproof dust of performance, is for industrial control of application occasions. on a spring machine of press Board for, its press including three class: digital key, function key and edit key. digital key achieved of is digital of entered; function key corresponds to of is spring machine of operation command; Edit key for on spring processing program of edit, as clear, and Etc. a well-designed button placement, directly associated with ease of operation and reliability, for a specific layout of each key, should be considered for operational convenience and beautiful layout, 7 lines of x8 after the completion of the design under column layout of keys, see
Thin-film panels the following array circuit using single-sided flexible circuit board (FPC), convex form of the circuit to ensure that the press feel. it is the keyboard array rows of the output line and column line.
II. key board hardware and software design
Both keys for hardware design and software design, both keys will be involved and host communication protocols. so before access to hardware and software design, a simple introduction to PS/2 agreement.
1. PS/2 Protocol
PS/2 agreement is peripherals and host Zhijian communications of a synchronization double serial agreement. in agreement in the host end has high of priority level, in must conditions Xia it can suspended peripherals is for of sent process. the agreement used of short frame format transfer data of data frame format for: 1 bit starting bit (0), 8 bit data bit, one odd check bit, one stop bit (1). data sent Shi low in Qian, high in Hou. peripherals each received host sent to of a frame data, Are to followed the frame of stop bit sent a shook hands bit ACK (0) answer host, then peripherals also to sent 1 frame answer data (0xF0), showed that has full to received to has host of command; and host in received peripherals data Hou without sent shook hands signal ACK, also not need addition sent answer frame. regardless of is host returned is peripherals sent data, synchronization clock are is by peripherals produced of.
According to received party and sent party of different, the agreement can is divided into two part, one for peripherals sent host received of communications, this a process occurred in staff operation peripherals or peripherals answer host end sent to of command Shi, data line and clock line in free State Xia maintained high level State; second for host sent peripherals received of communications, the process occurred in host Shang electric since check Shi, host sent test signal detection peripherals whether exists and judge is what type of peripherals Shi. This Shang electric detection on peripherals for is important, Which a detection project for basic guarantee test (Basic Assure Test), dang host sent the command to peripherals Shi, peripherals must echo corresponding of answer frame, or host on think the peripherals of boot since check didn’t can through, in DOS above of system in the, peripherals will cannot using. host Shang electric since check Shi, sent to peripherals of data is a command set, for each command, peripherals are to made corresponding of response, these response Word also are is agreement by provides good of, specific can see literature  .
2. hardware design
Where AT89S51 is used as keys for the main processing chip. AT89S51 is a low-power, high-performance 8-bit CMOS microcontroller, with 32 I/O ports are available, can meet the requirements when there are row-column scanning and software watchdog.
Corresponds with the front button placement, using 7×8 matrix structure. lines with 89S51 P2, line P0 port, P0 port does not have an internal pullup resistor, so lines shall be an external pull-up resistor. AT89S51 power supply is provided by the PS/2 interface of the host used frequency of 12MHz external crystal oscillator. P3.6 and P3.7 as the data and clock lines and communicate with hosts, complete hardware schematic is shown in Figure II.
Keys for array diagram as shown in Figure III, keys for array simply by its line and column line leads to the receive line interface as shown in Figure II. key board and connected to the host through the PS/2 interface connector, now a common PS/2 interface connector as shown in figure IV.
3. software design
Software design is the key of keys for achieving, microcontroller programming in c language. through the main program and a series of programs to achieve. main program for system initialization subroutine calls. command subroutine subprograms include receiving hosts, send data subprogram receives data subprogram, row-column scanning routines as well as send different programs.
Received host command child program for Panel received host of command, and made corresponding of response, this in DOS above of system in the is important, or host not admitted press Board of exists. sent data child program for sent data frame to host, each a bit data of sent are is by PS/2 agreement of timing requirements by prepared of. received data child program for received host sent to of data frame, each a bit data of received is by timing provides of. ranks scan child program role is on press Board Shang key of recognition, And will the key corresponds to of code sent to press buffer temporarily save up. PS/2 agreement in the, dang a key was by Xia or press Shi on sent the key of pass code (MAKE), was release Shi on sent broken code (BREAK), each press are was distribution has only of pass code and broken code (agreement in the collectively for scan code), such host through scan code on can recognition press of category. in spring machine of press Board in the, because Panel in the of key not full is standard of, for those since defined of key, Can will the key and a standard key of scan code corresponds to up, for example can will Panel in the of “started” and standard key “a,” corresponds to, such Dang “started” was by Xia Shi, sent to host of is letters “a,” of scan code, through heavy defined host system in the of related control part, on can achieved started spring machine of function. sent key different program for sent press buffer in the of data. and for Panel in the of “lock key”, achieved of is Panel of lock died, in industrial system in the, This is very necessary for the reliability of the operating system, when the key is pressed, no data in the send buffer, and flush the buffers, click Unlock. in order to prevent the occurrence of panic, added to the main program loop software watchdog. software flow chart shown in the following figure: