24 Threads found on edaboard.com: Delay Function Timer Pic C
Here the example of C18 MPLAB compiler code to generate delay using timer 0:
I want to write the same code using CCS compiler without using built in (...)
Microcontrollers :: 06.03.2010 03:50 :: manrayap :: Replies: 2 :: Views: 1773
Hi. pic12F629 works from 2.0V to 5.5V. You can use delay function of C compiler or timer(if you want precise pulse with)
Microcontrollers :: 19.07.2005 08:45 :: petarpav :: Replies: 12 :: Views: 1366
The timer in 16F84 is 8-bit, so it can count only up to 255. With a clock of 4MHz (1MIPS carryout), you can only have a delay of 256 microsecond. Prescale that to 256, and you get 65.5ms. So you need to check for the delay MANY times. It does not seem feasible.
So, I think you should use a software loop for the 8-hour (...)
Microcontrollers :: 08.04.2010 13:23 :: Tahmid :: Replies: 2 :: Views: 769
Hai experts ,
i want to know how to create one second delay in 89s52 IDE is Keil ?
please give the calculation if you have thanks
PC Programming and Interfacing :: 02.07.2011 09:15 :: thannara123 :: Replies: 8 :: Views: 3606
Please check my code and circuit.
Question is that I want to make digital clock 4-digits for Hours and Minutes.The minutes digit increase after every 60 secs and hour digits increase after every 60 mins but problem is that if i add delay() function for 1 sec the display off and on and cannot display without flickering how to avoid this problem.
Microcontrollers :: 01.12.2012 09:15 :: imranahmed :: Replies: 9 :: Views: 934
if precision is not necessary you can use delay loops...or you can use clock ic like ds1307..but you can do this easily 16f628(timer1 working in32.768khz)...
Microcontrollers :: 23.12.2004 17:09 :: olemp :: Replies: 8 :: Views: 5498
Hello guys, i am newbie here, was doing a project regarding infrared sensor autogate...
what i wish to ask is how to write the command for the situation stated below?
When a IR receiver received a signal from IR transmitter for more than 3 sec, only the DC motor will move CW or CCW? else, the motor will be remained sta
Microcontrollers :: 23.08.2008 17:48 :: keigo911 :: Replies: 4 :: Views: 804
You can put output from encoder to interrupt pin and detect state change. So you can meassure time between pulses to get rpm and use PID algorithm for motor speed control.
You can also put timer on overflow on 1/10s and count number of pulses in that time period to calculate RPM. In this manner you will have time delay of 1/10s for feedback but in
Hobby Circuits and Small Projects Problems :: 27.02.2009 15:45 :: ScOe :: Replies: 11 :: Views: 2500
i am trying to use AT25256 SPI eeprom with pic 16F917. i thing the bug is in read function. The SPI clock and DATA is visible on CRO. i am not sure if it is correct. do not have a deep memory scope.
can some one please help.
this is the code in main()
# include "pic_function.h"
# include (...)
Microcontrollers :: 03.04.2009 14:30 :: hock :: Replies: 1 :: Views: 1593
Try this this delay works with timer 0 and generate for 1 second and for your delay just change the values of TL0 and TH0, and check the result in performance analyzer in keil....
void timer() // timer function
unsigned int loop;
for(loop=0;loop<=40;loop++) //for 1sec.
Microcontrollers :: 14.01.2011 03:43 :: Sharath411 :: Replies: 9 :: Views: 460
first of all the built in delay functions are not accurate.the same case with internal oscillator also because the atmosphere can change the frequency of the internal oscillator.if you want accurate delay of 1 second,use external oscillator and timer.
Microcontrollers :: 11.02.2011 04:48 :: microlab :: Replies: 4 :: Views: 1621
I may be offtopic, but is not a good practice to use delay to perform a wait function.
There is prefereable to use a timered interrupt flag instead.
This concept ( is not, but ) is somethink more close to multitask processing, sometimes called time slot.
Microcontrollers :: 02.04.2011 15:10 :: andre_teprom :: Replies: 10 :: Views: 1258
To genarate pulse for servo, need PWM at 50Hz. pic16 can't use PWM module.
Use delay function also, not good for many servo.
you can generate PWM using timer Interrupt. See example servo.
You can use Servo Controller that use UART to set servo position like this product, [URL="ht
Microcontrollers :: 19.10.2011 18:37 :: engshahrul :: Replies: 20 :: Views: 3896
I prefer the polling method, use a timer to check a few times per second if anything has been pressed, as a bonus there is no need to debounce the keys.
Note what I said, all you need is to check 5-10 times per second, you have an mcu that can execute millions of instructions so having it spend a hu
Microcontrollers :: 01.11.2011 14:26 :: alexan_e :: Replies: 9 :: Views: 503
i try to read ADC at pin AN0 from a potentiometer and display the digital measurement.the max output voltage of the potentiometer is 5V and to get the digital measurement=vin/5x1023...but then at my lcd show measurement 255 instead 1023. from datasheet, the pic is 10 bit. please explain to me why this happen???
Microcontrollers :: 15.04.2012 15:22 :: papunblg :: Replies: 3 :: Views: 1756
If you aren't going to be doing anything during that long period, you can use software delay, using the delay_ms() function and for loop.
If you are going to be doing something during that period, you need to use timer as Oyvind has said.
I don't know which pic you'll be using. But you can use (...)
Microcontrollers :: 10.06.2012 12:24 :: Tahmid :: Replies: 11 :: Views: 950
Give some delay after the lcd_init() function.
This gives some time for the LCD to initialize.
About 10ms-50ms would be enough.
This us usually the problem when we see the LCD fully lit up with all black rectangles.
PC Programming and Interfacing :: 10.01.2013 00:23 :: nitishn5 :: Replies: 4 :: Views: 650
i want to make a digital clock, for which i have written my code on 8051 micro controller, now when i simulate my code on Proteus, it gives the error and not working properly. i am attaching my code and Proteus pic with this post. please help me..
sbit dig_ctrl_4=P1^0; //Declaring control pins of the
Microcontrollers :: 29.03.2013 14:17 :: abhishekdixit :: Replies: 1 :: Views: 458
Is it true that adding one more data byte stops USB device operation? I rather guess it's the call to commandServoToAngle1(), that further increases software latency and possibly exceeds the maximum allowed delay to service the USB.
The delay loops are a "rusty" method to generate servo pulses, you should better think of a solution based on har
Microcontrollers :: 26.05.2013 14:58 :: FvM :: Replies: 4 :: Views: 434
pre scale a timer and start it at the beginning of the program.
read the overflow bit in the ISR.once overflow happens jump to your subroutine.if the timer value loaded is not enough, write a logic in the ISR such a way that it makes up the delay you wanted.
Microcontrollers :: 19.05.2007 08:53 :: cameo_2007 :: Replies: 3 :: Views: 750
PWM is normally used for speed control od if you wnat to generate for that purpose then good PWM frequency will be 1KHz or more.....now its simple to write a C program for pic using timer to generate variable pulse widths controlling speeds...
you can also use ur own made function for time delay.....
here is a general (...)
Microcontrollers :: 03.07.2008 04:41 :: viperpaki007 :: Replies: 1 :: Views: 520
I have a assembly with a temperature sensor.
is another problem. The picture is attached to my display. no temperature.
problem is the source code? I can help someone
the code is :
//program for temperature monitoring system written for pic16F877A //
//author: keshava murali //
//bellow 30sC LED switches OF
Microcontrollers :: 26.05.2010 03:51 :: r3stles :: Replies: 0 :: Views: 1317
Dear spiba, this is not the practical way of writing a code for 50hz inverter, it involves much more critical math calculation and different technique to perform the job properly. As you ask how to start, this is an example to get 50hz squire wave with 50% duty cycle. On the second question, no you do not have to used pwm/ccp but most people will u
Power Electronics :: 08.01.2012 07:13 :: MRahman :: Replies: 2 :: Views: 1115
I tried to write this code, but can't see LED blinking on pic
Do you know why ?
#pragma config FOSC = INTOSCIO_EC //Internal oscillator, port function on RA6, EC used by USB
#pragma config WDT = OFF //Disable watchdog timer
Microcontrollers :: 07.05.2012 01:41 :: bianchi77 :: Replies: 14 :: Views: 632