Search Engine

Delay Function Timer Pic C

Add Question

1000 Threads found on Delay Function Timer Pic C
hi, im using the timer newly and i dono how to create a delay value for 1sec. please anyone help me how to program or what the value i should need to give for the timer registers. and im using a 12MHz crystal.
Dear Friends, I am using pic16F1829 and XC8 compiler. I am using external crystal of 4MHZ. I am just trying to blink an LED for every 2 seconds. I have used __delay_ms(2000); function to generate 2 seconds of delay.Also before the main i have included _XTAL_FREQ 4000000 Compiler is not giving any (...)
hi, 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.. #include sbit dig_ctrl_4=P1^0; //Declaring control pins of the
Hello everybody I'm facing with a problem in my H bridge design. I am using pic 18F45K20 Microchip Controller along with BJT tranzistors to make a servo direction for a 5V motor. Everything is fine but i can't get around with C code for microcontroller. I'm using C18 Compiler. I want to get the signal from a switch on the development
Hi, Change your delay function and write with simple logic, don't use timer for delay like this. For Ex. used delay function like void delay_1s() { unsigned int i = 0, j = 0; for (i=0; i<20; i++) { for(j = 0; j < 50000; j++); } } Here change 50000 value up or down (...)
"_CONFIG()"; and " __delay_ms();" supported by htc compiler the hi tech C compiler to enable these function.. or u can make delay function by yourself.
Hi, Can somebody guide me how to generate 500 ms delay using any of the timer like timer 0 or timer 1 of ATMEGA8.
I also faced this same problem .. There was problem in compiler I think so.. check weather it is working or not delay using for loop..
several way to create delay function . but best way is using _nop_() instruction and count cycle using stop watch to get better result . For small delays, such as around few micro seconds, no problem. However, for somewhat on magnitude of mili seconds and higher, this implementation waste excessive computer processin
Please let me know that can we generate different time delays using timer interrupt of AVR series uC`s for several functions?
hello, your ISR interrupt does nothing ! Maybe it is more interresting to use timer0 (or other timer) interrupt to count elementary delay and use ADC reading to do PORTD output every with : ADC value * elementary timing or directly use 255-Adc_value (8bits) for TMR0 target. to elaborate the delay..
You used 556 in ordrer to produce the two timing 500ms and 1s? Why not using a crystal instead? I support the μC option, it is cheap but if you don't how to use it and you have to learn turn either to a quick learning μC-I suggest motorolas HC05 or Atmels905-. On the other hand logic design is a quick, cheap and convinient idea as Elavio
Hi, I found a simple program for calculate a time delay for 8051 uc. I write simple blink program too to test this program. It's just a led blink every 1s (1000000 us) I used the delay routine generated from above program. It very helpful for beginner. Program+Blink Example in ASM and Proteus here. Bye Pharaoh Of Egypt
Hi Fragrance Extract from 16F88 datasheet p.3 ? Internal oscillator block: - 8 user selectable frequencies: 31 kHz, 125 kHz, 250 kHz, 500 kHz, 1 MHz, 2 MHz, 4 MHz, 8 MHz Output oscillation isnt stable, PbP seems not to reset wdt when delay function are used, i will try to disable the dog
have you looked what codevision help say about delay...? codevision have build in delay function. #include <delay.h> . . . while(1) { delay_us(100); //100 micro second delay //do something; delay_ms(10); // and 10 ms delay //do something else; (...)
Using calculator "delay" function. You should point input threshold, output threshold and input and output edge type (rising or falling) and edge number. Then you can plot this expression or print in ascii file.
Program the timers to interrupt at its longest reload values, then at the interrupt service routine, increment a variable, if the variable matches your desired time delay, then excute your desired subroutine.
I which OS? Most of PC have hardware high-resolution performance counter. In windows OS you can access to counter with 2 API functions: BOOL QueryPerformanceCounter( LARGE_INTEGER *lpPerformanceCount // address of current counter value ); BOOL QueryPerformanceFrequency( LARGE_INTEGER *lpFrequency // add
Can anybody tell me exactly what is a Watch Dog timer?
u can find it in the system-passive menu in the components palet time dely wish this help , or u can add the TL with electrical length crossponding to the time delay wish this help khouly
I dont know 89S52, but may be it will be helful for you : scanf most probably works in blocking mode - that means it will wait till something will be read from port. What you have to do to avoid that : a. write your own ISR with ring buffer for character reading from UART b. implement nonblocking read from reception ring buffer (see a) c. imp
hi i want to plot Nyquist diagram of below system (that has "delay function") in MATLAB: G(s)H(s)=(e^(-2s))/(s+1) that G(s)H(s) is the OPEN LOOP TRANSFER function. is it possible to plot its Nyquist diagram. thanks in advance, Mostafa
Hi! it should be something like this unsigned char data=0; TRISF = 0XFF; //ALL PINS OUTPUTS while(1) { PORTF=data++; if(data==0xff) data=0; delay(); } void delay(void) { unsigned int i; while(++i!=1000); } I have assumed that u are programming in C. It can also be done in assembly quite easily
I am programming a delay function using ARM7. I simply use a while loop to waste the time. Which clock speed determines the time to run a loop in the microcontroller? Thanks!
Hi All, For one of our product, there are two 48 V pumps used. Both pumps are getting 48V from the same power supply. The inrush current per pump is around 3.14A. Since both pumps are on simultaneously, the inrush current wil shoot up more than 6A. For this reason, I want to make one pump on and after say 1second the second pump has to become on.
I think the problem that the unsigned int range is 0-65535 while you send for the delay function the value 120000 which makes an overflow and the value seen by the processor is 54464 which is translated into 54.464 seconds so to overcome this problem you could replace the delay (120000); with 2 calls to the delay each with (...)
Hi all, I'm a begginer in pic18F programming (I started yesterday ), I'm using Microchip C18 compiler in MPLAB, I compiled some simple programms that I found in the C18 getting started from Microchip web site 5f.pdf like this one for led flashing: #include #pragma
What is a Bessel function? What it says, and where it is used espacially in Electronics Engineering I suppose,you are asking in context with lowpass filter transfer functions, don´t you ? Well, opposite to the well known Butterworth approximation with a maximally flat AMPLITUDE response sometimes one is interested in a max
delay_ms('i'); ??????? maybe delay_ms(i); or maybe declare it??? void main(void){ int i; ... i=250; ... delay_ms(i); ... or just delay_ms(250); maybe mikroC has something like delay_us(250); for microseconds??? (delay_ms should be in miliseconds)
Try this: Microchip pic, ASM delay Code, Code Generator
Hi all, I only need a power on delay circuit, roughly one second or two,to energize a SSR. The original board had a 2PST relay, and cut Live and Neutral , so i use also 2 SSR, in this schematic. I found 2 circuits on the web, and had questions about . LM555 My choices: -Current :10 mA for the LS240D12 , sufficient to work and get
delay_ms(2000) I don't use microbasic but in a quick look at you code i saw the delay above and you are using it 2 times, while the mcu is in the above delay function it is not scanning for any key press, you should not use a big delay like this in the loop that scans the keypad, use a few ms if you want. (...)
Hi, What do you mean by on/off? For simple on/off, why would you use PWM? You could achieve this simply by writing 1 or 0 to the pin. If you mean, you want the LED to blink at a fixed rate, then, have the duty cycle set at 50% and the period at something that can be detected by the human eye. For this purpose, the frequency has to be in the order o
I want to delay a signal by 1/2 sample period in matlab, but the delay function block in simulink is all for integer delay. Does anybody know how to realize the 1/2 delay? Thanks!
I don't know, if the formula that is available will be "clearer", but I can give you some background information to that expression. There are in principle two alternatives: 1.) You can split the 10th order function into 5 separat transfer functions - each of 2nd order. For each of this functions you can use a delay formula (...)
Hi, i do have a problem managing the timers on dspic30F3014. This microcontroller has 3 timers: T1, T2 and T3. For my project i use T2 and T3 to generate 2 PWM signals, that control 2 DC motors independently. I do some Analog to Digital conversion, and i configured to be managed by "Internal Counter". I do not know what this means. Who (...)
Try main() { pic_init(); //initialize pic while(1) { LED=0x00; T0delay(); LED=0xFF; T0delay(); } } still not working then i think you need to check the delay function.
Microchip pic, ASM delay Code, Code Generator Welcome to To-pic Mark Crosbie's Homep
This explanation does not include the actual code executed by the microcontroller, single instruction is assumed which is not likely. For testing the amount of delay actually produced, a LED can be connected to some port and changing the number controlling the loop can be varied and the effect observed. C libraries have standard delay (...)
I am trying to modify the following code so that the LED on PORTD is desplayed every 2second. Is this only one LED? If so there is no need to use the PORTB=PORTB+1; command. Instead you can use: while(1) { del(); if (!PORTB) PORTB = 0xFF; else PORTB = 0; } Question: you sa
The code was made on LPCXpresso plate. This version is compatible with LPC1343, but it uses only GPIO and 16- or 32-bit timer. That is why after some minor modifications, the code could possibly work with a cheaper version LPC111
i need to be embedded C program which transmit the data on PC using RS232 continuously which is displayed on 7 segment LED. & this number is changes continuously & send to PC using RS232 via TxD & RxD signal. Just i write the program in c Plz check it for that: // Program to demonstrate the principle of digital clock. this digital
running the following code (built using MPLAB 8.86 and HI-TECH C Compiler for pic10/12/16 MCUs (Lite Mode) V9.83) #include // delay function void delay(int x) { int i; for(i=0;i<10000;i++); } void main(void) { unsigned char* portb=0x06; // port B TRISB=0; *portb=0; while(1) { (...)
How to make a precise and accurate delay by using timer instead of using #include <delay.h> ?? Is there any example of codes as simple as blinking LED with precise delay maybe ? Thank you...
I want to make 1s delay using timer0 and Here is the code: #include interrupt void timer0_ovf_isr(void) { delay = delay + 1 } void main(void) { // timer/Counter 0 initialization // Clock source: System Clock // Clock value: 3.906 kHz // Mode: Normal top=FFh (...)
Hi.. I've written the following code for sending an SMS via the GSM module.. The code runs fine i.e. the entire code executes when the GSM is not connected to the LPC2148 board. This I can tell because I've inserted statements in the code to light LEDs so that I know till where the code has executed. But, however, when I connect the GSM modul
It depends upon how much delay you want and your Fosc.
Hi everybody i have a problem to program my 16f877A to control a stepper motor via uln2003A in order to guide my solar tracker. the analogic inputs of the pic are RA0 and RA1 who are connected to ldr,and the output are the impulsions send from PORTD to the uln2003A after the stepper motor. some information : Vref+=5v, Vref-=2v,clock=8Mhz this
You are not giving much information for us to go on. Things to check: 1. is the clock speed correct and does the real hardware match the setting in software? 2. are you using software delays or one of the hardware timers. If using hardware timers do you have the prescalers set correctly? 3. Is something else being done in the program at the (...)
Hi, I want to use an OR function, but cannot find the right EXAMPLE for this. A.B,C,D,& E are all declared VAR.(int) How do I do this? if a = 1 || b = 1 || c = 1 then D= 50. Possible: if (a || b || c) d = 50; Also if input b0 = 1 || input B1 = 1 , then E = 50. Possible if (input_high(pin_B0) || input_high(pin_B1) E = 5