Sondraket Avionics med FPGA (12 / 14 steg)
Steg 12: Hej världen
#include "xparameters.h"
#include "xil_types.h"
#include "xil_io.h"
#include "PmodACL.h"
#include < stdio.h >
#include < microblaze_sleep.h >
#include "xil_cache.h"
void DemoInitialize_ACL();
void DemoRun_ACL();
PmodACL ACL;
int main(void)
{
Xil_ICacheEnable();
DemoInitialize_ACL();
While(1) {
DemoRun_ACL();
}
Return 0;
}
void DemoInitialize_ACL()
{
ACL_begin (& ACL, XPAR_PMODACL_0_AXI_LITE_GPIO_BASEADDR, XPAR_PMODACL_0_AXI_LITE_SPI_BASEADDR);
SetMeasure (& ACL, falsk);
< p > SetGRange (& ACL, PAR_GRANGE_PM4G);
SetMeasure (& ACL, TRUE);
CalibrateOneAxisGravitational (& ACL, PAR_AXIS_ZP);
}
void DemoRun_ACL()
{
float x;
float y;
float z;
char strMes [150];
ReadAccelG (& ACL, och x & y, och z);
sprintf (strMes, "X=%f\tY=%f\tZ=%f\n\r", x, y, z);
xil_printf(strMes);
MB_Sleep(10);
} < /p >