PCDIDE COMPILER Custom Computer Services Inc (CCS), PCDIDE COMPILER Datasheet - Page 346

PCD C-COMPILER PIC24, DSPIC

PCDIDE COMPILER

Manufacturer Part Number
PCDIDE COMPILER
Description
PCD C-COMPILER PIC24, DSPIC
Manufacturer
Custom Computer Services Inc (CCS)
Type
Compilerr
Datasheet

Specifications of PCDIDE COMPILER

For Use With/related Products
Microchip PIC24/dsPIC®
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
429-1008
How do I get getc() to timeout after a specified time?
GETC will always wait for a character to become available unless a timeout time is specified in the
#use rs232().
The following is an example of how to setup the PIC to timeout when waiting for an RS232
character.
#include <18F4520.h>
#fuses HS,NOWDT
#use delay(clock=20MHz)
#use rs232(UART1,baud=9600,timeout=500) //timeout = 500 milliseconds, 1/2
second
void main()
{
}
How do I wait only a specified time for a button press?
The following is an example of how to wait only a specific time for a button press.
#define PUSH_BUTTON PIN_A4
int1 timeout_error;
int1 timed_get_button_press(void){
}
332
char c;
while(TRUE)
{
}
int16 timeout;
timeout_error=FALSE;
timeout=0;
while(input(PUSH_BUTTON) && (++timeout<50000)) // 1/2 second
if(!input(PUSH_BUTTON))
else{
}
c=getc();
if(c) //if not zero echo character back
//user to do code
output_toggle(PIN_A5);
delay_us(10);
return(TRUE); //button pressed
timeout_error=TRUE;
return(FALSE); //button not pressed timeout occurred
putc(c);
//if getc() timeouts 0 is returned to c
//otherwise receive character is returned to c

Related parts for PCDIDE COMPILER