This application provides a communication method, apparatus, medium, and
system for a general-purpose input / output port. The method includes: a first device determining first communication information to be sent and querying a first mapping table to determine a first
duty cycle corresponding to the first communication information; encoding the first communication information into a first pulse
signal according to the first
duty cycle; sending the first pulse
signal to a second device; and the second device sending a second pulse
signal to the first device, wherein the second pulse signal is obtained by the second device encoding the second communication information according to a second
duty cycle corresponding to the second communication information to be sent. Embodiments of this application
encode information using different duty cycles, thereby achieving differentiation between multiple instructions and multiple states. This application can solve the problems that general-purpose input / output ports cannot differentiate information or
encode multiple instructions and multiple states, enabling general-purpose input / output ports to support bidirectional, multi-instruction, and multi-state data interaction.