PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Robotics
ActivityBot360
libabcalibrate360
cal_displayData.c
1
#include "
abcalibrate360.h
"
2
#include "
simpletools.h
"
3
#include "
servo360.h
"
4
//#include "abdrive360.h"
5
6
//static int errorVal;
7
8
void
cal_displayData
(
void
)
9
{
10
//if(!abd_us) abd_us = CLKFREQ/1000000;
11
12
unsigned
char
str[12];
13
ee_getStr
(str, 12,
_AB360_EE_Start_
);
14
str[11] = 0;
15
16
//if(!strcmp(str, "AB360 "))
17
if
(!strncmp(str,
"AB360"
, 5))
18
{
19
//print("!!! AB360 SETTINGS NOT FOUND, RETURNING !!!\r");
20
//return -1;
21
if
(!strcmp(str,
"AB360 "
))
22
{
23
print
(
"Calibration record found.\r\r\r"
);
24
}
25
else
26
{
27
print
(
"Calibration data either not found or has errors.\r"
);
28
print
(
"Try cal_displayResults() for more info.\r"
);
29
print
(
"\rRaw data from EEPROM:\r\r"
);
30
}
31
32
cal_getEepromPins();
33
34
int
mVccwL =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_mVccwL_);
35
int
bVccwL =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_bVccwL_);
36
int
mVcwL =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_mVcwL_);
37
int
bVcwL =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_bVcwL_);
38
39
int
mVccwR =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_mVccwR_);
40
int
bVccwR =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_bVccwR_);
41
int
mVcwR =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_mVcwR_);
42
int
bVcwR =
ee_getInt
(
_AB360_EE_Start_
+ _AB360_EE_bVcwR_);
43
44
print
(
"\r\rInverse Transfer Function Constants\r"
);
45
print
(
"for y = mx + b\r"
);
46
print
(
"===================================\r"
);
47
print
(
"Left Servo, Counterclockwise\r"
);
48
pause
(50);
49
print
(
"m = %d\r"
, mVccwL);
50
print
(
"b = %d\r"
, bVccwL);
51
print
(
"\rLeft Servo, Clockwise\r"
);
52
print
(
"m = %d\r"
, mVcwL);
53
print
(
"b = %d\r"
, bVcwL);
54
55
pause
(50);
56
print
(
"\rRight Servo, Counterclockwise\r"
);
57
print
(
"m = %d\r"
, mVccwR);
58
print
(
"b = %d\r"
, bVccwR);
59
print
(
"\rRight Servo, Clockwise\r"
);
60
print
(
"m = %d\r"
, mVcwR);
61
print
(
"b = %d\r"
, bVcwR);
62
63
pause
(50);
64
print
(
"\rNotes:\r"
);
65
print
(
"y: Offset from 15,000 in 0.1 us units\r"
);
66
print
(
"m: Slope in 1.0 us / 4096 increments\r"
);
67
print
(
"x: Desired speed in 4096ths of a revolution/second\r"
);
68
print
(
"b: Number of 0.1 us increments added to 15000\r"
);
69
}
70
else
71
{
72
print
(
"Calibration data either not found or has errors.\r"
);
73
print
(
"Try cal_displayResults() for more info.\r"
);
74
print
(
"\rRaw data from EEPROM:\r\r"
);
75
for
(
int
a =
_AB360_EE_Start_
; a <
_AB360_EE_End_
; a++)
76
{
77
char
c =
ee_getByte
(a);
78
if
(c >=
' '
&& c <=
'z'
)
79
{
80
print
(
"%c"
, c);
81
}
82
else
83
{
84
print
(
"[%d]"
, c);
85
}
86
}
87
return
;
88
}
89
90
pause
(50);
91
92
print
(
"\r\rCalibration data stored in EEPROM:\r"
);
93
print
(
"===================================\r"
);
94
for
(
int
a =
_AB360_EE_Start_
; a <
_AB360_EE_End_
; a++)
95
{
96
char
c =
ee_getByte
(a);
97
if
(c >=
' '
&& c <=
'z'
)
98
{
99
print
(
"%c"
, c);
100
}
101
else
102
{
103
print
(
"[%d]"
, c);
104
}
105
}
106
print
(
"\r"
);
107
return
;
108
}
109
110
ee_getInt
int ee_getInt(int addr)
Get an int value from a certain address in the Propeller Chip's dedicated EEPROM. If you are fetching...
Definition:
eeprom_getInt.c:24
ee_getByte
char ee_getByte(int addr)
Get a byte value from a certain address in the Propeller Chip's dedicated EEPROM.
Definition:
eeprom_getByte.c:24
abcalibrate360.h
This library has a functions you can call to calibrate your ActivityBot 360. Example code that uses t...
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
_AB360_EE_Start_
#define _AB360_EE_Start_
ActivityBot EEPROM calibration data start address.
Definition:
abcalibrate360.h:68
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
cal_displayData
void cal_displayData(void)
Display ActivityBot 360 calibration data in the terminal. This data consists of I/O pin values for ...
Definition:
Display.c:189
servo360.h
Parallax Feedback 360 High Speed Servo control and monitoring functions. Uses one additional cog to c...
_AB360_EE_End_
#define _AB360_EE_End_
ActivityBot EEPROM calibration data end address.
Definition:
abcalibrate360.h:112
ee_getStr
unsigned char * ee_getStr(unsigned char *s, int n, int addr)
Fetch a string of byte values starting at a certain address in Propeller Chip's dedicated EEPROM.
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17