|
|
|
|
|
This is a simple software routine showing how to generate 40KHz PWM on any I/O-pin. Use this for any PIC that doesn't have internal hardware PWM option or if you need to use PortB.3 for other purposes other than PWM generation. This example uses PortB.1, but can be changed to use any I/O-pin on the PIC that can output high & low signals. Using IR_IN = PortB.0 immediately reads the status of the IR detector output pin connected to PortB.0 after the carrier generation routine has completed, and before the IR detector output pin changes state.
|
||
|
||
|
You can also cut & paste the Pulse routine into other code. Then load the number of 40KHz carrier cycles required into byte variable NumCycles, use GOSUB to branch to the routine and generate the number of 40KHz carrier cycles loaded into NumCycles. Useful for communicating with consumer infrared electronics such as televisions, vcrs, and much more.
|
||
|
Copyright © 2007
Reynolds Electronics |
||