PIC16F628A Need to Generate 38.3KHZ PWM Burst of 10ms for TSOP1838

Status
Not open for further replies.

asking

Full Member level 5
Joined
Sep 21, 2010
Messages
279
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Visit site
Activity points
3,377
Hello

I am using MikroC Code for generating PWM signal Code is :-
Code:
void main()

{
     TRISB = 0;  // pins are output, GP3 always input
     PWM1_Init(38000);
     PWM1_Start();
     PWM1_Set_duty(120);
while(1){}

}

I got the 38.2KHZ signal of PWM on my CRO. I need Burst of 38.3KHZ signal with 10ms gap. How to generate it ? is it possible with one microcontroller or do i need to use external switch to on/off signal from MCU ? Please help me.
 

hi
it's possible to do this with only microcontroller
you can try this

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
void main()
{
     TRISB = 0;  // pins are output, GP3 always input
     PWM1_Init(38000);
     PWM1_Set_duty(120);
     while(1)
     {
         PWM1_Start();
         Delay_ms(10);
         PWM1_Stop();
         Delay_ms(10);
     }
}


if you are doing other things too in the code, it probably is a good idea to move the PWM part in timer interrupts
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…