View previous topic :: View next topic |
Author |
Message |
jjude
Joined: 12 Nov 2007 Posts: 37
|
How big "delay_number" |
Posted: Wed Sep 09, 2009 9:12 am |
|
|
Sorry bad english.
How big delay number can is?
delay_us(1500) is Ok.
delay_us(15000), is this OK??
Code: |
#DEFINE number 1500
.
.
.
void clock_nyppy()
{
viive=number;
if(input(raja_cw) == 0) viive=number*10;
pulssi_on;
delay_us(viive);
pulssi_off;
delay_us(viive);
}
|
Its OK? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Wed Sep 09, 2009 10:42 am |
|
|
it depends on the PIC.
on an 18F (PCH compiler) delay_ms accepts a 8 bit variable. But is a constant is used then it can 16 bit constant. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
jjude
Joined: 12 Nov 2007 Posts: 37
|
|
Posted: Wed Sep 09, 2009 11:15 am |
|
|
Quote: |
it depends on the PIC.
|
16F526 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 09, 2009 12:09 pm |
|
|
Actually in version 4.xxx of the compiler, you can use either a constant
or a variable up to 16-bits. This works in PCM, PCH, etc.
From the manual:
Quote: |
delay_us( )
Syntax: delay_us (time)
Parameters: time - a variable 0-65535(int16) or a constant 0-65535
-----------------------
delay_ms( )
Syntax: delay_ms (time)
Parameters: time - a variable 0-65535(int16) or a constant 0-65535 |
|
|
|
|