Page 692 - 2
P. 692
OCR2 = 0xff/(speed_y+1);
Y_DIR = 1;
}
}
}
#include <io.h>
#include <stdio.h>
#include <math.h>
//3.141592653589793238462643383279502884197169399375105820974944592307816406286
#define PI 3.141592
// 주기
#define PERIOD (0.01)
#define POS_MIN (-10)
#define POS_MAX (10)
#define X_MIN (-10)
#define X_MAX (10)
#define Y_MIN (-10)
#define Y_MAX (10)
#define MAX_SPEED_POS 100
#define MAX_SPEED_x 100
#define MAX_SPEED_y 100
//A4988 DIR
//A4988 STEP
#define POS_A4988_DIR PORTC.0
#define POS_A4988_STEP PORTC.1
#define X_A4988_DIR PORTC.2
#define X_A4988_STEP PORTC.3
#define Y_A4988_DIR PORTC.4
#define Y_A4988_STEP PORTC.5
//SENSOR
#define POS_SENSOR
#define X_SENSOR
#define Y_SENSOR
//3 차원 좌표
typedef struct Coordinate {
float x;
float y;
- 692 -