Delay program for pic16f1937 using hitech c

Status
Not open for further replies.

rems

New Member
how to store delay in a variable using hitech c for pic16f1937.when i
void time (unsigned long int)
_delay(time);
its throwing error: inline delay argument must be constant.
could someone help me to solve this please.
Thanks in advance
 
Time is declared as a function.. try

Code:
void time( unsigned long x) _delay(x);

I thought the correct syntax for delay was

Code:
__delay_ms(x);
__delay_us(x);

both as int's.
 
__delay_ms(x);
__delay_us(x); this are not working .is it the problem with the complier.
 
You need to stick
Code:
#define _XTAL_FREQ 4000000

At the beginning to be able to use them.

There needs to be two underscores '_' .
 
i did that,but it is not working .
so i did like this
for (i = 0 ; i < delaytime ; i++)
_delay(10);

now its workling.

i have another problem,i need to send the delay from c# using serial port to c program. could you please tell me how to recive data from c# to c using serial port.
 
What format id the data in? When you send it from C#, is it in text?
 
i am sending temperture from temperature sensor boerd to pc using serial port. so
first i will send the temperature to pc and the temperatures are displaying in texbox.i have a combo box in which user can select the time ,so tht for example user select 1 min,tempertaure will be displayed in textbox everyone min.

so once the user select the time i need to write that time in serial port and send it .
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…