SW006014 Microchip Technology, SW006014 Datasheet - Page 41
SW006014
Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet
1.SW006014.pdf
(246 pages)
Specifications of SW006014
Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
- Current page: 41 of 246
- Download datasheet (3Mb)
© 2008 Microchip Technology Inc.
raise
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Example:
Reports a synchronous signal.
<signal.h>
int raise(int sig);
sig signal name
Returns a 0 if successful; otherwise, returns a non-zero value.
raise sends the signal identified by sig to the executing program.
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <p30f6014.h> /* for INTCON1bits */
void __attribute__((__interrupt__))
_MathError(void)
{
}
void illegalinsn(int idsig)
{
}
int main(void)
{
}
Output:
Illegal instruction executed
Explanation:
This example requires the linker script p30f6014.gld. There are
three parts to this example.
First, an interrupt handler is written for the interrupt vector
_MathError to handle a math error by sending an illegal instruction
signal (SIGILL) to the executing program. The last statement in
the interrupt handler clears the exception flag.
Second, the function illegalinsn will print an error message and
call exit.
Third, in main, signal (SIGILL, illegalinsn) sets the handler
for SIGILL to the function illegalinsn.
When a math error occurs, due to a divide by zero, the _MathError
interrupt vector is called, which in turn will raise a signal that will call the
handler function for SIGILL, which is the function illegalinsn.
Thus error messages are printed and the program is terminated.
raise(SIGILL);
INTCON1bits.MATHERR = 0;
printf("Illegal instruction executed\n");
exit(1);
int x, y;
div_t z;
signal(SIGILL, illegalinsn);
x = 7;
y = 0;
z = div(x, y);
printf("Program never reaches here");
/* for raise, signal, */
/* SIGILL, SIG_DFL
/* for div, div_t
/* for printf
DS51456E-page 37
*/
*/
*/
Related parts for SW006014
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet: