khangzing
Full Member level 2
- Joined
- Feb 22, 2013
- Messages
- 123
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Activity points
- 2,148
is this circuit having any problems?
and i'm using this code to modulate the signal to get 38khz
#include <PIC.h>
void main()
{
CCP1CON = 0X08; //select PWM mode.
PR2 = 124; //Set period register for approx. 38khz.
CCPR1L = 62; //Set duty cycle for approx 50%
T2CON = 0X04; //Set timer2 pre/post scalers to 0 & start Timer2.
PORTC = 0x12;
TRISC2 = 0; //pin 17 of 16F877A DIP package.TRISC.2
//will act as enable/disable for PWM output
}
or
list p=16F877a
#include "p16f877a.inc" ;include the defaults for the chip
count equ 10
IR_PORT Equ PORTC
IR_TRIS Equ TRISC
IR_Out Equ 0x01
Start bsf STATUS, RP0 ;select bank 1
movlw b'00001111' ;set PortC 1st 4 bits outputs, next 4 bits input
movwf IR_TRIS
TX_Start movlw d'92'
call IR_pulse
IR_pulse
MOVWF count ; Pulses the IR led at 38KHz
irloop BSF IR_PORT, IR_Out
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
BCF IR_PORT, IR_Out
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP
NOP
NOP ;
NOP ;
DECFSZ count,1
GOTO irloop
RETLW 0
end
i tried to connect the sensor and microcontroller without the voice chip but it seem doesn't work....can anyone verify for me?@@
and i'm using this code to modulate the signal to get 38khz
#include <PIC.h>
void main()
{
CCP1CON = 0X08; //select PWM mode.
PR2 = 124; //Set period register for approx. 38khz.
CCPR1L = 62; //Set duty cycle for approx 50%
T2CON = 0X04; //Set timer2 pre/post scalers to 0 & start Timer2.
PORTC = 0x12;
TRISC2 = 0; //pin 17 of 16F877A DIP package.TRISC.2
//will act as enable/disable for PWM output
}
or
list p=16F877a
#include "p16f877a.inc" ;include the defaults for the chip
count equ 10
IR_PORT Equ PORTC
IR_TRIS Equ TRISC
IR_Out Equ 0x01
Start bsf STATUS, RP0 ;select bank 1
movlw b'00001111' ;set PortC 1st 4 bits outputs, next 4 bits input
movwf IR_TRIS
TX_Start movlw d'92'
call IR_pulse
IR_pulse
MOVWF count ; Pulses the IR led at 38KHz
irloop BSF IR_PORT, IR_Out
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
BCF IR_PORT, IR_Out
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP ;
NOP
NOP
NOP ;
NOP ;
DECFSZ count,1
GOTO irloop
RETLW 0
end
i tried to connect the sensor and microcontroller without the voice chip but it seem doesn't work....can anyone verify for me?@@