Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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.

Generate 38KHz signal using pic 16F877A

Status
Not open for further replies.

rado

Member level 2
Member level 2
Joined
Feb 15, 2014
Messages
42
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
293
friends,
how to generate a 38khz pulse signal ,to operate the IR LED using pic16f877a?
i need a code for micro c:-|
 

what is the frequency of the pic ?
what is the language you would use ?
what is the tolerance for the 38KHz ?
 

hello Kripton ,
The maximum operating frequency is 20MHz and i uses an 8MHz crystal oscillator.
language is c
tolerance , i couldn't understand it , could you please explain it?
 

Something like this maybe?

Code:
// simple 38 kHz PWM generation for PIC16F877A
// check PWM library selection in IDE
// PWM output is on RC2
// ensure oscillator settings are correct in mikroE configuration settings

void main() {

    PWM1_Init(38000);             // turn on PWM at 38kHz
    PWM1_Set_Duty(128);           // 50% duty cycle
    
    // simple test program - 500 Hz modulation on 38kHz carrier
    while(1){                     // loop forever
        PWM1_Start();             // 38kHz turned on
        Delay_ms(1);
        PWM1_stop();              // 38kHz turned off
        Delay_ms(1);
    }
}
 
Last edited:

yes Krypton ,i need a 38khz signal to operate the IR led as per data.

And also thanks Hexreader, I will try this code and reply.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top