Jump to content

Recommended Posts

I am working with the husart lib functions of the BoostC. The section of the header file rs232_driver.h looks like this...

	if (T_MODE & USART_HW)
{	
	while (!KBHIT<_USART_TEMPL_ARGS>()) // wait for a character
		if (T_MODE & USART_reset_wdt)
			clear_wdt();

	return(l_rcreg);
}

 

I have generally used the while function ending with a semicolon like this..

 

while (!KBHIT<_USART_TEMPL_ARGS>()); // wait for a character

 

or

 

if you have some statement to execute..

 

while (!KBHIT<_USART_TEMPL_ARGS>()) // wait for a character

{

....

....

}

 

I don't see the semi colon or the closed paranthesis in the header file. Can anyone explain how it functions?

In my project i don't want the micro to simply sit & wait for a character to be received, i want it to carry on executing other instructions & if it sees a character i then want it to execute specific task using switch case function. Is there a way to modify the lib to do this while retaining all other functionality of the lib.

 

Regards

Raghunathan.

Link to post
Share on other sites
I am working with the husart lib functions of the BoostC. The section of the header file rs232_driver.h looks like this...

	if (T_MODE & USART_HW)
{	
	while (!KBHIT<_USART_TEMPL_ARGS>()) // wait for a character
		if (T_MODE & USART_reset_wdt)
			clear_wdt();

	return(l_rcreg);
}

 

I have generally used the while function ending with a semicolon like this..

 

while (!KBHIT<_USART_TEMPL_ARGS>()); // wait for a character

 

or

 

if you have some statement to execute..

 

while (!KBHIT<_USART_TEMPL_ARGS>()) // wait for a character

{

....

....

}

 

I don't see the semi colon or the closed paranthesis in the header file. Can anyone explain how it functions?

In my project i don't want the micro to simply sit & wait for a character to be received, i want it to carry on executing other instructions & if it sees a character i then want it to execute specific task using switch case function. Is there a way to modify the lib to do this while retaining all other functionality of the lib.

 

Regards

Raghunathan.

 

 

The semicolon is at the end of clear_wdt()

 

A while format is while (condition) statement;

 

Statement can be nothing, a block or a single statement, in his case the single statement is the if.

 

Code like this could be formatted a lot clearer.

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...