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.
this is the code i developed by myself,is that ok?
#include <pic.h>
#define _XTAL_FREQ 20000000
void pwm_init(void);
void timer_init(void);
int counter;
void main()
{
int i;
pwm_init();
timer_init();
TRISC2=0;
while (1){
CCPR1L=0;
__delay_ms(351);
CCPR1L=65...
So I load tmr0=0 something like that to start timer 0 and then how to reload the timer in that line u mentioned?the isr loop no need to call?it will call itself?
after that consider finished? but when i program and transfer to pic,i connect to cro the rc2 pin doesn't give square wave at all...
reloading mean just called the function name? for example:
void interrupt Timer0_ISR(void)
{
// check and reset interrupt flag
if( ++j > 3 )
j = 0...
#include <pic.h>
#define _XTAL_FREQ 20000000
#define OFFSET 117 // You can vary this and try
//Timer0
//Prescaler 1:1; TMR0 Preload = 124; Actual Interrupt Time : 26.3 us
void pwm_init(void);
void timer_init(void);
void interrupt Timer0_ISR(void);
void display(void);
int i,j,counter...
quite confused...is this in hi-tech universal toolsuite?
can i use this step?
1. Set PWM Duty Cycle to 0%
2. Delay 500ms
3. Set PWM Duty Cycle to 50%
4. Clear counter
5. Check if counter > 120, handle no result, repeat from start
(If counter is > 120 then 120ms have elapsed...
the case 0 is for what?offset is what...?can i use timer 0 to interrupt for 200ms?but why 200ms?and i don't understand about the j...Do timer Reloadings mean reload the timer?
void display(void) {
RD1 = RD2 = 0;
if(i<OFFSET)
RD1=1;
else
RD2=1;
__delay_ms(400);
RD1 = RD2 = 0;
}...
i check with the cro when my hand is about 10cm away from the detector, the wave changed..
you mean when i start send square wave, and when output of receiver is low,start the timer and count the time?
i panic already,don't know how to proceed...and i only manage to detect 10-15cm...zzz...
with the code u given can u give me the full code?i got no idea about it -.-
#include <pic.h>
#define _XTAL_FREQ 20000000
//Timer0
//Prescaler 1:1; TMR0 Preload = 124; Actual Interrupt Time : 26.3 us...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.