Kryten New Member Sep 14, 2009 #1 Is it possible to define a delay if i shall use it several times I mean I can define ports as names for easy programming and give low or high output short names like Code: #define LED_OFF output_low Can I do the same with a delay? I looking to turn off (or on) several outputs for a short period of time (250ms) will it make sense to do it like this? Code: #define LED_blink output_low delay(250ms) output_high
Is it possible to define a delay if i shall use it several times I mean I can define ports as names for easy programming and give low or high output short names like Code: #define LED_OFF output_low Can I do the same with a delay? I looking to turn off (or on) several outputs for a short period of time (250ms) will it make sense to do it like this? Code: #define LED_blink output_low delay(250ms) output_high
W Wp100 Well-Known Member Sep 15, 2009 #2 Hi, Is it possible to define a delay if i shall use it several times Click to expand... Yes, you create a subroutine for the delay_loop. You then CALL delay_loop or GOTO delay_loop when ever you need it. The value currently held in W can be carried into the subroutine if needed. A Macro can be also used to do similar things.
Hi, Is it possible to define a delay if i shall use it several times Click to expand... Yes, you create a subroutine for the delay_loop. You then CALL delay_loop or GOTO delay_loop when ever you need it. The value currently held in W can be carried into the subroutine if needed. A Macro can be also used to do similar things.
Kryten New Member Sep 15, 2009 #3 Ok I might have been a bit vague. Im programming in C because im trying to control via USB
mramos1 Active Member Sep 15, 2009 #4 Mark Crosbie's Homepage What C compiler are you using? What processor/controller? Do you want the I/O in the routine as well, or just a delay? Some compilers have libraries that have msec_delay included.
Mark Crosbie's Homepage What C compiler are you using? What processor/controller? Do you want the I/O in the routine as well, or just a delay? Some compilers have libraries that have msec_delay included.
Kryten New Member Sep 15, 2009 #5 Im using (i belive its called) Hi Tech pic c compiler (the one that comes with mplab) and 18F4550 (PIC that is). Im going to use 12MHz crystall and running it a 4x (48MHz) Last edited: Sep 15, 2009
Im using (i belive its called) Hi Tech pic c compiler (the one that comes with mplab) and 18F4550 (PIC that is). Im going to use 12MHz crystall and running it a 4x (48MHz)