Laser control method and device, optical module and computer equipment
Through the combination of the interrupt service mechanism and the target register, the problems of serial communication time and pin limit are solved, and the rapid control and wide application of lasers are achieved.
Patent Information
- Application Number
- CN202410921133.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2044-07-09
AI Technical Summary
In the prior art, transmitting laser control instructions through the serial communication bus takes a long time and cannot meet the hardware timing requirements. The addition of general input and output pins limits the selection range and application scenarios of the laser.
The 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 initiation of the instruction. Combined with the interrupt service characteristics of the microcontroller, the laser's luminous state is directly controlled to avoid the use of additional pins.
Meets the hardware timing requirements of lasers, achieves rapid control, saves hardware costs, and broadens the application scenarios and scope of application of lasers.
Smart Images

Figure CN120389803A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a method and apparatus for controlling a laser, an optical module, and a computer device. Background Art
[0002] In the field of communication technologies, a laser can be applied to an optical module. After converting an electrical signal into an optical signal through the laser, the signal can be transmitted through an optical fiber, enabling long-distance transmission of signal data and thus improving the efficiency and quality of communication. However, how to efficiently control the luminous intensity of the laser to achieve signal transmission has become a technical problem that urgently needs to be solved.
[0003] In a possible implementation, a laser control instruction can be transmitted to the laser through a serial communication bus (e.g., Inter-Integrated Circuit bus I2C) to control the laser. However, this method of transmitting the laser control instruction through the serial communication bus takes a long time and cannot meet the hardware timing requirements.
[0004] To meet the hardware timing requirements, general-purpose input / output pins are usually added to the laser to control the turn-on and turn-off of the laser through these pins. This implementation restricts the selection range of the laser, thereby limiting the application scenarios and scope of application of the laser. Summary of the Invention
[0005] This application provides a method and apparatus for controlling a laser, an optical module, and a computer device to solve the problem in the prior art that the hardware design requirements for the laser are high, which in turn limits the application scenarios and scope of application of the laser.
[0006] In a first aspect, this application provides a method for controlling a laser, including:
[0007] In response to a received laser control instruction, saving each of the laser control instructions to an execution queue of an interrupt service; wherein the laser control instruction is used to indicate controlling the luminous intensity of the laser; and the execution queue includes unexecuted laser control instructions of the interrupt service;
[0008] Executing the interrupt service, and sequentially writing target data matching each of the laser control instructions into a target register according to the instruction initiation order of each of the laser control instructions;
[0009] Based on the target data sequentially saved in the target register, controlling the luminous state of the laser; wherein the luminous state of the laser indicates the luminous intensity of the laser.
[0010] In one example, writing the target data matching each of the laser control instructions into a target register includes:
[0011] Based on the value of the target data, determining a control mode matching the laser control instruction; wherein, the control mode indicates a mode for controlling the laser to turn on or off;
[0012] Based on the control mode, determining a writing method for the target data; wherein, the writing method indicates a step-by-step writing method or a direct writing method;
[0013] According to the writing method of the target data, writing the target data matching each of the laser control instructions into the target register.
[0014] In one example, based on the value of the target data, determining a control mode matching the laser control instruction includes:
[0015] If the value of the target data is a target value, determining that the control mode matching the laser control instruction indicates a mode for controlling the laser to turn off;
[0016] If the value of the target data is not the target value, determining that the control mode matching the laser control instruction indicates a mode for controlling the laser to turn on.
[0017] In one example, the control mode indicates a mode for controlling the laser to turn on; the writing method indicates a step-by-step writing method; according to the writing method of the target data, writing the target data matching each of the laser control instructions into the target register includes:
[0018] Determining a cache value in the target register;
[0019] In a case where 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 method.
[0020] In one example, before receiving the laser control instruction, the method further includes:
[0021] Receiving a laser control instruction initiated by a single-chip microcomputer main program and / or a network device.
[0022] In one example, before saving each of the laser control instructions into an execution queue of an interrupt service in response to receiving the laser control instruction, the method further includes:
[0023] Determine the interrupt service for executing the laser control instruction, and set the execution priority of the interrupt service to the target priority.
[0024] In one example, the laser control instruction is used to control multiple lasers; writing the target data matching each laser control instruction into the target register includes:
[0025] Write the target data matching each laser control instruction into the target register corresponding to each laser.
[0026] In a second aspect, the present application provides a control device for a laser, including:
[0027] A response unit, configured to save each laser control instruction to the execution queue of the interrupt service in response to the received laser control instruction; wherein, the laser control instruction is used to indicate the brightness intensity of controlling the laser;
[0028] A writing unit, configured to execute the interrupt service, and sequentially write the target data matching each laser control instruction into the target register according to the initiation order of each laser control instruction;
[0029] A control unit, configured to control the light emitting state of the laser based on the target data sequentially stored in the target register; the light emitting state of the laser indicates the brightness intensity of the laser.
[0030] In one example, the writing unit is configured to:
[0031] Determine the control mode matching the laser control instruction based on the value of the target data; wherein, the control mode indicates the mode of controlling the laser to turn on or off;
[0032] Determine the writing method of the target data based on the control mode; wherein, the writing method indicates a step-by-step writing method or a direct writing method;
[0033] Write the target data matching each laser control instruction into the target register according to the writing method of the target data.
[0034] In one example, the writing unit includes a determination module, configured to:
[0035] If the value of the target data is the target value, determine that the control mode matching the laser control instruction indicates the mode of controlling the laser to turn off;
[0036] If the value of the target data is not the target value, determine a control mode that matches the laser control instruction to indicate the mode for turning on the laser.
[0037] In one example, the writing unit includes a writing module for turning on the laser in the mode indicated by the control mode; when the writing method indicates a step-by-step writing method, determine the cache value in the target register.
[0038] If the cache value in the target register is not equal to the value of the target data, then write the target data into the target register according to the step-by-step writing method.
[0039] In one example, the device further includes a receiving unit for:
[0040] Before responding to the received laser control instruction, receive the main program of the single-chip microcomputer and / or the laser control instruction initiated by the network device.
[0041] In one example, the device further includes a setting unit for:
[0042] Before saving each of the laser control instructions to the execution queue of the interrupt service in response to the received laser control instruction, determine the interrupt service for executing the laser control instruction and set the execution priority of the interrupt service to the target priority.
[0043] In one example, the writing unit is for:
[0044] When the laser control instruction is used to control multiple lasers, write the target data that matches each of the laser control instructions into the target registers corresponding to each of the lasers.
[0045] In a third aspect, the present application provides an optical module, which includes: a laser, and the control device of the laser according to any one of the second aspects above.
[0046] In a fourth aspect, the present application provides a computer device, including: a processor, and a memory communicatively connected to the processor;
[0047] The memory stores computer execution instructions;
[0048] The processor executes the computer execution instructions stored in the memory to implement the method according to any one of the first aspects.
[0049] Fifth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in any one of the first aspect.
[0050] Sixth aspect, the present application provides a computer program product, which includes: computer-executable instructions, the computer-executable instructions are stored in a computer-readable storage medium, at least one processor of a computer device can read the computer-executable instructions from the computer-readable storage medium, and the at least one processor executes the computer-executable instructions, so that the computer device executes the method described in any one of the first aspect.
[0051] The laser control method, device, optical module and computer device provided by the present application can, after receiving a laser control instruction, in response to the received laser control instruction, save each laser control instruction to the execution queue of the interrupt service, so that when multiple laser control instructions are received, based on the execution queue of the interrupt service, the execution order of each laser control instruction can be ensured, avoiding the phenomenon of chaotic execution, thereby ensuring the accuracy of laser emission. Then, the interrupt service can be executed, so that the single-chip microcomputer can execute the laser control instruction based on the interrupt service, that is, execute the interrupt service, and in the order of the instruction initiation of each laser control instruction, sequentially write the target data matching each laser control instruction into the target register, so as to control the emission state of the laser based on the target data sequentially stored in the target register. This implementation method can combine the characteristics that the interrupt service in the single-chip microcomputer must be executed and the method of directly controlling the laser through the target register, not only can meet the hardware timing requirements of the laser, but also can realize the fast control of the laser, thereby improving the control efficiency of the optical module including the laser, so as to further improve the communication efficiency. At the same time, this implementation method also avoids controlling the laser by means of additional pins or interfaces, which not only saves hardware costs, but also broadens the application scenarios and scope of application of the laser. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0053] Figure 1 It is a schematic diagram of an application scenario for controlling a laser in the prior art provided by an embodiment of the present application;
[0054] Figure 2 It is a flowchart of the laser control method provided by an embodiment of the present application Figure 1 ;
[0055] Figure 3 Flow schematic of the laser control method provided by the embodiments of the present application Figure 2 ;
[0056] Figure 4 Flow schematic diagram of writing target data into a target register in a step - by - step writing manner provided by the embodiments of the present application;
[0057] Figure 5 Flow schematic of the laser control method provided by the embodiments of the present application Figure 3 ;
[0058] Figure 6 Schematic diagram of the application scenario where the laser control instruction provided by the embodiments of the present application is used to control multiple lasers;
[0059] Figure 7 Schematic diagram of the structure of a laser control device provided by the embodiments of the present application;
[0060] Figure 8 Schematic diagram of the structure of another laser control device provided by the embodiments of the present application;
[0061] Figure 9 Schematic diagram of the structure of an optical module provided by the embodiments of the present application;
[0062] Figure 10 Schematic diagram of the structure of a computer device provided by the embodiments of the present application.
[0063] Through the above - mentioned drawings, the clear embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed implementation manners
[0064] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with the present application. On the contrary, they are merely examples of the devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0065] In this text, the term "and / or" merely describes an associated relationship, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, the term "at least one" in this text means any one of multiple items or any combination of at least two of multiple items. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set composed of A, B, and C.
[0066] First, some terms involved in the embodiments of this application are explained.
[0067] I2C: The full English name is Inter-Integrated Circuit, which is an integrated circuit bus and a serial communication bus.
[0068] SPI: The full English name is Serial Peripheral interface, which is a synchronous serial external interface.
[0069] UART: The full English name is Universal Asynchronous Receiver / Transmitter, which is a universal serial data bus.
[0070] IDAC: The full English name is Current Digital-to-Analog Converter, which is an electronic component that converts digital signals into analog current signals.
[0071] It should be noted here that the laser control method provided by the embodiments of this application can be used to control a single laser or the lasers integrated in other modules (such as the lasers integrated in an optical module). The following takes the laser integrated in an optical module as an example for illustration. Among them, the optical module can be a firmware of a single-mode optical module with a transmission rate above 40G for long-distance transmission. For example, the transmission rate of the optical module can be 40G, 100G, or 400G, etc. At this time, the optical module can be applied to at least the following scenarios: 40G / 100GLR4 / ER4 / ZR4, 400G FR4 / DR4 / ER4 / LR4, etc.
[0072] Currently, the control of the laser can be achieved through a serial communication protocol or through general-purpose input / output pins. For example, turning on the laser, turning off the laser, controlling the luminous intensity of the laser, etc.
[0073] Exemplarily, refer to Figure 1 , Figure 1A schematic diagram of an application scenario for controlling a laser in the prior art provided by an embodiment of the present application. As Figure 1 shown, this scenario includes at least a single-chip microcomputer and a laser array. Among them, the laser array includes at least one laser.
[0074] If the control of the laser is achieved through a serial communication protocol, then, Figure 1 the scenario shown may also include a first interface installed at the single-chip microcomputer end and a second interface installed at the laser array end. At this time, the control signal for the laser can be transmitted to the second interface through the first interface according to a matching serial communication protocol (for example, I2C communication protocol, SPI communication protocol, UART communication protocol, etc.), so as to achieve the control of the laser (see Figure 1 the solid line shown). This way of signal transmission through a serial communication interface takes a long time and cannot meet the hardware timing requirements of the laser.
[0075] If the control of the laser is achieved through general-purpose input / output pins, then, Figure 1 the scenario shown may also include the general-purpose input / output pins set at the single-chip microcomputer end and the general-purpose input / output pins set at the laser array end. At this time, the control signal for the laser can be transmitted to the general-purpose input / output pins set at the laser array end through the general-purpose input / output pins set at the single-chip microcomputer end, so as to achieve the control of the laser (see Figure 1 the dotted line shown). This implementation requires general-purpose input / output pins to be set at both the single-chip microcomputer end and the laser array end, which limits the selection range of the laser, thereby limiting the application scenario and scope of application of the laser.
[0076] The control method of the laser provided by the present application aims to combine the control method of the laser with the interrupt service of the single-chip microcomputer by utilizing the characteristic that the interrupt service of the single-chip microcomputer must be executed, so as to solve the above technical problems in the prior art.
[0077] The following will detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems with specific embodiments. These several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the drawings.
[0078] See Figure 2 , Figure 2 is a flowchart of the control method of the laser provided by an embodiment of the present application Figure 1 , as Figure 2 shown, this method includes:
[0079] S201. In response to the received laser control instruction, save each laser control instruction to the execution queue of the interrupt service.
[0080] Among them, the laser control instruction is used to indicate the control of the light intensity of the laser. At this time, the laser control instruction can at least include: laser number information and light intensity information. At this time, according to the laser control instruction, the light intensity of the laser corresponding to the laser number information can be controlled to correspond to the light intensity information. For example, the laser control instruction can indicate: control the light intensity of laser 1 to be 4. At this time, the laser control instruction can be saved to the execution queue of the interrupt service, so that when the interrupt service is executed, the laser control instruction is executed.
[0081] In one example, the laser control instruction can be used to control the light intensity of a single laser or multiple lasers. For example, the laser control instruction can also indicate: control the light intensities of laser 1, laser 2, laser 3, and laser 4 to be 4, etc. At the same time, when the laser control instruction is used to control the light intensities of multiple lasers, the light intensities of the multiple lasers can be controlled to be the same or different, and no specific limitation is made here.
[0082] In one example, the laser control instruction can be initiated by the main program of the single-chip microcomputer or by a network device communicatively connected to the single-chip microcomputer. There is no limitation on the device that initiates the laser control instruction here, and it is subject to actual needs.
[0083] In one example, the number of received laser control instructions can be one or multiple. At this time, when the number of received laser control instructions is multiple, each laser control execution can be saved to the execution queue of the interrupt service according to the initiation order of each laser control instruction, so that when the interrupt service is executed, each laser control instruction is executed in sequence, thereby ensuring that the laser control instruction initiated first can be executed preferentially, and further ensuring the accuracy of the light-emitting state of the laser.
[0084] At this time, the execution queue includes the laser control instructions that have not been executed by the interrupt service, so that the interrupt server can perform control processing on the laser based on each laser control instruction included in the execution queue.
[0085] S202. Execute the interrupt service, and write the target data matching each laser control instruction into the target register in sequence according to the instruction initiation order of each laser control instruction.
[0086] In one example, the target data matching the laser control instruction is used to indicate the light intensity information. For example, the target data can be 0, 1, 2, 4, etc. Here, the value of the target data is not limited and is subject to the specific laser control instruction.
[0087] In one example, the target register is used to indicate the current digital-to-analog converter register. At this time, the received target data can be converted into an analog current signal through the target register, so as to control the light-emitting state of the laser. For example, the target register can be the IDAC register integrated in the single-chip microcomputer.
[0088] S203. Control the light-emitting state of the laser based on the target data sequentially stored in the target register.
[0089] Among them, the light-emitting state of the laser indicates the light intensity of the laser.
[0090] In one example, after converting the stored target data into an analog current signal based on the target register, the analog current signal can be sent to the laser, so as to drive the laser to emit light / turn off, and then realize the control of the laser.
[0091] From the above description, it can be seen that in the embodiment of the present application, after receiving the laser control instruction, in response to the received laser control instruction, each laser control instruction can be saved to the execution queue of the interrupt service, so that in the case of receiving multiple laser control instructions, based on the execution queue of the interrupt service, the execution order of each laser control instruction can be ensured, and the phenomenon of chaotic execution can be avoided, so as to ensure the accuracy of laser light emission. Then, the interrupt service can be executed, so that the single-chip microcomputer can execute the laser control instruction based on the interrupt service, that is, execute the interrupt service, and sequentially write the target data matching each laser control instruction into the target register according to the instruction initiation order of each laser control instruction, so as to control the light-emitting state of the laser based on the target data sequentially stored in the target register. This implementation method can combine the characteristics that the interrupt service in the single-chip microcomputer must be executed and the method of directly controlling the laser through the target register, which can not only meet the hardware timing requirements of the laser, but also realize the rapid control of the laser, thereby improving the control efficiency of the optical module including the laser and further improving the communication efficiency. At the same time, this implementation method also avoids controlling the laser through additional pins or interfaces, which not only saves hardware costs, but also broadens the application scenarios and scope of application of the laser.
[0092] See Figure 3 , Figure 3 is the flow schematic diagram of the laser control method provided by the embodiment of the present application Figure 2, such as Figure 3 shown, the method includes:
[0093] S301. Receive the main program of the single-chip microcomputer and / or the laser control instruction initiated by the network device.
[0094] In one example, the main program of the single-chip microcomputer indicates the firmware main program of the single-chip microcomputer. For example, when the firmware of the single-chip microcomputer detects that the temperature of the laser is too high, a laser control instruction can be initiated to turn off the laser.
[0095] In one example, the network device can indicate the device using the laser in the optical module. Here, the type of the network device is not limited and is subject to being able to achieve the function.
[0096] At this time, the network device can initiate a laser control instruction and transmit it to the single-chip microcomputer to control the light-emitting state of the laser through the single-chip microcomputer, so as to perform signal transmission. Among them, the communication method between the network device and the single-chip microcomputer includes but is not limited to the general-purpose input / output pin communication method. Here, the communication method between the network device and the single-chip microcomputer is not limited.
[0097] S302. Determine the interrupt service for executing the laser control instruction and set the execution priority of the interrupt service to the target priority.
[0098] In one example, the target priority indicates the lowest interrupt priority to avoid interrupting other interrupt services. For example, this interrupt service can be the PendSV (Pended System Service Call) service.
[0099] S303. In response to the received laser control instruction, save each laser control instruction to the execution queue of the interrupt service.
[0100] Among them, the laser control instruction is used to indicate the light intensity of the laser; the execution queue includes the laser control instructions that the interrupt service has not executed.
[0101] In one example, this step can refer to the content described in S201 above and will not be elaborated here.
[0102] S304. Execute the interrupt service and write the target data matching each laser control instruction into the target register in the order of the instruction initiation sequence of each laser control instruction.
[0103] During specific implementation, after executing the interrupt service and before writing the target data into the register, the control mode matching the laser control instruction can be determined based on the value of the target data. Herein, the control mode indicates the mode for controlling the laser to turn on or off. For example, if the value of the target data is the target value, it is determined that the control mode matching the laser control instruction indicates the mode for controlling the laser to turn off; if the value of the target data is not the target value, it is determined that the control mode matching the laser control instruction indicates the mode for controlling the laser to turn on. Herein, the target value can indicate that the light intensity corresponding to the laser is 0, so that the laser is in the off state. At this time, the target value can be 0.
[0104] Then, based on the control mode, the writing method of the target data is determined. Herein, the writing method indicates the stepped writing method or the direct writing method. The step value corresponding to the stepped writing method can be 1, or 2, or 3, etc. Here, the size of the step value is not limited.
[0105] Finally, according to the writing method of the target data, the target data matching each laser control instruction is sequentially written into the target register.
[0106] In an example, if the control mode indicates the mode for controlling the laser to turn on; then, the writing method of the target data determined based on this control mode is the stepped writing method. At this time, if, according to the writing method of the target data, the target data matching each laser control instruction is written into the target register, the cache value in the target register can be determined; in the case where the cache 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 stepped writing method. In the case where the cache value in the target register is equal to the target data, the process of writing the target data into the target register is omitted.
[0107] Exemplarily, refer to Figure 4 , Figure 4 which is a schematic flow chart for writing target data into a target register according to the stepped writing method provided by an embodiment of the present application. As Figure 4 shown, when it is determined to write the target data into the target register according to the stepped writing method, the cache value in the target register can be first determined, and then it is judged 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 cache value in the target register, the target data of this time is not written, that is, the writing is directly ended. If the value of the target data is not equal to the cache value in the target register, the steps described below can be executed in a loop.
[0109] It is possible to 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 value of the target data and the cached value is less than the step value (i.e., Figure 4 the difference between the two shown is less than the step value). If so, the target data can be directly written into 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 whether the difference between the value of the target data and the cached value is less than the step value. If so, the target data can be directly written into 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 the phenomenon of overcharging of the optical power of the laser.
[0113] In one example, if the control mode indicates a mode for controlling the laser to turn off; then, the writing method of the target data determined based on this control mode is the direct writing method. At this time, the target data can be directly written into the target register. For example, when the cached value in the target register is 5 and the value of the target data is 0, the value in the target register can be directly updated to 0, thereby accelerating the speed of turning off the laser and improving the efficiency.
[0114] Or, when the control mode indicates a mode for controlling the laser to turn off, the determined writing method of the target data can also be the step-by-step writing method to write the target data into the target register in the step-by-step writing method, so as to gradually reduce the light intensity of the laser until it turns off, avoiding the situation of sudden change in the light intensity of the laser.
[0115] S305. Control the light-emitting state of the laser based on the target data sequentially stored in the target register.
[0116] Among them, the light-emitting state of the laser indicates the light intensity of the laser.
[0117] In one example, the content described in the above S203 can be referred to for this step, and details will not be repeated here.
[0118] See Figure 5 , Figure 5Flow schematic of the laser control method provided by the embodiments of the present application Figure 3 , such as Figure 5 shown, the method includes:
[0119] S501. In response to the received laser control instruction, save each laser control instruction to the execution queue of the interrupt service.
[0120] Among them, the laser control instruction is used to indicate the brightness intensity of controlling the laser; the execution queue includes the laser control instructions not executed by the interrupt service.
[0121] S502. Determine whether the laser control instruction controls a single laser.
[0122] If so, execute the steps described in S503 below; if not, execute the steps described in S504 below.
[0123] S503. Execute the interrupt service, and in the order of the instruction initiation of each laser control instruction, sequentially write the target data matching each laser control instruction into the target register.
[0124] S504. Execute the interrupt service, and in the order of the instruction initiation of each laser control instruction, write the target data matching each laser control instruction into the target register corresponding to each laser.
[0125] In an example, see Figure 6 , Figure 6 is a schematic diagram of the application scenario where the laser control instruction provided by the embodiments of the present application is used to control multiple lasers. As Figure 6 shown, this scenario may include a single-chip microcomputer, a network device, and a laser array. As Figure 6 shown, the laser array may include 4 lasers. At this time, the single-chip microcomputer may also include 4 target registers, and each target register can correspond to a laser to control the light-emitting state of the corresponding laser.
[0126] At this time, the laser control instruction initiated by the single-chip microcomputer and / or the network device can be received, and each laser control instruction is saved to the execution queue of the interrupt service. Then, the interrupt service can be executed to sequentially write the target data matching each laser control instruction into the target register corresponding to each laser in the order of the instruction initiation of each laser control instruction. Then, based on the target data sequentially saved in the target register, the light-emitting state of the laser is controlled.
[0127] In this implementation manner, when it is necessary to control multiple lasers, the target data matching the laser control instruction can be written into the target registers corresponding to the respective lasers, which can ensure the consistency and efficiency of controlling each laser.
[0128] S505. Control the light-emitting state of the laser based on the target data sequentially stored in the target register. Among them, the light-emitting state of the laser indicates the light intensity of the laser.
[0129] Those skilled in the art can understand that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order and does not constitute any limitation to the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0130] Figure 7 FIG. is a schematic structural diagram of a control device for a laser provided by an embodiment of the present application. As Figure 7 shown, the control device 700 for the laser includes:
[0131] A response unit 701, configured to save each laser control instruction to the execution queue of the interrupt service in response to the received laser control instruction; wherein, the laser control instruction is used to indicate the control of the light intensity of the laser.
[0132] A writing unit 702, configured to execute the interrupt service and sequentially write the target data matching each laser control instruction into the target register according to the initiation order of each laser control instruction.
[0133] A control unit 703, configured to control the light-emitting state of the laser based on the target data sequentially stored in the target register; the light-emitting state of the laser indicates the light intensity of the laser.
[0134] Figure 8 FIG. is a schematic structural diagram of another control device for a laser provided by an embodiment of the present application. As Figure 8 shown, the control device 800 for the laser includes:
[0135] A response unit 801, configured to save each laser control instruction to the execution queue of the interrupt service in response to the received laser control instruction; wherein, the laser control instruction is used to indicate the control of the light intensity of the laser;
[0136] A writing unit 802, configured to execute the interrupt service and sequentially write the target data matching each laser control instruction into the target register according to the initiation order of each laser control instruction;
[0137] A control unit 803, configured to control the light-emitting state of a laser based on the target data sequentially stored in a target register; the light-emitting state of the laser indicates the light intensity of the laser.
[0138] In one example, a writing unit 802 is configured to:
[0139] Determine a control mode matching a laser control instruction based on the value of the target data; wherein, the control mode indicates a mode for controlling the laser to turn on or off;
[0140] Determine a writing method of the target data based on the control mode; wherein, the writing method indicates a step-by-step writing method or a direct writing method;
[0141] Write the target data matching each laser control instruction into the target register according to the writing method of the target data.
[0142] In one example, the writing unit 802 includes a determining module 8021, configured to:
[0143] If the value of the target data is a target value, determine that the control mode matching the laser control instruction indicates a mode for controlling the laser to turn off;
[0144] If the value of the target data is not the target value, determine that the control mode matching the laser control instruction indicates a mode for controlling the laser to turn on.
[0145] In one example, the writing unit 802 includes a writing module 8022, configured to determine a cache value in the target register when the control mode indicates a mode for controlling the laser to turn on and the writing method indicates a step-by-step writing method;
[0146] If the cache value in the target register is not equal to the value of the target data, write the target data into the target register according to the step-by-step writing method.
[0147] In one example, the device further includes a receiving unit 804, configured to:
[0148] Before responding to the received laser control instruction, receive a main program of a single-chip microcomputer and / or a laser control instruction initiated by a network device.
[0149] In one example, the device further includes a setting unit 805, configured to:
[0150] Before saving each laser control instruction to an execution queue of an interrupt service in response to the received laser control instruction, determine an interrupt service for executing the laser control instruction and set an execution priority of the interrupt service to a target priority.
[0151] In one example, a writing unit 802 is configured to:
[0152] When the laser control instruction is used to control multiple lasers, write the target data matching each laser control instruction into the target register corresponding to each laser.
[0153] The control device of the laser provided in this embodiment can execute the laser control method provided in the above method embodiment. The implementation principle and technical effects are similar, and will not be elaborated here.
[0154] See Figure 9 , Figure 9 which is a schematic structural diagram of an optical module provided in an embodiment of the present application. As Figure 9 shown, the optical module includes: a laser, and a control device of the laser.
[0155] Figure 10 which is a schematic structural diagram of a computer device provided in an embodiment of the present application. As Figure 10 shown, the computer device 1000 includes: a memory 1001, and a processor 1002.
[0156] The memory 1001; a memory for storing computer-executable instructions executable by the processor 1002.
[0157] Wherein, the processor 1002 is configured to execute the computer-executable instructions stored in the memory 1001 to implement the method provided in the above embodiment.
[0158] The computer device further includes a receiver 1003 and a transmitter 1004. The receiver 1003 is used to receive instructions and data sent by an external device, and the transmitter 1004 is used to send instructions and data to the external device.
[0159] The present application also provides a computer-readable storage medium. Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the methods provided in the above various embodiments.
[0160] Among them, the computer-readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of computer-executable instructions from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, the computer-readable storage medium is coupled to the 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 be located in an Application Specific Integrated Circuits (ASIC). Additionally, the ASIC can be located in the user equipment. Of course, the processor and the computer-readable storage medium can also exist as discrete components in the 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 memory, flash memory, a magnetic disk, or an optical disk. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0162] The present application also provides a computer program product, which includes 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 execution of the computer-executable instructions by at least one processor causes the computer device to implement the methods provided by the above various embodiments.
[0163] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is only a logical function division. In actual implementation, there can be other division methods. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections between each other can be through some interfaces. The indirect couplings or communication connections of devices or modules can be in electrical, mechanical or other forms.
[0164] Among them, each module can be physically separated. For example, it can be installed at different positions of a device, or installed on different devices, or distributed to multiple network units, or distributed to multiple processors. Each module can also be integrated together. For example, it can be installed in the same device, or integrated in a set of code. Each module can exist in the form of hardware, or can also exist in the form of software, or can also be implemented in the form of software plus hardware. The present application can select some or all of the modules according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] When the integrated modules are implemented in the form of software function modules, they can be stored in a computer-readable storage medium. The above-mentioned software function modules stored in a storage medium include several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute some steps of the methods in various embodiments of the present application.
[0166] It should be understood that although the steps in the flowcharts in the above embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and they can be executed in other orders. Moreover, at least some of the steps in the figure can include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same moment, but can be executed at different moments, and their execution order is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
[0167] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include well-known knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and examples are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.
[0168] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. A control method for a laser, characterized in that, Including: In response to the received laser control instruction, saving each of the laser control instructions to an execution queue of an interrupt service; wherein, the laser control instruction is used to indicate controlling the light intensity of a laser; the execution queue includes laser control instructions that have not been executed by the interrupt service; Executing the interrupt service, and sequentially writing target data matching each of the laser control instructions into a target register according to the instruction initiation order of each of the laser control instructions; Based on the target data sequentially saved in the target register, controlling the light emission state of the laser; wherein, the light emission state of the laser indicates the light intensity of the laser.
2. The method according to claim 1, wherein Writing the target data matching each of the laser control instructions into the target register includes: Based on the value of the target data, determining a control mode matching the laser control instruction; wherein, the control mode indicates a mode of controlling the laser to turn on or off; Based on the control mode, determining a writing method of the target data; wherein, the writing method indicates a step-by-step writing method or a direct writing method; According to the writing method of the target data, writing the target data matching each of the laser control instructions into the target register.
3. The method according to claim 2, characterized in that Based on the value of the target data, determining a control mode matching the laser control instruction includes: If the value of the target data is a target value, determining that the control mode matching the laser control instruction indicates a mode of controlling the laser to turn off; If the value of the target data is not the target value, determining that the control mode matching the laser control instruction indicates a mode of controlling the laser to turn on.
4. The method according to claim 2, characterized in that The control mode indicates a mode of controlling the laser to turn on; the writing method indicates a step-by-step writing method; writing the target data matching each of the laser control instructions into the target register according to the writing method of the target data includes: Determining a cache value in the target register; In a case where 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 method.
5. The method according to claim 1, characterized in that Before responding to the received laser control instruction, the method further includes: Receiving a main program of a single-chip microcomputer and / or a laser control instruction initiated by a network device.
6. The method according to claim 1, characterized in that, Before saving each of the laser control instructions to the execution queue of the interrupt service in response to the received laser control instruction, the method further includes: Determining an interrupt service for executing the laser control instruction, and setting an execution priority of the interrupt service to a target priority.
7. The method according to any one of claims 1-6, characterized in that, The laser control instruction is used to control multiple lasers; writing the target data matching each of the laser control instructions into the target register includes: Writing the target data matching each of the laser control instructions into a target register corresponding to each of the lasers.
8. A control device for a laser, characterized in that, Including: A response unit, configured to save each of the laser control instructions to an execution queue of an interrupt service in response to the received laser control instructions; wherein, the laser control instructions are used to indicate controlling the light intensity of a laser. A writing unit, configured to execute the interrupt service and sequentially write target data matching each of the laser control instructions into a target register according to the initiation order of each of the laser control instructions. A control unit, configured to control the light-emitting state of the laser based on the target data sequentially stored in the target register; the light-emitting state of the laser indicates the light intensity of the laser.
9. An optical module, characterized in that, The optical module includes: a laser, and a control device of the laser as claimed in claim 8.
10. A computer device, characterized in that, Comprising: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method for controlling a laser as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Cascade control method of cascade equipment, the cascade equipment and illumination system
CN110708793A
Automatic debugging method and device for optical module
CN112564787A
Motion control method, device and equipment in desktop intelligent laser equipment
CN116414083A
Detector control method and device, storage medium and laser radar
CN116930911A
Temperature and jitter compensation controller circuit and method for fiber optics device
US20040091005A1