Abstract: The present invention relates to a method for generating pulse trains by means of a microprocessor, consisting of generating an envelope signal by means of a timer which is programmable by a CPU, the width of a square wave of the envelope signal corresponding to the width of the pulse trains, generating a carrier signal having a predetermined frequency, and modulating the envelope signal with the carrier.