发明名称 RECOGNITION METHOD COMMUNICATION MODE
摘要 A method for a communication mode, comprises: detecting the type of the communication mode; if the communication mode is a USB interface communication mode, turning off a timer; when an instruction is received, conducting a corresponding operation according to the USB interface communication protocol supported by the device; if the communication mode is not set, then when the timeout identifier is set, setting the communication mode as a serial port communication mode, turning off the timer, resetting the timeout identifier, and executing step S6; if the communication mode is a serial port communication mode, turning off the timer, and executing step S6; step S6: when the instruction is received, conducting a corresponding operation according to the serial port protocol.
申请公布号 US2016357692(A1) 申请公布日期 2016.12.08
申请号 US201414913888 申请日期 2014.08.22
申请人 FEITIAN TECHNOLOGIES CO., LTD 发明人 LU Zhou;YU Huazhang
分类号 G06F13/38;G06F13/24;G06F13/42 主分类号 G06F13/38
代理机构 代理人
主权项 1. A method for recognizing a communication mode, comprising: step S1 comprising powering on a device, initializing, turning on an interruption and a timer, and the timer starting timing; entering a clock interruption when a preset value is reached by timing of the timer, wherein the clock interruption comprises: turning off the timer, setting a time-out flag, turning on the timer, and exiting the clock interruption; executing Step B1 to step B8 when other interruption signals are detected; step B1 comprising determining a type of an interruption, executing step B2 in the case that the interruption is a USB interruption; executing step B6 in the case that the interruption is a serial port interruption; step B2 comprising turning off the USB interruption; step B3 comprising determining whether a communication mode is set, executing step B5 in the case that the communication mode is set; executing step B4 in the case that the communication mode is not set; step B4 comprising setting the communication mode as USB interface communication, executing step B5; step B5 comprising turning on the USB interruption, carrying out a USB enumeration, returning a USB interface communication protocol supported by the device to a host, exiting the USB interruption after the USB enumeration is finished; step B6 comprising turning off the serial port interruption; step B7 comprising determining whether the communication mode is set, turning on the serial port interruption and exiting the serial port interruption in the case that the communication mode is set; executing step B8 in the case that the communication mode is not set; step B8 comprising setting the communication mode as serial communication according to a first data package which is received, turning on the serial port interruption, exiting the serial port interruption; step S2 comprising detecting a type of the communication mode, turning off the timer and executing step S3 in the case that the communication mode is the USB interface communication; turning off the timer and executing step S6 in the case that the communication mode is the serial communication; executing step S4 in the case that the communication mode is not set; step S3 comprising waiting for an instruction sent by the host, when the instruction is received, processing an operation correspondingly according to the USB interface communication protocol supported by the device, and returning to step S3 after the operation is finished; step S4 comprising determining whether the time-out flag is set, executing step S5 in the case that the time-out flag is set; returning to step S2 in the case that the time-out flag is not set; step S5 comprising setting the communication mode as the serial communication, turning off the timer, resetting the time-out flag, executing step S6; step S6 comprising waiting for an instruction sent by the host, when the instruction is received, processing an operation corresponding to the instruction according to a serial port protocol, and returning to step S6 after the operation is finished.
地址 Beijing CN