Control method and device of laser, optical module and computer equipment
By controlling the laser's emission state through interrupt service mechanisms and target registers, the problems of serial communication time consumption and pin limitations are solved, achieving fast and efficient laser control and expanding its application scenarios.
Patent Information
- Application Number
- CN202410921133.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2044-07-09
AI Technical Summary
In existing technologies, transmitting laser control commands via serial communication bus is time-consuming and cannot meet hardware timing requirements. Furthermore, controlling the laser via general-purpose input/output pins limits the range of laser options and restricts application scenarios.
An interrupt service mechanism is adopted to save the laser control instructions to the execution queue and write them to the target register in the order of instruction initiation. Combined with the interrupt service characteristics of the microcontroller, the laser's emission state is directly controlled through the target register, avoiding the need for additional pins or interface control.
It meets the hardware timing requirements of lasers, enables rapid control, saves hardware costs, and broadens the application scenarios and scope of lasers.
Smart Images

Figure CN120389803B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a laser control method, apparatus, optical module, and computer equipment. Background Technology
[0002] In the field of communication technology, lasers can be applied to optical modules to convert electrical signals into optical signals, which can then be transmitted through optical fibers, enabling long-distance transmission of signal data and improving communication efficiency and quality. However, how to efficiently control the laser's emission intensity to achieve signal transmission remains a pressing technical problem that needs to be solved.
[0003] In one possible implementation, laser control commands can be transmitted to the laser via a serial communication bus (e.g., I2C), thereby controlling the laser. However, this method of transmitting laser control commands via a serial communication bus is time-consuming and cannot meet hardware timing requirements.
[0004] To meet hardware timing requirements, general-purpose input / output pins are typically added to lasers to control their on / off states. This approach limits the range of laser options, thus restricting their application scenarios and applicability. Summary of the Invention
[0005] This application provides a laser control method, device, optical module, and computer equipment to solve the problem that the high hardware design requirements of lasers in the prior art limit the application scenarios and scope of application of lasers.
[0006] In a first aspect, this application provides a method for controlling a laser, comprising:
[0007] In response to the received laser control commands, each laser control command is saved to the execution queue of the interrupt service; wherein, the laser control commands are used to indicate the control of the laser's brightness intensity; the execution queue includes laser control commands that have not been executed by the interrupt service.
[0008] The interrupt service is executed, and the target data matching each laser control instruction is written into the target register in the order of instruction initiation of each laser control instruction.
[0009] The emission state of the laser is controlled based on the target data stored sequentially in the target register; wherein, the emission state of the laser indicates the brightness intensity of the laser.
[0010] In one example, target data matching each of the laser control commands is written into the target register, including:
[0011] Based on the value of the target data, a control mode matching the laser control command is determined; wherein, the control mode indicates the mode for controlling the laser to be turned on or off;
[0012] Based on the control mode, the writing method of the target data is determined; wherein, the writing method indicates either a step-by-step writing method or a direct writing method;
[0013] According to the target data writing method, the target data that matches each of the laser control commands is written into the target register.
[0014] In one example, based on the value of the target data, determining a control mode that matches the laser control command includes:
[0015] If the target data is a target value, then determine the control mode indicator that matches the laser control command to control the laser to turn off.
[0016] If the value of the target data is not the target value, then a control mode indicator matching the laser control command is determined to control the laser to be turned on.
[0017] In one example, the control mode indicates the mode for controlling the laser to turn on; the write method indicates a step-by-step write method; according to the target data write method, target data matching each laser control command is written into the target register, including:
[0018] Determine the cached value in the target register;
[0019] If the cached value in the target register is not equal to the value of the target data, the target data is written into the target register according to the step-by-step writing method.
[0020] In one example, prior to receiving a laser control command, the method further includes:
[0021] Receive laser control commands initiated by the microcontroller main program and / or network devices.
[0022] In one example, before saving each of the received laser control commands to the execution queue of the interrupt service in response to the received laser control commands, the method further includes:
[0023] Determine the interrupt service that executes the laser control command, and set the execution priority of the interrupt service to the target priority.
[0024] In one example, the laser control instructions are used to control multiple lasers; target data matching each of the laser control instructions is written into a target register, including:
[0025] The target data that matches the control commands of each laser is written into the target register corresponding to each laser.
[0026] Secondly, this application provides a control device for a laser, comprising:
[0027] A response unit is configured to, in response to a received laser control command, save each laser control command to an interrupt service execution queue; wherein the laser control command is used to indicate the brightness intensity of the laser.
[0028] The writing unit is used to execute the interrupt service and, in accordance with the initiation order of each laser control instruction, sequentially write the target data matching each laser control instruction into the target register;
[0029] The control unit is used to control the emission state of the laser based on the target data stored sequentially in the target register; the emission state of the laser indicates the brightness intensity of the laser.
[0030] In one example, the write unit is used for:
[0031] Based on the value of the target data, a control mode matching the laser control command is determined; wherein, the control mode indicates the mode for controlling the laser to be turned on or off;
[0032] Based on the control mode, the writing method of the target data is determined; wherein, the writing method indicates either a step-by-step writing method or a direct writing method;
[0033] According to the target data writing method, the target data that matches each of the laser control commands is written into the target register.
[0034] In one example, the write unit includes a determination module for:
[0035] If the target data is a target value, then determine the control mode indicator that matches the laser control command to control the laser to turn off.
[0036] If the value of the target data is not the target value, then a control mode indicator matching the laser control command is determined to control the laser to be turned on.
[0037] In one example, the writing unit includes a writing module for determining a cached value in the target register when the control mode indicates a mode that controls the laser to be turned on, and the writing method indicates a step-by-step writing mode.
[0038] If the cached value in the target register is not equal to the value of the target data, the target data is written into the target register according to the step-by-step writing method.
[0039] In one example, the device also includes a receiving unit for:
[0040] Before responding to the received laser control command, receive the laser control command initiated by the microcontroller main program and / or the network device.
[0041] In one example, the device also includes a setting unit for:
[0042] Before saving each laser control instruction to the execution queue of the interrupt service in response to the received laser control instruction, the interrupt service for executing the laser control instruction is determined, and the execution priority of the interrupt service is set to the target priority.
[0043] In one example, the write unit is used for:
[0044] When the laser control command is used to control multiple lasers, the target data that matches each laser control command is written into the target register corresponding to each laser.
[0045] Thirdly, this application provides an optical module, the optical module comprising: a laser, and a control device for the laser as described in any one of the second aspects above.
[0046] Fourthly, this application provides a computer device, including: a processor, and a memory communicatively connected to the processor;
[0047] The memory stores computer-executed instructions;
[0048] The processor executes computer execution instructions stored in the memory to implement the method described in any one of the first aspects.
[0049] Fifthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in any one of the first aspects.
[0050] In a sixth aspect, this application provides a computer program product comprising: computer execution instructions stored in a computer-readable storage medium, wherein at least one processor of a computer device can read the computer execution instructions from the computer-readable storage medium, and the at least one processor executes the computer execution instructions to cause the computer device to perform the method described in any one of the first aspects.
[0051] The laser control method, apparatus, optical module, and computer equipment provided in this application can, upon receiving a laser control command, save each laser control command to an interrupt service execution queue in response to the received laser control command. This ensures the execution order of multiple laser control commands received, based on the interrupt service execution queue, preventing execution chaos and guaranteeing the accuracy of laser emission. Subsequently, an interrupt service can be executed, enabling the microcontroller to execute the laser control commands. Specifically, the interrupt service executes the interrupt service and, according to the command initiation order, sequentially writes the target data matching each laser control command into the target register. Based on the sequentially saved target data in the target register, the laser emission state is controlled. This implementation combines the requirement for interrupt service execution in the microcontroller with direct laser control via the target register, not only meeting the laser's hardware timing requirements but also enabling rapid laser control, thereby improving the control efficiency of the optical module containing the laser and further enhancing communication efficiency. At the same time, this implementation method avoids controlling the laser through additional pins or interfaces, which not only saves hardware costs but also broadens the application scenarios and scope of the laser. Attached Figure Description
[0052] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0053] Figure 1 This application provides a schematic diagram of an application scenario for controlling a laser in the prior art.
[0054] Figure 2 A flowchart illustrating the laser control method provided in this application embodiment. Figure 1 ;
[0055] Figure 3 A flowchart illustrating the laser control method provided in this application embodiment. Figure 2 ;
[0056] Figure 4 This is a schematic diagram illustrating a process for writing target data into a target register using a step-by-step writing method, as provided in an embodiment of this application.
[0057] Figure 5 A flowchart illustrating the laser control method provided in this application embodiment. Figure 3 ;
[0058] Figure 6 This application provides a schematic diagram illustrating a scenario where laser control commands are used to control multiple lasers, as shown in the embodiments of this application.
[0059] Figure 7 This is a schematic diagram of the structure of a laser control device provided in an embodiment of this application;
[0060] Figure 8 A schematic diagram of the structure of another laser control device provided in an embodiment of this application;
[0061] Figure 9 This is a schematic diagram of the structure of an optical module provided in an embodiment of this application;
[0062] Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application.
[0063] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0064] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0065] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0066] First, some terms used in the embodiments of this application will be explained.
[0067] I2C: The full name of I2C is Inter-Integrated Circuit, which is a serial communication bus.
[0068] SPI stands for Serial Peripheral interface, which is a synchronous serial external interface.
[0069] UART stands for Universal Asynchronous Receiver / Transmitter, which is a universal serial data bus.
[0070] IDAC stands for Current Digital-to-Analog Converter, an electronic component that converts digital signals into analog current signals.
[0071] It should be noted that the laser control method provided in this application can be used to control a single laser or a laser integrated into other modules (e.g., a laser integrated into an optical module). The following description uses an example of a laser integrated into an optical module. This optical module can be a single-mode optical module firmware for long-distance transmission at rates of 40G or higher. For example, the transmission rate of the optical module can be 40G, 100G, or 400G. In this case, the optical module can be applied to at least the following scenarios: 40G / 100GLR4 / ER4 / ZR4, 400G FR4 / DR4 / ER4 / LR4, etc.
[0072] Currently, lasers can be controlled via serial communication protocols or general-purpose input / output pins, such as turning the laser on, turning it off, and controlling its emission intensity.
[0073] For example, see Figure 1 , Figure 1This is a schematic diagram illustrating an application scenario of controlling a laser in the prior art, provided as an embodiment of this application. For example... Figure 1 As shown, the scene includes at least a microcontroller and a laser array. The laser array includes at least one laser.
[0074] If the laser is controlled via a serial communication protocol, then... Figure 1 The scenario shown can also include a first interface installed on the microcontroller and a second interface installed on the laser array. In this case, control signals for the laser can be transmitted via the first interface to the second interface according to a matching serial communication protocol (e.g., I2C, SPI, UART, etc.), thereby achieving laser control (see [link to documentation]). Figure 1 (Solid line shown). This method of signal transmission via serial communication interface is time-consuming and cannot meet the hardware timing requirements of lasers.
[0075] If the laser is controlled via general-purpose input / output pins, then... Figure 1 The scenario shown can also include general-purpose input / output (GPIO) pins on both the microcontroller and laser array sides. In this case, control signals to the laser can be transmitted from the microcontroller's GPIO pins to the laser array's GPIO pins, thereby achieving laser control (see [link]). Figure 1 (The dotted line is shown). This implementation requires general-purpose input / output pins on both the microcontroller and laser array sides, which limits the range of laser selection and thus restricts the application scenarios and scope of the laser.
[0076] The laser control method provided in this application aims to combine the laser control method with the microcontroller's interrupt service by utilizing the characteristic that the microcontroller's interrupt service must be executed, so as to solve the above-mentioned technical problems in the prior art.
[0077] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0078] See Figure 2 , Figure 2 A flowchart illustrating the laser control method provided in this application embodiment. Figure 1 ,like Figure 2 As shown, the method includes:
[0079] S201. In response to the received laser control commands, save each laser control command to the interrupt service execution queue.
[0080] The laser control command is used to instruct the control of the laser's brightness intensity. This command can include at least the laser number and brightness intensity information. Based on the control command, the brightness intensity of the laser corresponding to the laser number can be controlled to match that brightness intensity information. For example, the control command could instruct the brightness intensity of laser 1 to be 4. This control command can be saved to the interrupt service execution queue, allowing it to be executed during interrupt service.
[0081] In one example, laser control commands can be used to control the brightness of a single laser or multiple lasers. For instance, the laser control command could also instruct that the brightness of lasers 1, 2, 3, and 4 are all controlled to be 4. Furthermore, when using laser control commands to control the brightness of multiple lasers, the commands can either control the brightness of all lasers to be the same or to be different; no specific limitations are imposed here.
[0082] In one example, the laser control command can be initiated by the microcontroller's main program or by a network device that communicates with the microcontroller. There is no limitation on the device that initiates the laser control command; the choice is based on actual needs.
[0083] In one example, the number of received laser control commands can be one or more. In the case of multiple received laser control commands, the execution of each laser control command can be saved to the interrupt service execution queue according to the order in which they are initiated. This allows the laser control commands to be executed sequentially when the interrupt service is executed, ensuring that the laser control commands initiated first are executed first, thereby guaranteeing the accuracy of the laser's emission state.
[0084] At this time, the execution queue includes laser control instructions that the interrupt service has not yet executed, so that the interrupt server can control the laser based on the various laser control instructions included in the execution queue.
[0085] S202. Execute the interrupt service and, in accordance with the order in which each laser control instruction is initiated, write the target data that matches each laser control instruction into the target register.
[0086] In one example, target data matching the laser control command is used to indicate light intensity information. For example, the target data can be 0, 1, 2, 4, etc. The value of the target data is not limited here, but depends on the specific laser control command.
[0087] In one example, the target register is used to instruct the current-to-analog converter register. In this case, the received target data can be converted into an analog current signal through the target register, thereby controlling the laser's emission state. For example, this target register can be an IDAC register integrated within the microcontroller.
[0088] S203. Based on the target data stored sequentially in the target register, control the emission state of the laser.
[0089] The emission state of the laser indicates the brightness intensity of the laser.
[0090] In one example, the stored target data can be converted into an analog current signal based on the target register, and then the analog current signal can be sent to the laser to drive the laser to emit light / turn off, thereby achieving control of the laser.
[0091] As described above, this embodiment of the application, upon receiving a laser control command, saves each laser control command to an interrupt service execution queue in response to the received command. This ensures the execution order of multiple laser control commands received, preventing execution chaos and guaranteeing the accuracy of laser emission. Subsequently, an interrupt service is executed, enabling the microcontroller to execute the laser control commands. Specifically, the interrupt service executes the target data matching each laser control command in the order they are initiated, writing it sequentially into the target register. Based on the target data sequentially stored in the target register, the laser's emission state is controlled. This implementation combines the mandatory execution of interrupt services in the microcontroller with direct laser control via the target register. It not only meets the laser's hardware timing requirements but also enables rapid laser control, improving the control efficiency of the optical module containing the laser and further enhancing communication efficiency. At the same time, this implementation method avoids controlling the laser through additional pins or interfaces, which not only saves hardware costs but also broadens the application scenarios and scope of the laser.
[0092] See Figure 3 , Figure 3 A flowchart illustrating the laser control method provided in this application embodiment. Figure 2,like Figure 3 As shown, the method includes:
[0093] S301: Receive laser control commands initiated by the microcontroller main program and / or the network device.
[0094] In one example, the microcontroller's main program instructs the microcontroller's firmware main program, for instance, to initiate a laser control command to shut down the laser if the microcontroller's firmware detects that the laser's temperature is too high.
[0095] In one example, the network device can indicate a device that uses the laser in the optical module. The type of network device is not limited here, as long as it can be implemented.
[0096] At this point, the network device can initiate laser control commands and transmit them to the microcontroller, which then controls the laser's emission state to transmit signals. The communication methods between the network device and the microcontroller include, but are not limited to, general-purpose input / output pin communication; however, no specific limitations are imposed on the communication methods used between the network device and the microcontroller here.
[0097] S302. Determine the interrupt service for executing laser control commands and set the execution priority of the interrupt service to the target priority.
[0098] In one example, the target priority indicates the lowest priority interrupt to avoid interrupting other interrupt services, such as the PendSV (Pended System Service Call) service.
[0099] S303. In response to the received laser control commands, save each laser control command to the interrupt service execution queue.
[0100] Among them, the laser control command is used to indicate and control the brightness of the laser; the execution queue includes laser control commands that were not executed due to interrupt service.
[0101] In one example, this step can be referred to the content described in S201 above, and will not be repeated in detail here.
[0102] S304. Execute the interrupt service and, in accordance with the order in which each laser control instruction is initiated, write the target data that matches each laser control instruction into the target register.
[0103] In practice, after executing the interrupt service routine and before writing the target data to the register, the control mode matching the laser control command can be determined based on the value of the target data. The control mode indicates whether the laser is turned on or off. For example, if the target data value is a target value, the control mode matching the laser control command indicates a mode to turn the laser off; if the target data value is not a target value, the control mode matching the laser control command indicates a mode to turn the laser on. The target value can indicate that the corresponding light intensity of the laser is 0, thus turning the laser off. In this case, the target value can be 0.
[0104] Then, based on the control mode, the writing method of the target data is determined. The writing method indicates either a stepped writing method or a direct writing method. The step value for the stepped writing method can be 1, 2, 3, etc., and the size of the step value is not limited here.
[0105] Finally, according to the target data writing method, the target data that matches the control commands of each laser is written into the target register in sequence.
[0106] In one example, if the control mode indicates the mode for controlling the laser to be on, then the method for writing the target data determined based on this control mode is the step-by-step writing method. In this case, if the target data matching each laser control command is written into the target register according to the target data writing method, the buffer value in the target register can be determined. If the buffer value in the target register is not equal to the target data value, then the target data is written into the target register according to the step-by-step writing method. If the buffer value in the target register is equal to the target data, then the process of writing the target data into the target register is omitted.
[0107] For example, see Figure 4 , Figure 4 This is a schematic diagram illustrating a process for writing target data into a target register using a step-by-step writing method, as provided in an embodiment of this application. Figure 4 As shown, when it is determined that the target data will be written to the target register in a step-by-step writing manner, the cache value in the target register can be determined first, and then it can be determined whether the value of the target data is equal to the cache value in the target register.
[0108] If the value of the target data is equal to the cached value in the target register, then the target data is not written this time, and the writing ends directly. If the value of the target data is not equal to the cached value in the target register, then the steps described below can be executed repeatedly.
[0109] You can first determine whether the value of the target data is less than the cached value in the target register.
[0110] If so, first determine whether the difference between the target data value and the cached value is less than the step value (i.e., ...). Figure 4 (The difference between the two values shown is less than the step value). If so, the target data can be directly written to the target register, that is, the cached value = the target value. At this time, the cached value in the target register is updated to the target data. If not, the cached value in the target register can be updated based on the step value, that is, the cached value = the cached value - the step value. At this time, the cached value in the target register is updated to the cached value - the step value.
[0111] If not, first determine if the difference between the target data value and the cached value is less than the step value. If so, the target data can be directly written to the target register, that is, the cached value = the target value. At this time, the cached value in the target register is updated to the target data. If not, the cached value in the target register can be updated based on the step value, that is, the cached value = the cached value + the step value. At this time, the cached value in the target register is updated to the cached value + the step value.
[0112] This implementation method can avoid overcharging of the laser's optical power.
[0113] In one example, if the control mode indicates the mode that controls the laser to shut down, then the method for writing the target data determined based on this control mode is the direct write mode. In this case, the target data can be directly written into the target register. For example, if the cache value in the target register is 5 and the target data value is 0, the value in the target register can be directly updated to 0, thereby speeding up the laser shutdown process and improving efficiency.
[0114] Alternatively, when the control mode indicates that the laser is turned off, the target data can be written in a step-by-step manner. This allows the target data to be written into the target register in a step-by-step manner, thereby gradually reducing the laser's brightness intensity until it is turned off, thus avoiding sudden changes in the laser's brightness intensity.
[0115] S305. Based on the target data stored sequentially in the target register, control the emission state of the laser.
[0116] The emission state of the laser indicates the brightness intensity of the laser.
[0117] In one example, this step can be referred to the content described in S203 above, and will not be repeated in detail here.
[0118] See Figure 5 , Figure 5A flowchart illustrating the laser control method provided in this application embodiment. Figure 3 ,like Figure 5 As shown, the method includes:
[0119] S501. In response to the received laser control commands, save each laser control command to the execution queue of the interrupt service.
[0120] Among them, the laser control command is used to indicate and control the brightness of the laser; the execution queue includes laser control commands that were not executed due to interrupt service.
[0121] S502. Determine whether the laser control command controls a single laser.
[0122] If yes, then perform the steps described in S503 below; otherwise, perform the steps described in S504 below.
[0123] S503: Execute the interrupt service and, in accordance with the order in which each laser control instruction is initiated, write the target data that matches each laser control instruction into the target register.
[0124] S504: Execute the interrupt service and, according to the instruction initiation order of each laser control instruction, write the target data that matches each laser control instruction into the target register corresponding to each laser.
[0125] See one example. Figure 6 , Figure 6 This is a schematic diagram illustrating an application scenario where laser control commands provided in this application are used to control multiple lasers. For example... Figure 6 As shown, this scenario may include a microcontroller, network devices, and a laser array. Figure 6 As shown, the laser array can include 4 lasers. In this case, the microcontroller can also include 4 target registers, and each target register can correspond to a laser to control the emission state of the corresponding laser.
[0126] At this point, laser control commands initiated by the microcontroller and / or network device can be received, and each laser control command can be saved to the interrupt service execution queue. Next, the interrupt service can be executed to sequentially write the target data matching each laser control command into the target register corresponding to each laser, according to the command initiation order. Then, based on the target data sequentially saved in the target registers, the laser's emission state is controlled.
[0127] This implementation method allows for the writing of target data matching the laser control commands into the target registers corresponding to each laser when multiple lasers need to be controlled, thus ensuring consistency and efficiency in controlling each laser.
[0128] S505. Based on the target data sequentially stored in the target register, control the laser's emission state. The laser's emission state indicates the laser's brightness intensity.
[0129] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0130] Figure 7 This is a schematic diagram of the structure of a laser control device provided in an embodiment of this application, as shown below. Figure 7 As shown, the control device 700 of the laser includes:
[0131] The response unit 701 is used to save each laser control instruction to the interrupt service execution queue in response to the received laser control instructions; wherein, the laser control instructions are used to indicate the brightness intensity of the laser.
[0132] The write unit 702 is used to execute interrupt service and write the target data that matches each laser control instruction into the target register in the order in which each laser control instruction is initiated.
[0133] The control unit 703 is used to control the emission state of the laser based on the target data stored sequentially in the target register; the emission state of the laser indicates the brightness intensity of the laser.
[0134] Figure 8 A schematic diagram of the structure of another laser control device provided in the embodiments of this application is shown below. Figure 8 As shown, the control device 800 of the laser includes:
[0135] The response unit 801 is used to save each laser control instruction to the interrupt service execution queue in response to the received laser control instructions; wherein, the laser control instructions are used to indicate the brightness intensity of the laser.
[0136] The write unit 802 is used to execute interrupt service and write the target data that matches each laser control instruction into the target register in the order in which each laser control instruction is initiated.
[0137] The control unit 803 is used to control the emission state of the laser based on the target data stored sequentially in the target register; the emission state of the laser indicates the brightness intensity of the laser.
[0138] In one example, write unit 802 is used for:
[0139] Based on the values of the target data, a control mode matching the laser control command is determined; wherein, the control mode indicates the mode for controlling the laser to be turned on or off;
[0140] Based on the control mode, the writing method of the target data is determined; where the writing method indicates either step-by-step writing method or direct writing method;
[0141] According to the target data writing method, the target data that matches the control commands of each laser is written into the target register.
[0142] In one example, the write unit 802 includes a determination module 8021, for:
[0143] If the target data is a target value, then determine the control mode indicator that matches the laser control command to control the laser to turn off.
[0144] If the value of the target data is not the target value, then determine the control mode indicator that matches the laser control command to control the laser to turn on.
[0145] In one example, the write unit 802 includes a write module 8022 for determining the cached value in the target register when the control mode indicates a mode that controls the laser to be turned on, and the write mode indicates a step-by-step write mode.
[0146] If the cached value in the target register is not equal to the value of the target data, the target data is written into the target register in a step-by-step writing manner.
[0147] In one example, the device also includes a receiving unit 804, for:
[0148] Before responding to the received laser control command, receive the laser control command initiated by the microcontroller main program and / or the network device.
[0149] In one example, the device also includes a setting unit 805 for:
[0150] Before saving each laser control command to the execution queue of the interrupt service in response to the received laser control command, determine the interrupt service to execute the laser control command and set the execution priority of the interrupt service to the target priority.
[0151] In one example, write unit 802 is used for:
[0152] When laser control commands are used to control multiple lasers, the target data that matches each laser control command is written into the target register corresponding to each laser.
[0153] The laser control device provided in this embodiment can execute the laser control method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0154] See Figure 9 , Figure 9 This is a schematic diagram of the structure of an optical module provided in an embodiment of this application, such as... Figure 9 As shown, the optical module includes a laser and a control device for the laser.
[0155] Figure 10 This application provides a schematic diagram of the structure of a computer device, as shown in the embodiment of the present application. Figure 10 As shown, the computer device 1000 includes: a memory 1001 and a processor 1002.
[0156] Memory 1001; a memory for storing computer-executable instructions that can be executed by processor 1002.
[0157] The processor 1002 is configured to execute computer execution instructions stored in the memory 1001 to implement the method provided in the above embodiments.
[0158] The computer device also includes a receiver 1003 and a transmitter 1004. The receiver 1003 is used to receive instructions and data sent by external devices, and the transmitter 1004 is used to send instructions and data to external devices.
[0159] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the various embodiments described above.
[0160] The computer-readable storage medium can be a computer storage medium or a communication medium. A communication medium includes any medium that facilitates the transmission of computer execution instructions from one location to another. A computer storage medium can be any available medium accessible to a general-purpose or special-purpose computer. For example, a computer-readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the computer-readable storage medium. Of course, the computer-readable storage medium can also be a component of the processor. The processor and the computer-readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the ASIC can reside in a user equipment. Of course, the processor and the computer-readable storage medium can also exist as discrete components in a communication device.
[0161] Specifically, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0162] This application also provides a computer program product including computer-executable instructions stored in a computer-readable storage medium. At least one processor of the device can read the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions to cause the computer device to implement the methods provided in the various embodiments described above.
[0163] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0164] The modules can be physically separate, for example, installed in different locations within a single device, installed on different devices, distributed across multiple network units, or distributed across multiple processors. Alternatively, the modules can be integrated, for example, installed in the same device, or integrated into a single codebase. The modules can exist in hardware form, software form, or a combination of both. This application can select some or all of the modules to achieve the objectives of this embodiment based on actual needs.
[0165] When the various modules are implemented as integrated software functional modules, they can be stored in a computer-readable storage medium. The aforementioned software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.
[0166] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0167] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0168] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A control method of a laser, characterized by, The method comprises the following steps: in response to the received laser control instructions, saving each of the laser control instructions into an execution queue of an interrupt service; wherein the laser control instructions are used to indicate the light intensity of the laser; the execution queue comprises the laser control instructions which are not executed by the interrupt service; executing the interrupt service, and sequentially writing target data matched with each of the laser control instructions into a target register corresponding to each of the lasers according to the instruction initiation order of each of the laser control instructions; wherein the laser control instructions are used to control a plurality of lasers, and each target register corresponds to one laser and is used to control the light emission state of the corresponding laser; controlling the light emission state of the laser based on the target data sequentially saved in the target register; wherein the light emission state of the laser indicates the light intensity of the laser.
2. The method of claim 1, wherein, The step of writing the target data matched with each of the laser control instructions into the target register comprises the following steps: determining a control mode matched with the laser control instruction based on the value of the target data; wherein the control mode indicates the mode of controlling the laser to be turned on or turned off; determining a writing mode of the target data based on the control mode; wherein the writing mode indicates a step-by-step writing mode or a direct writing mode; writing the target data matched with each of the laser control instructions into the target register according to the writing mode of the target data.
3. The method of claim 2, wherein, The step of determining the control mode matched with the laser control instruction based on the value of the target data comprises the following steps: if the value of the target data is a target value, determining that the control mode matched with the laser control instruction indicates the mode of controlling the laser to be turned off; if the value of the target data is not the target value, determining that the control mode matched with the laser control instruction indicates the mode of controlling the laser to be turned on.
4. The method of claim 2, wherein, The control mode indicates the mode of controlling the laser to be turned on; the writing mode indicates the step-by-step writing mode; and the step of writing the target data matched with each of the laser control instructions into the target register according to the writing mode of the target data comprises the following steps: determining a cache value in the target register; in the case that the cache value in the target register is not equal to the value of the target data, writing the target data into the target register according to the step-by-step writing mode.
5. The method of claim 1, wherein, Before the step of responding to the received laser control instructions, the method further comprises the following steps: receiving a single-chip microcomputer main program and / or a laser control instruction initiated by a network device.
6. The method of claim 1, wherein, Before the step of saving each of the laser control instructions into the execution queue of the interrupt service in response to the received laser control instructions, the method further comprises the following steps: determining the interrupt service for executing the laser control instructions, and setting the execution priority of the interrupt service as a target priority.
7. A control device for a laser, characterized by The method comprises the following steps: a responding unit, configured to save each of the laser control instructions into an execution queue of an interrupt service in response to the received laser control instructions; wherein the laser control instructions are used to indicate the light intensity of the laser; A writing unit is configured to execute the interrupt service and sequentially write target data matched with each laser control instruction into a target register corresponding to each laser according to an initiation order of each laser control instruction, wherein the laser control instruction is used to control a plurality of lasers, and each target register corresponds to one laser and is used to control a light-emitting state of the corresponding laser. A control unit is configured to control the light-emitting state of the laser based on the target data sequentially saved in the target register, wherein the light-emitting state of the laser indicates a light intensity of the laser.
8. An optical module characterized by comprising: The optical module comprises a laser and the laser control device of claim 7.
9. A computer device, comprising: Comprise: A processor and a memory connected in communication with the processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the laser control method of any one of claims 1 to 6.
Citation Information
Patent Citations
Automatic debugging method and device for optical module
CN112564787A
Motion control method, device and equipment in desktop intelligent laser equipment
CN116414083A