Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ASK generation using pic microcontroller

Not open for further replies.


Member level 3
May 17, 2012
Reaction score
Trophy points
Activity points
Hi,somebody know how to generate Amplitude Shift Keying using pic microcontroller? Is it possible ?
If yes then how? I don't want the code, I just want know the possible logic ?

If some body have the knowledge, please share with me?
It will be very helpful for me and maybe others!


Yes it is possible.

If you want 100% amplitude keying, use the TRIS bit to make the pin an input or output. Input mode will generate no signal, output mode will generate 100% signal.

If you want less than 100% modulation there are several ways to do it:
1. If the PIC has a DAC, you can use it as a programmable potentiometer.
2. You can use a pin as a level switch, drive it low and use it's TRIS bit to ground the lower resistor in a potential divider. In other words switch the lower resistor in and out of circuit so it's effect as an attenuator is turned on and off.
3. If your signal is software generated you may be able to control it's amplitude by calculation.
4. If you use PWM you can generate an analog voltage which you can then use to control the amplitude.

Some PICs have built in signal modulators which you can use to advantage.


it should be possible using a DAC (digital to Analogue Converter)
generate a sine wave (from a look up table) and vary the amplitude to represent digital values
or you could use a DDS chip

what frequency are you planing to transmit?

thanks for your reply!!
Actually I don't understand, how to calculate the carrier and the data frequency. Is there any formula or I can chose randomly carrier and the data frequency?

"don't understand how to calculate"? I was thinking up to now that data rate and carrier frequency are commanded by the application. What's your application?

"don't understand how to calculate"? I was thinking up to now that data rate and carrier frequency are commanded by the application. What's your application?

"don't understand how to calculate" means how to calculate the perfect carrier frequency for the particular data rate. my application is to make a simple RF transmitter which is based on pic micro-controller.
actually I try to make a ASK generator in proteus, there I found that phase of the carrier didn't match with the data bits,that's why I think is it possible to make ASK signal using microcontroller.
here is the circuit-
circuit.jpg simulate.jpg

A PIC microcontroller can't generate RF frequencies beyond a few MHz.

All your schematic shows is an analog switch. You can generate the carrier and the modulation using any method you like. They do not have to be phase related although nothing stops you from syncing the modulation to the carrier if you want to.

The golden rule is the carrier must be at LEAST twice the modulation frequency (at least 2 cycles of carrier per bit), in practise it is best for it to be many times higher. As FvM points ut, the actual frequencies depend entirely on your aplication. For example, my TV remote control uses a 38KHz carrier and about 200 bits per second, one of my data links uses a 29GHz carrier and 27 Megabits per second modulation rate.

You probably don't want to generate the carrier from a PIC if the frequency is more than a few hundred KHz or you risk instability as your software takes different routes through your program. You should be fine generating data which normally isn't as critical of speed and at much slower rate.


Not open for further replies.

Part and Inventory Search

Welcome to