Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 Manuale Utente
Codici prodotto
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 358
2012 Microchip Technology Inc.
Example
#include <math.h>
#include <stdio.h>
#define C 3.141592/180.0
void
main (void)
{
double i;
for(i = 0 ; i <= 180.0 ; i += 10)
printf("sin(%3.0f) = %f\n", i, sin(i*C));
printf("cos(%3.0f) = %f\n", i, cos(i*C));
}
See Also
cos()
, tan(), asin(), acos(), atan(), atan2()
Return Value
Sine vale of
f
.
SLEEP
Synopsis
#include <xc.h>
SLEEP();
Description
This macro is used to put the device into a low-power standby mode.
Example
#include <xc.h>
extern void init(void);
void
main (void)
{
init(); /* enable peripherals/interrupts */
while(1)
SLEEP(); /* save power while nothing happening */
}
SPRINTF, VSPRINTF
Synopsis
#include <stdio.h>
int sprintf (char * buf, const char * fmt, ...)
#include <stdio.h>
#include <stdarg.h>
int vsprintf (char * buf, const char * fmt, va_list ap)