/* * mm_test.c * * Created on: 2016/06/29 * Author: ono */
#include <stdio.h>
#include <stdlib.h>
#include "xil_io.h"
#include "xparameters.h"
#include "sleep.h"
#include "xmotor_monitor.h"
int main(){
XMotor_monitor XMmoniL, XMmoniR;
XMotor_monitor_Config *XMmoniLPTR, *XMmoniRPTR;
XMmoniLPTR = XMotor_monitor_LookupConfig(0);
if(!XMmoniLPTR){
fprintf(stderr, "Left XMotor monitor configuration failed.\n");
return(-1);
}
int XMmL_status = XMotor_monitor_CfgInitialize(&XMmoniL, XMmoniLPTR);
if (XMmL_status != XST_SUCCESS){
fprintf(stderr, "Could not Initialize Left XMotor monitor\n");
return(-1);
}
XMmoniRPTR = XMotor_monitor_LookupConfig(1);
if(!XMmoniRPTR){
fprintf(stderr, "Right XMotor monitor configuration failed.\n");
return(-1);
}
int XMmR_status = XMotor_monitor_CfgInitialize(&XMmoniR, XMmoniRPTR);
if (XMmR_status != XST_SUCCESS){
fprintf(stderr, "Could not Initialize Right XMotor monitor\n");
return(-1);
}
while (!XMotor_monitor_IsIdle(&XMmoniL));
while (!XMotor_monitor_IsIdle(&XMmoniR));
XMotor_monitor_Start(&XMmoniL);
//XMotor_monitor_EnableAutoRestart(&XMmoniL);
while (!XMotor_monitor_IsIdle(&XMmoniL));
XMotor_monitor_Start(&XMmoniR);
//XMotor_monitor_EnableAutoRestart(&XMmoniR);
while (!XMotor_monitor_IsIdle(&XMmoniR));
u32 sa_countL = XMotor_monitor_Get_sa_count_V(&XMmoniL);
u32 sa_countR = XMotor_monitor_Get_sa_count_V(&XMmoniR);
u32 sb_levelL = XMotor_monitor_Get_sb_level_V(&XMmoniL);
u32 sb_levelR = XMotor_monitor_Get_sb_level_V(&XMmoniR);
u32 returnL = XMotor_monitor_Get_return(&XMmoniL);
u32 returnR = XMotor_monitor_Get_return(&XMmoniR);
printf("sa_countL = %d, sb_levelL = %d, returnL = %d\n", (unsigned int)sa_countL,
(unsigned int)sb_levelL, (unsigned int)returnL);
printf("sa_countR = %d, sb_levelR = %d, returnR = %d\n", (unsigned int)sa_countR,
(unsigned int)sb_levelR, (unsigned int)returnR);
return 0;
}
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
- | - | - | - | - | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | - | - | - | - | - | - |