Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Usart Receive problem

Status
Not open for further replies.

samnang39

Full Member level 2
Joined
Oct 26, 2006
Messages
130
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Location
Cambodia
Activity points
2,246
Delay in Hi-tech c compiler

Dear all

any one show the dalay in Hi-tech c compiler
 
Last edited:

please give more details what do you mean?
 

Are you referring to __delay_us() and __delay_ms() routines?

Following is an example of their use, however note it is mandatory that "#define _XTAL_FREQ" be set the to actual system clock frequency for the routines to generate the correct delay.


Code:
#include <htc.h>	// Required to interface with delay routines

#ifndef _XTAL_FREQ
 // Unless already defined assume 4MHz system frequency
 // This definition is required to calibrate __delay_us() and __delay_ms()
 #define _XTAL_FREQ 4000000
#endif

/** demonstration of various built-in delay mechanisms */
void main(void){
	while(1){
		NOP();
		_delay(1000);		// delay for 1000 instruction cycles
		CLRWDT();
		__delay_us(400);	// delay for 400 microseconds
		CLRWDT();
		__delay_ms(2);		// delay for 2 milliseconds
		CLRWDT();
	}
}

BigDog
 

my compiler don't understand _delay_ms();
 

my compiler don't understand _delay_ms();

There are two underscores in both __delay_us() and __delay_ms(), not one as is your reply.

There is only one underscore in _XTAL_FREQ.

What version of the Hi-Tech Compiler are you using?

Is it operating in "Lite", "Standard" or "Pro" mode?


I would recommend copying and pasting the code directly from the code box above and then attempt to compiler it.

BigDog
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top