| 1 |
From [email protected] Wed Jul 1 13:17:17 1998 |
| 2 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 3 |
id AA10324; Wed, 1 Jul 1998 13:17:17 -0400 |
| 4 |
Received: from comp.uark.edu ([email protected] [130.184.252.197]) |
| 5 |
by aleve.media.mit.edu (8.8.7/ML970927) with ESMTP id LAA00083 |
| 6 |
for <[email protected]>; Wed, 1 Jul 1998 11:56:44 -0400 (EDT) |
| 7 |
Received: from comp.uark.edu (IDENT:[email protected] [130.184.201.233]) |
| 8 |
by comp.uark.edu (8.9.0/8.9.0) with ESMTP id KAA12202; |
| 9 |
Wed, 1 Jul 1998 10:56:30 -0500 (CDT) |
| 10 |
Sender: [email protected] |
| 11 |
Message-Id: <[email protected]> |
| 12 |
Date: Wed, 01 Jul 1998 10:56:30 -0500 |
| 13 |
From: Douglas Blank <[email protected]> |
| 14 |
Organization: University of Arkansas, CS |
| 15 |
X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.33 i686) |
| 16 |
Mime-Version: 1.0 |
| 17 |
To: Aaron Edsinger <[email protected]> |
| 18 |
Cc: handy <[email protected]> |
| 19 |
Subject: Re: Serial Interface |
| 20 |
References: <[email protected]> |
| 21 |
Content-Type: text/plain; charset=us-ascii |
| 22 |
Content-Transfer-Encoding: 7bit |
| 23 |
|
| 24 |
Aaron Edsinger wrote: |
| 25 |
|
| 26 |
> Hello, |
| 27 |
> I've been having some problems using my HandyBoard to talk directly to my |
| 28 |
> PC via the serial interface. I disable Interactive C and then Poke() and |
| 29 |
> Peek() as has been described on this list. I send short character strings |
| 30 |
> from my PC to the HandyBoard under Windows 95. If I send strings longer |
| 31 |
> than 2 characters, it seems that some of the characters get lost. This |
| 32 |
> behavior seems to be affected by repositioning or slightly modifying the |
| 33 |
> code, suggesting perhaps a timing issue. |
| 34 |
|
| 35 |
Although there is the HEXMON program, I too, have been trying to do what |
| 36 |
you describe, and encountered the same problems. I found it to be a |
| 37 |
timing issue, and, through trial and error, have a found some settings |
| 38 |
that seem to work most of the time. |
| 39 |
|
| 40 |
My goal was to make C code that looked the same when compiled and run on |
| 41 |
the Host is the code that ran under IC. |
| 42 |
|
| 43 |
I am including the host and HB programs here. If anyone knows of a |
| 44 |
better way of communicating, please let us know. |
| 45 |
|
| 46 |
-Doug Blank |
| 47 |
|
| 48 |
===================================================================== |
| 49 |
[email protected] Douglas Blank, University of Arkansas |
| 50 |
Assistant Professor Computer Science |
| 51 |
==================== http://www.uark.edu/~dblank ==================== |
| 52 |
|
| 53 |
This code was written for MS C++4.0 running on Win95. |
| 54 |
|
| 55 |
//************** BEGIN: serial_HOST.c |
| 56 |
|
| 57 |
/* VC++4.0 HandyBoard Host Programming System |
| 58 |
Dr. Douglas S. Blank |
| 59 |
University of Arkansas, Department of Computer Science |
| 60 |
www.uark.edu/~dblank |
| 61 |
|
| 62 |
This code runs on a host PC. |
| 63 |
*/ |
| 64 |
|
| 65 |
#include <ctype.h> |
| 66 |
#include <conio.h> |
| 67 |
#include <stdlib.h> |
| 68 |
#include <stdio.h> |
| 69 |
|
| 70 |
#include "serial_HOST.h" |
| 71 |
|
| 72 |
void main(int argc, char *argv[]) |
| 73 |
{ |
| 74 |
motor(0, 100); |
| 75 |
motor(1, 100); |
| 76 |
motor(2, 100); |
| 77 |
motor(3, 100); |
| 78 |
sleep(1000); |
| 79 |
motor(0, -100); |
| 80 |
motor(1, -100); |
| 81 |
motor(2, -100); |
| 82 |
motor(3, -100); |
| 83 |
sleep(1000); |
| 84 |
ao(); |
| 85 |
print("\nThis is a test"); |
| 86 |
printf("Knob is %d\n", knob() ); |
| 87 |
printf("Analog(0) is %d\n", analog(0)); |
| 88 |
printf("Digital(0) is %d\n", digital(0)); |
| 89 |
printf("Analog(1) is %d\n", analog(1)); |
| 90 |
printf("Digital(1) is %d\n", digital(1)); |
| 91 |
printf("Analog(2) is %d\n", analog(2)); |
| 92 |
printf("Digital(2) is %d\n", digital(2)); |
| 93 |
printf("Analog(3) is %d\n", analog(3)); |
| 94 |
printf("Digital(3) is %d\n", digital(3)); |
| 95 |
printf("Analog(4) is %d\n", analog(4)); |
| 96 |
printf("Digital(4) is %d\n", digital(4)); |
| 97 |
printf("Analog(5) is %d\n", analog(5)); |
| 98 |
printf("Digital(5) is %d\n", digital(5)); |
| 99 |
printf("Analog(6) is %d\n", analog(6)); |
| 100 |
printf("Digital(6) is %d\n", digital(6)); |
| 101 |
printf("Analog(7) is %d\n", analog(7)); |
| 102 |
printf("Digital(7) is %d\n", digital(7)); |
| 103 |
printf("Analog(8) is %d\n", analog(8)); |
| 104 |
printf("Digital(8) is %d\n", digital(8)); |
| 105 |
printf("Analog(9) is %d\n", analog(9)); |
| 106 |
printf("Digital(9) is %d\n", digital(9)); |
| 107 |
printf("Analog(10) is %d\n", analog(10)); |
| 108 |
printf("Digital(10) is %d\n", digital(10)); |
| 109 |
printf("Analog(11) is %d\n", analog(11)); |
| 110 |
printf("Digital(11) is %d\n", digital(11)); |
| 111 |
printf("Analog(12) is %d\n", analog(12)); |
| 112 |
printf("Digital(12) is %d\n", digital(12)); |
| 113 |
printf("Analog(13) is %d\n", analog(13)); |
| 114 |
printf("Digital(13) is %d\n", digital(13)); |
| 115 |
printf("Analog(14) is %d\n", analog(14)); |
| 116 |
printf("Digital(14) is %d\n", digital(14)); |
| 117 |
printf("Analog(15) is %d\n", analog(15)); |
| 118 |
printf("Digital(15) is %d\n", digital(15)); |
| 119 |
beep(); |
| 120 |
sleep(1000); |
| 121 |
while (! stop_button() ) { |
| 122 |
sprintf(buffer, "%d.0", (knob() * 10)); |
| 123 |
tone( buffer, "0.1"); |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
//************** END: serial_HOST.c |
| 128 |
|
| 129 |
//************** BEGIN: serial_HOST.h |
| 130 |
|
| 131 |
/* VC++4.0 HandyBoard Host Programming System |
| 132 |
Dr. Douglas S. Blank |
| 133 |
University of Arkansas, Department of Computer Science |
| 134 |
www.uark.edu/~dblank |
| 135 |
*/ |
| 136 |
|
| 137 |
#define MOTOR 0 |
| 138 |
#define AO 1 |
| 139 |
#define ANALOG 2 |
| 140 |
#define DIGITAL 3 |
| 141 |
#define PRINTF 4 |
| 142 |
#define KNOB 5 |
| 143 |
#define BEEP 6 |
| 144 |
#define TONE 7 |
| 145 |
#define START_BUTTON 8 |
| 146 |
#define STOP_BUTTON 9 |
| 147 |
#define QUIT 113 |
| 148 |
|
| 149 |
#define sleep(NUM) _sleep(NUM) |
| 150 |
#define SERIALWAIT 5 |
| 151 |
|
| 152 |
unsigned short PORT = 0x3f8; // LPT1: 0x378 COM1: 0x3f8 |
| 153 |
|
| 154 |
int send(int i) { |
| 155 |
int retval; |
| 156 |
retval = _outp( PORT, i); |
| 157 |
_sleep(SERIALWAIT); |
| 158 |
return retval; |
| 159 |
} |
| 160 |
|
| 161 |
int receive() { |
| 162 |
int retval; |
| 163 |
retval = _inp( PORT); |
| 164 |
_sleep(SERIALWAIT); |
| 165 |
retval = _inp( PORT); |
| 166 |
return retval; |
| 167 |
} |
| 168 |
|
| 169 |
void hangup() { |
| 170 |
send(QUIT); |
| 171 |
} |
| 172 |
|
| 173 |
void print(char buffer[]) { |
| 174 |
int i; |
| 175 |
send(PRINTF); |
| 176 |
for (i = 0; buffer[i] != 0; i++) |
| 177 |
send(buffer[i]); |
| 178 |
send('\0'); |
| 179 |
} |
| 180 |
|
| 181 |
void motor(int motornum, int power) { |
| 182 |
send(MOTOR); |
| 183 |
send(motornum); |
| 184 |
send(power + 100); // taken off on the other end |
| 185 |
} |
| 186 |
|
| 187 |
int analog(int sensor) { |
| 188 |
send(ANALOG); |
| 189 |
send(sensor); |
| 190 |
return receive(); |
| 191 |
} |
| 192 |
|
| 193 |
int digital(int sensor) { |
| 194 |
send(DIGITAL); |
| 195 |
send(sensor); |
| 196 |
return receive(); |
| 197 |
} |
| 198 |
|
| 199 |
void ao() { |
| 200 |
send(AO); |
| 201 |
} |
| 202 |
|
| 203 |
int knob() { |
| 204 |
send(KNOB); |
| 205 |
return receive(); |
| 206 |
} |
| 207 |
|
| 208 |
void beep() { |
| 209 |
send(BEEP); |
| 210 |
} |
| 211 |
|
| 212 |
void tone(char f1[], char f2[]) { |
| 213 |
int i; |
| 214 |
send(TONE); |
| 215 |
for (i = 0; f1[i] != 0; i++) |
| 216 |
send(f1[i]); |
| 217 |
send('\0'); |
| 218 |
for (i = 0; f2[i] != 0; i++) |
| 219 |
send(f2[i]); |
| 220 |
send('\0'); |
| 221 |
_sleep((unsigned long) (atof(f2) * 1000)); // to keep from |
| 222 |
overflowing serial line |
| 223 |
} |
| 224 |
|
| 225 |
void interactive() |
| 226 |
{ |
| 227 |
char c; |
| 228 |
char key = ' '; |
| 229 |
while (key != 'q') { |
| 230 |
key = getch(); |
| 231 |
send(key); |
| 232 |
printf("Sent %c\n", key); |
| 233 |
c = receive(); |
| 234 |
printf("Got %c as a return value\n", c); |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
int start_button() { |
| 239 |
send(START_BUTTON); |
| 240 |
return receive(); |
| 241 |
} |
| 242 |
|
| 243 |
int stop_button() { |
| 244 |
send(STOP_BUTTON); |
| 245 |
return receive(); |
| 246 |
} |
| 247 |
//************** END: serial_HOST.h |
| 248 |
|
| 249 |
//************** BEGIN: serial_HB.c |
| 250 |
|
| 251 |
/* VC++4.0 HandyBoard Programming System |
| 252 |
(Parts taken from other HB programs) |
| 253 |
Dr. Douglas S. Blank |
| 254 |
University of Arkansas, Department of Computer Science |
| 255 |
www.uark.edu/~dblank |
| 256 |
|
| 257 |
This code runs on the HB |
| 258 |
*/ |
| 259 |
|
| 260 |
#define MOTOR 0 |
| 261 |
#define AO 1 |
| 262 |
#define ANALOG 2 |
| 263 |
#define DIGITAL 3 |
| 264 |
#define PRINTF 4 |
| 265 |
#define KNOB 5 |
| 266 |
#define BEEP 6 |
| 267 |
#define TONE 7 |
| 268 |
#define START_BUTTON 8 |
| 269 |
#define STOP_BUTTON 9 |
| 270 |
#define QUIT 113 |
| 271 |
|
| 272 |
int _isspace(int a) /* returns 1 for space or tab, 0 |
| 273 |
otherwise */ |
| 274 |
/* internal routine used by atof() and |
| 275 |
cgets() */ |
| 276 |
|
| 277 |
{ |
| 278 |
return ((a == 32) || (a == 9)); /* 32 is space, 9 is tab */ |
| 279 |
} |
| 280 |
|
| 281 |
/*****************************************************************************/ |
| 282 |
|
| 283 |
int _isdigit(int a) /* returns 1 if a digit 0-9, 0 otherwise */ |
| 284 |
/* internal routine used by atof() */ |
| 285 |
|
| 286 |
{ |
| 287 |
return ((a >= 48) && (a <= 57)); /* 48 is '0', 57 is '9' */ |
| 288 |
} |
| 289 |
|
| 290 |
float atof(char s[]) /* Convert a string containing a number in |
| 291 |
ASCII */ |
| 292 |
/* form (integer, float, or exponential float) |
| 293 |
to a */ |
| 294 |
/* float. Strips whitespace characters (space |
| 295 |
and */ |
| 296 |
/* tab) from the front of the string, but |
| 297 |
stops */ |
| 298 |
/* parsing at the first (unexpected) |
| 299 |
non-numeric */ |
| 300 |
/* character if the string has garbage at the |
| 301 |
end. */ |
| 302 |
/* This means that " 34.3foo78" translates to |
| 303 |
34.3. */ |
| 304 |
/* Modified from atof() function in the |
| 305 |
standard */ |
| 306 |
/* library of the Hi-Tec C compiler for |
| 307 |
CP/M. */ |
| 308 |
/* Note: all string literals converted to |
| 309 |
decimal */ |
| 310 |
/* form because IC can't deal with string |
| 311 |
literals */ |
| 312 |
/* in math |
| 313 |
calculations. */ |
| 314 |
/* Also note: very ugly code because IC will |
| 315 |
not */ |
| 316 |
/* allow any math operations on pointers! Thus, |
| 317 |
the */ |
| 318 |
/* the number string has to be treated as an |
| 319 |
array! */ |
| 320 |
/* Also also note: no error handling; assumes |
| 321 |
that */ |
| 322 |
/* the string is a valid representation of a |
| 323 |
number! */ |
| 324 |
/* Valid range for exponential-format numbers |
| 325 |
is */ |
| 326 |
/* approximately 2.0e-38 to |
| 327 |
3.4e+38. */ |
| 328 |
|
| 329 |
{ |
| 330 |
int i=0; /* index into string array */ |
| 331 |
int sign=0; /* mantissa sign flag: 0=positive, |
| 332 |
1=negative */ |
| 333 |
int exp0=0; /* mantissa exponent counter */ |
| 334 |
int eexp=0; /* E-form exponent counter */ |
| 335 |
int expsign=0; /* exponent sign flag: 0=positive, |
| 336 |
1=negative */ |
| 337 |
float m=0.0; /* mantissa accumulator */ |
| 338 |
|
| 339 |
/* skip any leading whitespace (space, tab) */ |
| 340 |
while (_isspace(s[i])) |
| 341 |
i++; /* skip it */ |
| 342 |
|
| 343 |
/* check for mantissa sign */ |
| 344 |
if (s[i] == 45) /* 45 is '-' */ |
| 345 |
{ |
| 346 |
sign = 1; /* flag minus sign */ |
| 347 |
i++; /* point to next */ |
| 348 |
} |
| 349 |
else if (s[i] == 43) /* 43 is '+' */ |
| 350 |
i++; /* point to next */ |
| 351 |
|
| 352 |
/* now get all digits up to either a decimal point or an e/E */ |
| 353 |
while (_isdigit(s[i])) |
| 354 |
{ |
| 355 |
m = 10.0*m + (float)(s[i] - 48); /* 48 is '0' */ |
| 356 |
i++; /* point to next */ |
| 357 |
} |
| 358 |
|
| 359 |
/* no more digits, so check for decimal point */ |
| 360 |
if (s[i] == 46) /* 46 is '.' */ |
| 361 |
{ |
| 362 |
i++; /* point to next */ |
| 363 |
/* get all digits after decimal point */ |
| 364 |
while (_isdigit(s[i])) |
| 365 |
{ |
| 366 |
exp0--; |
| 367 |
m = 10.0*m + (float)(s[i] - 48); /* 48 is '0' */ |
| 368 |
i++; /* point to next */ |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
/* check for e/E exponential form */ |
| 373 |
if ((s[i] == 101) || (s[i] == 69)) /* 101 is 'e', 69 is 'E' */ |
| 374 |
{ |
| 375 |
i++; /* point to next */ |
| 376 |
/* check for exponent sign */ |
| 377 |
if (s[i] == 45) /* 45 is '-' */ |
| 378 |
{ |
| 379 |
expsign = 1; /* flag negative exponent */ |
| 380 |
i++; /* point to next */ |
| 381 |
} |
| 382 |
else if (s[i] == 43) /* 43 is '+' */ |
| 383 |
i++; /* point to next */ |
| 384 |
|
| 385 |
/* now get exponent */ |
| 386 |
while (_isdigit(s[i])) |
| 387 |
{ |
| 388 |
eexp = eexp*10 + s[i] - 48; /* 48 is '0' */ |
| 389 |
i++; /* point to next */ |
| 390 |
} |
| 391 |
|
| 392 |
/* adjust exponent sign */ |
| 393 |
if (expsign) |
| 394 |
eexp = -eexp; /* make it negative */ |
| 395 |
} |
| 396 |
|
| 397 |
/* compute absolute value of final float */ |
| 398 |
exp0 += eexp; |
| 399 |
while (exp0 < 0) /* for negative exponents */ |
| 400 |
{ |
| 401 |
m = m / 10.0; |
| 402 |
exp0++; |
| 403 |
} |
| 404 |
while (exp0 > 0) /* for positive exponents */ |
| 405 |
{ |
| 406 |
m = m * 10.0; |
| 407 |
exp0--; |
| 408 |
} |
| 409 |
|
| 410 |
/* adjust final float sign from mantissa */ |
| 411 |
if (sign) |
| 412 |
return (-m); /* negative */ |
| 413 |
else |
| 414 |
return (m); /* positive */ |
| 415 |
} |
| 416 |
|
| 417 |
void disable_pcode_serial() |
| 418 |
/* necessary to receive characters using serial_getchar */ |
| 419 |
{ |
| 420 |
poke(0x3c, 1); |
| 421 |
} |
| 422 |
|
| 423 |
void reenable_pcode_serial() |
| 424 |
/* necessary for IC to interact with board again */ |
| 425 |
{ |
| 426 |
poke(0x3c, 0); |
| 427 |
} |
| 428 |
|
| 429 |
/* |
| 430 |
====================================================================== |
| 431 |
For sending and receiving single bytes, you can use Randy's IC code: |
| 432 |
*/ |
| 433 |
|
| 434 |
void serial_putchar(int c) |
| 435 |
{ |
| 436 |
while (!(peek(0x102e) & 0x80)); /* wait until serial transmit empty |
| 437 |
*/ |
| 438 |
poke(0x102f, c); /* send character */ |
| 439 |
} |
| 440 |
|
| 441 |
int serial_getchar() |
| 442 |
{ |
| 443 |
while (!(peek(0x102e) & 0x20)); /* wait for received character */ |
| 444 |
return peek(0x102f); |
| 445 |
} |
| 446 |
|
| 447 |
void main(void) { |
| 448 |
int pos, c = ' ', var1, var2; |
| 449 |
float f1, f2; |
| 450 |
char buffer[80]; |
| 451 |
disable_pcode_serial(); |
| 452 |
beep(); |
| 453 |
printf("\nSerial IO Mode!"); |
| 454 |
printf("Listening..."); |
| 455 |
msleep(500L); |
| 456 |
while (c != 'q') { |
| 457 |
c = serial_getchar(); |
| 458 |
/* printf("[%d] ", c); */ |
| 459 |
if (c == MOTOR) { |
| 460 |
var1 = serial_getchar(); |
| 461 |
var2 = serial_getchar() - 100; |
| 462 |
motor(var1, var2); |
| 463 |
} else if (c == AO) { |
| 464 |
ao(); |
| 465 |
} else if (c == ANALOG) { |
| 466 |
var1 = serial_getchar(); |
| 467 |
serial_putchar(analog(var1)); |
| 468 |
} else if (c == DIGITAL) { |
| 469 |
var1 = serial_getchar(); |
| 470 |
serial_putchar(digital(var1)); |
| 471 |
} else if (c == PRINTF) { |
| 472 |
pos = 0; |
| 473 |
while (c != 0) { |
| 474 |
buffer[pos++] = c; |
| 475 |
c = serial_getchar(); |
| 476 |
} |
| 477 |
buffer[pos] = '\0'; |
| 478 |
printf(buffer); |
| 479 |
} else if (c == TONE) { |
| 480 |
pos = 0; |
| 481 |
c = serial_getchar(); |
| 482 |
while (c != 0) { |
| 483 |
buffer[pos++] = c; |
| 484 |
c = serial_getchar(); |
| 485 |
} |
| 486 |
buffer[pos] = '\0'; |
| 487 |
f1 = atof(buffer); |
| 488 |
pos = 0; |
| 489 |
c = serial_getchar(); |
| 490 |
while (c != 0) { |
| 491 |
buffer[pos++] = c; |
| 492 |
c = serial_getchar(); |
| 493 |
} |
| 494 |
buffer[pos] = '\0'; |
| 495 |
f2 = atof(buffer); |
| 496 |
tone(f1, f2); |
| 497 |
} else if (c == START_BUTTON) { |
| 498 |
serial_putchar(start_button()); |
| 499 |
} else if (c == STOP_BUTTON) { |
| 500 |
serial_putchar(stop_button()); |
| 501 |
} else if (c == BEEP) { |
| 502 |
beep(); |
| 503 |
} else if (c == KNOB) { |
| 504 |
serial_putchar(knob()); |
| 505 |
} |
| 506 |
} |
| 507 |
reenable_pcode_serial(); |
| 508 |
printf("\nHB Mode!"); |
| 509 |
} |
| 510 |
|
| 511 |
//************** END: serial_HB.c |
| 512 |
|
| 513 |
From [email protected] Tue Jul 7 20:33:03 1998 |
| 514 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 515 |
id AA32480; Tue, 7 Jul 1998 20:33:03 -0400 |
| 516 |
Received: from wormwood.ee.byu.edu (wormwood.ee.byu.edu [128.187.30.54]) |
| 517 |
by aleve.media.mit.edu (8.8.7/ML970927) with ESMTP id TAA30127 |
| 518 |
for <[email protected]>; Tue, 7 Jul 1998 19:48:43 -0400 (EDT) |
| 519 |
Received: from wormwood (localhost [127.0.0.1]) by wormwood.ee.byu.edu with SMTP (8.7.6/8.7.1) id RAA26916 for <[email protected]>; Tue, 7 Jul 1998 17:48:42 -0600 (MDT) |
| 520 |
Sender: [email protected] |
| 521 |
Message-Id: <[email protected]> |
| 522 |
Date: Tue, 07 Jul 1998 17:48:41 -0600 |
| 523 |
From: "Timothy B. Gold" <[email protected]> |
| 524 |
X-Mailer: Mozilla 3.04Gold (X11; I; HP-UX B.10.20 9000/780) |
| 525 |
Mime-Version: 1.0 |
| 526 |
To: [email protected] |
| 527 |
Subject: Interrupt Handler for Serial communication |
| 528 |
Content-Type: multipart/mixed; boundary="------------18CC6AC44E2E" |
| 529 |
|
| 530 |
This is a multi-part message in MIME format. |
| 531 |
|
| 532 |
--------------18CC6AC44E2E |
| 533 |
Content-Type: text/plain; charset=us-ascii |
| 534 |
Content-Transfer-Encoding: 7bit |
| 535 |
|
| 536 |
Here's a bit of code that will buffer incoming serial information so |
| 537 |
that no information will be lost when transmitting to the handy board. |
| 538 |
There are two files: serial_isr.c and serial_isr.asm. You'll need to |
| 539 |
assemble the .asm file using as11_ic, and then both the .c file and the |
| 540 |
.icb file need to be loaded onto the handy board. I'm sure improvements |
| 541 |
could be made to the code to clean it up a little, but it's a start (and |
| 542 |
I haven't had any problems with it yet). Enjoy! |
| 543 |
|
| 544 |
--------------18CC6AC44E2E |
| 545 |
Content-Type: text/plain; charset=us-ascii; name="serial_isr.c" |
| 546 |
Content-Transfer-Encoding: 7bit |
| 547 |
Content-Disposition: inline; filename="serial_isr.c" |
| 548 |
|
| 549 |
/* C program to read serial port with interrupt service routine */ |
| 550 |
/* First version: Written by Anton Wirsch 20 Nov 1997 */ |
| 551 |
|
| 552 |
/* |
| 553 |
|
| 554 |
Second Version: Written by Tim Gold 27 May 1998 |
| 555 |
BYU Robotics Lab |
| 556 |
[email protected] |
| 557 |
|
| 558 |
Really, the only thing left from the original code are a few |
| 559 |
lines in the .asm file. Everything else I pretty much had to |
| 560 |
rewrite from scratch to get it to work the way I wanted to. |
| 561 |
But the orignal code by Anton was a very helpful starting point. |
| 562 |
|
| 563 |
Needed files: serial_isr.c |
| 564 |
serial_isr.icb |
| 565 |
serial_isr.asm (needed to change the buffer size) |
| 566 |
|
| 567 |
The buffer size here is 32 bytes (probably much larger than it needs |
| 568 |
to be.) To change the buffer size, do the following: |
| 569 |
1. Change the BUFFER_SIZE constant below to the |
| 570 |
desired number of bytes. |
| 571 |
2. Edit the line(s) in the serial_isr.asm which contain |
| 572 |
the word "EDIT" in the comment so that the value |
| 573 |
matches that of BUFFER_SIZE. |
| 574 |
3. Recreate the serial_isr.icb file by typing the following: |
| 575 |
> as11_ic serial_isr.asm |
| 576 |
|
| 577 |
*/ |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
#define BUFFER_SIZE 32 /* change buffer size here -- see above */ |
| 583 |
|
| 584 |
/* various constants used by the program... */ |
| 585 |
#define BAUD 0x102b /* baud rate set to 9600 */ |
| 586 |
#define SCCR2 0x102d |
| 587 |
#define SCCR1 0x102c |
| 588 |
#define SCSR 0x102e |
| 589 |
#define SCDR 0x102f |
| 590 |
|
| 591 |
int buffer[BUFFER_SIZE]; /* this is the actual buffer */ |
| 592 |
|
| 593 |
|
| 594 |
void initSerial() |
| 595 |
{ |
| 596 |
/* Call this routine to activate the serial interrupt handler. */ |
| 597 |
int i,temp; |
| 598 |
|
| 599 |
/* clear out buffer */ |
| 600 |
for(i=0; i<BUFFER_SIZE; i++) |
| 601 |
buffer[i] = 0; |
| 602 |
|
| 603 |
/* clear vairous flags */ |
| 604 |
DATA_FLAG = 0; |
| 605 |
INCOMING = 0; |
| 606 |
CURRENT = 0; |
| 607 |
|
| 608 |
/* pass address of buffer to interrupt routine */ |
| 609 |
buffer_ptr = (int) buffer; |
| 610 |
BASE_ADDR = (int) buffer; |
| 611 |
|
| 612 |
/* activate interrupt routine */ |
| 613 |
temp = peek(SCCR2); |
| 614 |
temp |= 0x24; |
| 615 |
poke(SCCR2, temp); |
| 616 |
poke(0x3c, 1); |
| 617 |
} |
| 618 |
|
| 619 |
void closeSerial() |
| 620 |
{ |
| 621 |
int temp; |
| 622 |
|
| 623 |
/* deactivate the interrupt routine */ |
| 624 |
temp = peek(SCCR2); |
| 625 |
temp &= 0xdf; |
| 626 |
poke(SCCR2, temp); |
| 627 |
READ_SERIAL = 0x0000; |
| 628 |
poke(0x3c, 0); |
| 629 |
|
| 630 |
} |
| 631 |
|
| 632 |
void serialPutChar(int c) |
| 633 |
{ |
| 634 |
/* call this function to write a character to the serial port */ |
| 635 |
|
| 636 |
while (!(peek(0x102e) & 0x80)); |
| 637 |
poke(0x102f, c); |
| 638 |
|
| 639 |
} |
| 640 |
|
| 641 |
|
| 642 |
int dataAvailable() |
| 643 |
{ |
| 644 |
/* This function can be used to check to see if any data is available */ |
| 645 |
return DATA_FLAG; |
| 646 |
} |
| 647 |
|
| 648 |
|
| 649 |
int serialGetChar() |
| 650 |
{ |
| 651 |
/* Create blocking getchar for serial port... */ |
| 652 |
int return_char; |
| 653 |
|
| 654 |
/* loop until data is available */ |
| 655 |
while(!DATA_FLAG); |
| 656 |
|
| 657 |
/* get the character to return */ |
| 658 |
return_char = buffer[CURRENT]; |
| 659 |
|
| 660 |
/* check for wrap around... */ |
| 661 |
CURRENT++; |
| 662 |
if(CURRENT == BUFFER_SIZE) |
| 663 |
CURRENT = 0; |
| 664 |
if(CURRENT == INCOMING) |
| 665 |
DATA_FLAG = 0; |
| 666 |
return return_char; |
| 667 |
|
| 668 |
} |
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
--------------18CC6AC44E2E |
| 675 |
Content-Type: text/plain; charset=us-ascii; name="serial_isr.asm" |
| 676 |
Content-Transfer-Encoding: 7bit |
| 677 |
Content-Disposition: inline; filename="serial_isr.asm" |
| 678 |
|
| 679 |
/* This sets up the serial interrupt service routine */ |
| 680 |
/* First Version: Written by Anton L. Wirsch 20 Nov 1997 */ |
| 681 |
/* Second Version: Written by Tim Gold 27 May 1998 |
| 682 |
BYU Robotics Lab |
| 683 |
[email protected] |
| 684 |
|
| 685 |
Really, the only thing left from the original code are a few |
| 686 |
lines in the .asm file. Everything else I pretty much had to |
| 687 |
rewrite from scratch to get it to work the way I wanted to. |
| 688 |
But the orignal code by Anton was a very helpful starting point. |
| 689 |
|
| 690 |
Needed files: serial_isr.c |
| 691 |
serial_isr.icb |
| 692 |
serial_isr.asm (needed to change the buffer size) |
| 693 |
|
| 694 |
The buffer size here is 32 bytes (probably much larger than it needs |
| 695 |
to be.) To change the buffer size, do the following: |
| 696 |
1. Change the BUFFER_SIZE constant in serial_isr.c to the |
| 697 |
desired number of bytes. |
| 698 |
2. Edit the line in this fils which contains |
| 699 |
the word "EDIT" in the comment so that the value |
| 700 |
matches that of BUFFER_SIZE. |
| 701 |
3. Recreate the serial_isr.icb file by typing the following: |
| 702 |
> as11_ic serial_isr.asm |
| 703 |
*/ |
| 704 |
|
| 705 |
|
| 706 |
/* change this line to match your library path... */ |
| 707 |
#include "/usr/local/ic/libs/6811regs.asm" |
| 708 |
|
| 709 |
ORG MAIN_START |
| 710 |
variable_CURRENT: |
| 711 |
FDB 00 * ptr to next data to be read by user |
| 712 |
|
| 713 |
variable_INCOMING: |
| 714 |
FDB 00 * number of bytes received (circular count) |
| 715 |
|
| 716 |
variable_BASE_ADDR: |
| 717 |
FDB 00 * base address of buffer (to be set by init routine) |
| 718 |
|
| 719 |
variable_DATA_FLAG: |
| 720 |
FDB 00 * flag set when data is available |
| 721 |
|
| 722 |
variable_buffer_ptr: |
| 723 |
FDB 00 * pointer to CURRENT buffer |
| 724 |
|
| 725 |
subroutine_initialize_module: |
| 726 |
/* change this line to match your library path... */ |
| 727 |
#include "/usr/local/ic/libs/ldxibase.asm" |
| 728 |
|
| 729 |
ldd SCIINT,X |
| 730 |
std interrupt_code_exit+1 |
| 731 |
ldd #interrupt_code_start |
| 732 |
std SCIINT,X |
| 733 |
|
| 734 |
rts |
| 735 |
|
| 736 |
interrupt_code_start: |
| 737 |
ldad variable_INCOMING * store INCOMING into AB |
| 738 |
cmpb #00 * compare B with 0 |
| 739 |
bhi skip * goto "skip" if (B > 0) |
| 740 |
ldx variable_BASE_ADDR * STORE ADDRESS OF ARRY IN X |
| 741 |
inx * SKIP THE FIRST (?) |
| 742 |
inx * TWO BYTES (?) |
| 743 |
inx * OFFSET TO THE HIGHER BYTE (?) |
| 744 |
stx variable_buffer_ptr * SAVE PTR VALUE |
| 745 |
bra cont |
| 746 |
|
| 747 |
skip: |
| 748 |
ldx variable_buffer_ptr * load buffer pointer into x |
| 749 |
cont: |
| 750 |
ldad variable_INCOMING * load INCOMING into AB |
| 751 |
incb * increment INCOMING |
| 752 |
cmpb #32 * compare B and 32 --EDIT TO CHANGE BUFFER SIZE-- |
| 753 |
beq reset_count * if a=32, goto reset_count |
| 754 |
bra cont1 |
| 755 |
reset_count: |
| 756 |
ldad #00 * set count to zero |
| 757 |
cont1: |
| 758 |
stad variable_INCOMING * store AB into INCOMING |
| 759 |
|
| 760 |
ldab SCSR * load SCSR (SCI status register) into B (why?) |
| 761 |
ldab SCDR * load SCSR (SCI data register) into B |
| 762 |
|
| 763 |
stab ,X * store data in array |
| 764 |
inx * increment by two bytes |
| 765 |
inx |
| 766 |
stx variable_buffer_ptr * save the pointer value |
| 767 |
ldad #01 * load 1 into AB |
| 768 |
stad variable_DATA_FLAG * store AB into DATA_FLAG (indicating data is available) |
| 769 |
interrupt_code_exit: |
| 770 |
jmp $0000 |
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
--------------18CC6AC44E2E-- |
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
From [email protected] Thu Jul 16 03:42:38 1998 |
| 792 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 793 |
id AA24945; Thu, 16 Jul 1998 03:42:38 -0400 |
| 794 |
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1]) |
| 795 |
by aleve.media.mit.edu (8.8.7/ML970927) with SMTP id CAA07415 |
| 796 |
for <[email protected]>; Thu, 16 Jul 1998 02:44:58 -0400 (EDT) |
| 797 |
Received: from Aus.Sun.COM ([129.158.80.6]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id XAA29734; Wed, 15 Jul 1998 23:44:52 -0700 |
| 798 |
Received: from war.Aus.Sun.COM by Aus.Sun.COM id QAA03011 |
| 799 |
(SMI-8.6/SMI-4.1 for <>); Thu, 16 Jul 1998 16:44:50 +1000 |
| 800 |
Received: from drone by war.Aus.Sun.COM (SMI-8.6/SMI-SVR4) |
| 801 |
id QAA10921; Thu, 16 Jul 1998 16:44:20 +1000 |
| 802 |
Message-Id: <[email protected]> |
| 803 |
Date: Thu, 16 Jul 1998 16:41:56 +1000 (EST) |
| 804 |
From: Scott Seaton - Systems Consultant - ESG <[email protected]> |
| 805 |
Reply-To: Scott Seaton - Systems Consultant - ESG <[email protected]> |
| 806 |
Subject: Re: Handyboard/RWP without p-code |
| 807 |
To: [email protected], [email protected] |
| 808 |
Mime-Version: 1.0 |
| 809 |
Content-Type: MULTIPART/mixed; BOUNDARY=Troop_of_Baboons_752_000 |
| 810 |
X-Mailer: dtmail 1.2.0 CDE Version 1.2 SunOS 5.6 sun4u sparc |
| 811 |
|
| 812 |
--Troop_of_Baboons_752_000 |
| 813 |
Content-Type: TEXT/plain; charset=us-ascii |
| 814 |
Content-MD5: i/HKSIa/Vk0mZT5ml+q21A== |
| 815 |
|
| 816 |
Hi |
| 817 |
|
| 818 |
I suggest that you contact ImageCraft. |
| 819 |
http://www.imagecraft.com/software/index.html or [email protected] |
| 820 |
|
| 821 |
They have a C compiler for 68HC11 CPU's that will do what you want, including a |
| 822 |
library for the HandyBoard (see attached e-mail) ! |
| 823 |
|
| 824 |
I have no affiliation with ImageCraft (other than as a satisfied customer). |
| 825 |
|
| 826 |
Hope this helps |
| 827 |
Scott |
| 828 |
============================================================================== |
| 829 |
,-_|\ Scott Seaton - Sun Enterprise Services - Systems Consultant |
| 830 |
/ \ Sun Microsystems Australia Pty Ltd E-mail : [email protected] |
| 831 |
\_,-\_+ 828 Pacific Highway Phone : +61 2 9844 5381 |
| 832 |
v Gordon, N.S.W., 2072, AUSTRALIA Fax : +61 2 9844 5161 |
| 833 |
============================================================================== |
| 834 |
|
| 835 |
--Troop_of_Baboons_752_000 |
| 836 |
Content-Type: MESSAGE/rfc822; name=Mailbox |
| 837 |
Content-Description: Mailbox |
| 838 |
|
| 839 |
From [email protected] Fri Jul 10 18:59:26 1998 |
| 840 |
Return-Path: <[email protected]> |
| 841 |
Received: from Aus.Sun.COM by war.Aus.Sun.COM (SMI-8.6/SMI-SVR4) |
| 842 |
id SAA14426; Fri, 10 Jul 1998 18:59:26 +1000 |
| 843 |
Received: from earth.sun.com by Aus.Sun.COM id SAA24238 |
| 844 |
(SMI-8.6/SMI-4.1 for <<[email protected]>>); Fri, 10 Jul 1998 18:59:48 +1000 |
| 845 |
Received: from iisesun.iise.CSIRO.AU (iisesun.iise.csiro.au [130.155.5.44]) |
| 846 |
by earth.sun.com (8.8.8/8.8.8) with SMTP id BAA18609 |
| 847 |
for <[email protected]>; Fri, 10 Jul 1998 01:59:44 -0700 (PDT) |
| 848 |
Received: from lists1.best.com (lists1.best.com [206.86.8.15]) by iisesun.iise.CSIRO.AU (SMI-8.6/8.6.12-IISE-SWA) with ESMTP id SAA25847 for <[email protected]>; Fri, 10 Jul 1998 18:49:31 +1000 |
| 849 |
Received: (from daemon@localhost) by lists1.best.com (8.9.0/8.8.BEST) id BAA15320 for [email protected]; Fri, 10 Jul 1998 01:04:34 -0700 (PDT) |
| 850 |
Message-Id: <[email protected]> |
| 851 |
From: Christina Willrich & Richard Man <[email protected]> |
| 852 |
Subject: icc11 Handyboard library available |
| 853 |
Date: Fri, 10 Jul 1998 00:58:49 -0700 |
| 854 |
BestServHost: lists.best.com |
| 855 |
MIME-Version: 1.0 |
| 856 |
Content-Type: text/plain; charset="us-ascii" |
| 857 |
Sender: [email protected] |
| 858 |
Errors-To: [email protected] |
| 859 |
Reply-To: [email protected] |
| 860 |
To: [email protected] |
| 861 |
content-length: 399 |
| 862 |
Status: RO |
| 863 |
X-Status: $$$$ |
| 864 |
X-UID: 0000000001 |
| 865 |
|
| 866 |
At long last, I dusted off Chuck McManis Handyboard library and ported it |
| 867 |
to V5. No reason why it can't work with V4.5 either ;-) Anyway, to try it |
| 868 |
out, point your browser to |
| 869 |
|
| 870 |
ftp://ftp.imagecraft.com/pub/libhb.zip |
| 871 |
|
| 872 |
Chuck really did a great job with the LCD. There are commands to scroll, |
| 873 |
move etc. Make sure you try the lcdtest2.c test. |
| 874 |
|
| 875 |
// richard |
| 876 |
[email protected] http://www.imagecraft.com |
| 877 |
|
| 878 |
|
| 879 |
--Troop_of_Baboons_752_000-- |
| 880 |
|
| 881 |
From [email protected] Sun Mar 22 01:52:45 1998 |
| 882 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 883 |
id AA06355; Sun, 22 Mar 1998 01:52:45 -0500 |
| 884 |
Received: from cyber.sfgate.com (cyber.sfgate.com [198.93.154.11]) |
| 885 |
by aleve.media.mit.edu (8.8.7/ML970927) with SMTP id BAA23676 |
| 886 |
for <[email protected]>; Sun, 22 Mar 1998 01:08:09 -0500 (EST) |
| 887 |
Received: from localhost by cyber.sfgate.com with smtp |
| 888 |
(Smail3.2 #1) id m0yGduz-000Is1C; Sat, 21 Mar 1998 22:07:37 -0800 (PST) |
| 889 |
Date: Sat, 21 Mar 1998 22:07:37 -0800 (PST) |
| 890 |
From: Richard <[email protected]> |
| 891 |
X-Sender: rshirk@cyber |
| 892 |
To: [email protected] |
| 893 |
Subject: Frob nobs and IR |
| 894 |
Message-Id: <Pine.SOL.3.96.980321212443.21628C-200000@cyber> |
| 895 |
Mime-Version: 1.0 |
| 896 |
Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1804928587-890546857=:21628" |
| 897 |
|
| 898 |
This message is in MIME format. The first part should be readable text, |
| 899 |
while the remaining parts are likely unreadable without MIME-aware tools. |
| 900 |
Send mail to [email protected] for more info. |
| 901 |
|
| 902 |
---559023410-1804928587-890546857=:21628 |
| 903 |
Content-Type: TEXT/PLAIN; charset=US-ASCII |
| 904 |
|
| 905 |
OK...Im now pretty happy with states of things but I still have a few |
| 906 |
questions I hope you can help me answer. The code attached works and |
| 907 |
everything, but only when i take the bit about playing the songs out. |
| 908 |
|
| 909 |
problem 1) |
| 910 |
It |
| 911 |
keeps saying that play is undefined. I saw that before and fixed it by |
| 912 |
changing the names of the labels of the songs. I tried it this time and |
| 913 |
it didnt work...i was wondering if anyone out there knows why it does this |
| 914 |
and how to correct it.... |
| 915 |
|
| 916 |
problem 2) |
| 917 |
|
| 918 |
I figured out (thanks to you guys) how to work the built in IR sensor to |
| 919 |
detect and act upon 4 signals. One is for behing hostile, 3 is for |
| 920 |
seeking, signal 5 is when it gets annoyed, and 7 it just beeps and ignores |
| 921 |
it. |
| 922 |
The signal for being Hostile responds quickly and prints H on the screen |
| 923 |
but the others lag and i was wondering if you knew why this was. |
| 924 |
|
| 925 |
-Richard |
| 926 |
|
| 927 |
---559023410-1804928587-890546857=:21628 |
| 928 |
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="xbump2.c" |
| 929 |
Content-Transfer-Encoding: BASE64 |
| 930 |
Content-ID: <Pine.SOL.3.96.980321220737.21628D@cyber> |
| 931 |
Content-Description: |
| 932 |
|
| 933 |
LyogVGhpcyBpcyAoc2xpZ2h0bHkgbW9kaWZpZWQpIGRlZmF1bHQgdG91Y2gg |
| 934 |
bmF2aWdhdGlvbiAqLw0gICAgICAgICBjaGFyIHBuX3NvbmdbXT0gIjEjZCA0 |
| 935 |
ZTNyMSNmNGczcjEjZCAzZTEjZjNnMWMzYkQxZTNnMWIgOCZiMmIyYTJnMmUy |
| 936 |
ZDEwZSAgICAgIDdyMSNkIDRlM3IxI2Y0ZzNyMSNkIDNlMSNmM2cxYzNiMWcz |
| 937 |
YjFlIDI4JmUgRDNyMSNkIDRlM3IxI2Y0ZzNyMSNkICAgICAgM2UxI2YzZzFj |
| 938 |
M2JEMWUzZzFiIDgmYjJiMmEyZzJlMmQxMGUgMTJyIFUzZTFkM2IxYTNnMSNm |
| 939 |
ICAgICAgMSZiM2ExJmIzYTEmYjNhMSZiM2EgMmcyZTJkMjBlIjsNDSAgY2hh |
| 940 |
ciBsdHVuZV9zb25nW109ICJVM2UxZDJjMmQyZTJkMmUyYzJkMmQyZDZkMnIg |
| 941 |
M2QxYzJiMmMyZDIjYzJkMmIyYzJjMmM2YyI7DQ0Ndm9pZCBtYWluKCApDXsN |
| 942 |
ICAgLyogdGltaW5nIHBhcmFtZXRlcnMgKG1pbGxpc2Vjb25kcykgKi8NICAg |
| 943 |
bG9uZyByZXZlcnNlX3RpbWUgPSA1MDBMLCB0dXJuX3RpbWUgPSA1MDBMLCB0 |
| 944 |
dXJuYXJvdW5kX3RpbWUgPSAxMDAwTDsNICAgIHNvbnlfaW5pdCAoMSk7DSAg |
| 945 |
ICBwcmludGYoIkF1dG9ub21vdXNcbiIpOw0gICAgbXNsZWVwKDUwMEwpOw0g |
| 946 |
ICAgcHJpbnRmKCJSb2JvdGljXG4iKTsNICAgIG1zbGVlcCg1MDBMKTsNICAg |
| 947 |
IHByaW50ZigiTmF2aWdhdGlvblxuIik7DSAgICBtc2xlZXAoNTAwTCk7DSAg |
| 948 |
ICB7DSAgICAgICAgIGlmICgoIGtub2IoICkgKSA9PSAyNTUpDSAgICAgICAg |
| 949 |
IHsNICAgICAgICAgICAgICAgcGxheSAocG5fc29uZyk7DSAgICAgICAgICB9 |
| 950 |
DSAgICAgICAgICBlbHNlIGlmICgoIGtub2IoICkgKSA9PSAwKQ0gICAgICAg |
| 951 |
ICAgew0gICAgICAgICAgICAgICAgcGxheSAobHR1bmVfc29uZyk7DSAgICAg |
| 952 |
ICAgICB9DSAgICAgICAgICAgICAgICBlbHNlIGlmICgoIGtub2IoICkgKSA9 |
| 953 |
PSAxMTYpDSAgICAgICAgICB7DSAgICAgICAgICAgICAgICBwcmludGYoIkhF |
| 954 |
TExPLCBKVURHRVMhXG4iKTsNICAgICAgICAgICAgICAgIG1zbGVlcCg1MDBM |
| 955 |
KTsNICAgICAgICAgIH0NICAgIH0NDSAgIHByaW50ZiggIlByZXNzIFNUQVJU |
| 956 |
XG4iICk7DSAgIHN0YXJ0X3ByZXNzKCk7ICAgLyogd2FpdCAndGlsIGJ1dHRv |
| 957 |
biBpcyBwcmVzc2VkICovDSAgIGJlZXAoKTsNICAgcHJpbnRmKCAiU3RhbmQg |
| 958 |
YmFjay4uLlxuIiApOw0gICBzbGVlcCggMS4wICk7IA0gICAvKiBpbml0aWF0 |
| 959 |
ZSBmb3J3YXJkIG1vdGlvbiAqLw0gICBmZCggMiApOw0gICBmZCggMyApOw0g |
| 960 |
ICB3aGlsZSggMSApICAgLyogZmVlZGJhY2sgbG9vcCAqLw0gICB7DSAgICAg |
| 961 |
IGlmKCAhIGRpZ2l0YWwoIDcgKSApICAgLyogY2hlY2sgbGVmdCBidW1wZXIg |
| 962 |
Ki8NICAgICAgew0gICAgICAgICAvKiByZXZlcnNlICovDSAgICAgICAgIGJl |
| 963 |
ZXAoKTsNICAgICAgICAgYmsoIDIgKTsNICAgICAgICAgYmsoIDMgKTsNICAg |
| 964 |
ICAgICAgbXNsZWVwKCByZXZlcnNlX3RpbWUgKTsNDSAgICAgICAgIC8qIHR1 |
| 965 |
cm4gcmlnaHQgKi8NICAgICAgICAgZmQoIDIgKTsNICAgICAgICAgYmsoIDMg |
| 966 |
KTsNICAgICAgICAgbXNsZWVwKCB0dXJuX3RpbWUgKTsNDSAgICAgICAgIC8q |
| 967 |
IHJlc2V0IGZvcndhcmQgbW90aW9uICovDSAgICAgICAgIHByaW50ZiggIjAi |
| 968 |
ICk7DSAgICAgICAgIGZkKCAyICk7DSAgICAgICAgIGZkKCAzICk7DQ0gICAg |
| 969 |
ICB9DQ0gICAgICBlbHNlIGlmKCAhIGRpZ2l0YWwoIDExICkgKSAgIC8qIGNo |
| 970 |
ZWNrIG1pZGRsZSBidW1wZXIgKi8NICAgICAgew0gICAgICAgICAvKiByZXZl |
| 971 |
cnNlICovDSAgICAgICAgIGJlZXAoKTsNICAgICAgICAgYmsoIDIgKTsNICAg |
| 972 |
ICAgICAgYmsoIDMgKTsNICAgICAgICAgbXNsZWVwKCByZXZlcnNlX3RpbWUg |
| 973 |
KTsNDSAgICAgICAgIC8qIHR1cm4gYXJvdW5kICovDSAgICAgICAgIGZkKCAy |
| 974 |
ICk7DSAgICAgICAgIGJrKCAzICk7DSAgICAgICAgIG1zbGVlcCggdHVybmFy |
| 975 |
b3VuZF90aW1lICk7DQ0gICAgICAgICAvKiByZXNldCBmb3J3YXJkIG1vdGlv |
| 976 |
biAqLw0gICAgICAgICBwcmludGYoICIxIiApOw0gICAgICAgICBmZCggMiAp |
| 977 |
Ow0gICAgICAgICBmZCggMyApOw0gICAgICB9DQ0gICAgICBlbHNlIGlmKCAh |
| 978 |
IGRpZ2l0YWwoIDE1ICkgKSAgIC8qIGNoZWNrIHJpZ2h0IGJ1bXBlciAqLw0g |
| 979 |
ICAgICB7DSAgICAgICAgIC8qIHJldmVyc2UgKi8NICAgICAgICAgYmVlcCgp |
| 980 |
Ow0gICAgICAgICBiayggMiApOw0gICAgICAgICBiayggMyApOw0gICAgICAg |
| 981 |
ICBtc2xlZXAoIHJldmVyc2VfdGltZSApOw0NICAgICAgICAgLyogdHVybiBs |
| 982 |
ZWZ0ICovDSAgICAgICAgIGJrKCAyICk7DSAgICAgICAgIGZkKCAzICk7DSAg |
| 983 |
ICAgICAgIG1zbGVlcCggdHVybl90aW1lICk7DQ0gICAgICAgICAvKiByZXNl |
| 984 |
dCBmb3J3YXJkIG1vdGlvbiAqLw0gICAgICAgICBwcmludGYoICIyIiApOw0g |
| 985 |
ICAgICAgICBmZCggMiApOw0gICAgICAgICBmZCggMyApOw0gICAgIH0NICAg |
| 986 |
ICBlbHNlIGlmKGlyX2RhdGEoIDAgKSA9PSAxMjggKSAvKkNoZWNrIElSIHJl |
| 987 |
Y2lldmVyKi8NICAgICAgew0gICAgICAgICAgcHJpbnRmKCJIIik7DSAgICAg |
| 988 |
ICAgIC8qIHR1cm4gcmlnaHQgKi8NICAgICAgICAgZmQoIDIgKTsNICAgICAg |
| 989 |
ICAgYmsoIDMgKTsNICAgICAgICAgbXNsZWVwKCB0dXJuX3RpbWUgKTsNICAg |
| 990 |
ICAgICAgIC8qQXR0YWNrLi4uUm9ib3QgaXMgSG9zdGlsZSAqLw0gICAgICAg |
| 991 |
ICAgYmVlcCgpOyANICAgICAgICAgIGZkKCAyICk7DSAgICAgICAgICBmZCgg |
| 992 |
MyApOw0gICAgICAgICAgYmVlcCgpOw0gICAgIH0NICAgICBlbHNlIGlmKGly |
| 993 |
X2RhdGEoIDAgKSA9PSAxMzAgKSAvKkNoZWNrIElSIHJlY2lldmVyKi8NICAg |
| 994 |
ICAgew0gICAgICAgICAgcHJpbnRmKCJTIik7DSAgICAgICAgIC8qIHR1cm4g |
| 995 |
cmlnaHQgKi8NICAgICAgICAgZmQoIDIgKTsNICAgICAgICAgYmsoIDMgKTsN |
| 996 |
ICAgICAgICAgbXNsZWVwKCB0dXJuX3RpbWUgKTsNICAgICAgICAgIC8qUm9i |
| 997 |
b3QgaXMgaW4gbG92ZSEgRG8gYSBsaWwgZGFuY2UhICovDSAgICAgICAgICBi |
| 998 |
ZWVwKCk7DSAgICAgICAgICBiZWVwKCk7IA0gICAgICAgICAgZmQoIDIgKTsN |
| 999 |
ICAgICAgICAgIGZkKCAzICk7DSAgICAgICAgICBtc2xlZXAoIHR1cm5fdGlt |
| 1000 |
ZSApOw0gICAgICAgICAgYmsoIDIgKTsNICAgICAgICAgIGJrKCAzICk7DSAg |
| 1001 |
ICAgICAgICBtc2xlZXAoIHJldmVyc2VfdGltZSApOyANICAgICAgICAgIC8q |
| 1002 |
R28gZm9yd2FyZCEqLw0gICAgICAgICAgZmQoIDIgKTsNICAgICAgICAgIGZk |
| 1003 |
KCAzICk7DSAgICAgICAgICBiZWVwKCk7DSAgICAgICAgICBiZWVwKCk7DSAg |
| 1004 |
ICAgfQ0gICAgIGVsc2UgaWYoaXJfZGF0YSggMCApID09IDEzMiApIC8qQ2hl |
| 1005 |
Y2sgSVIgcmVjaWV2ZXIqLw0gICAgICB7DSAgICAgICAgICBwcmludGYoIkEi |
| 1006 |
KTsNICAgICAgICAvKiByZXZlcnNlICovDSAgICAgICAgIGJlZXAoKTsNICAg |
| 1007 |
ICAgICAgYmsoIDIgKTsNICAgICAgICAgYmsoIDMgKTsNICAgICAgICAgbXNs |
| 1008 |
ZWVwKCByZXZlcnNlX3RpbWUgKTsNICAgICAgICAgIC8qUm9ib3QgaXMgQW5u |
| 1009 |
b3llZCEgVHVybnMgY29tcGxldGVseSBhcm91bmQgaW4gZGlndXN0Ki8gICAg |
| 1010 |
ICAgDSAgICAgICAgIGJlZXAoKTsNICAgICAgICAgYmVlcCgpOyANICAgICAg |
| 1011 |
ICAgYmVlcCgpOw0gICAgICAgICBmZCggMiApOw0gICAgICAgICBiayggMyAp |
| 1012 |
Ow0gICAgICAgICBtc2xlZXAoIHR1cm5hcm91bmRfdGltZSApOw0gICAgICAg |
| 1013 |
ICAgZmQoIDIgKTsNICAgICAgICAgIGZkKCAzICk7DSAgICAgICAgICBiZWVw |
| 1014 |
KCk7DSAgICAgICAgICBiZWVwKCk7IA0gICAgICAgICAgYmVlcCgpOw0NICAg |
| 1015 |
ICB9DSAgICAgZWxzZSBpZihpcl9kYXRhKCAwICkgPT0gMTM0ICkgLypDaGVj |
| 1016 |
ayBJUiByZWNpZXZlciovDSAgICAgIHsNICAgICAgICAgIHByaW50ZigiSSIp |
| 1017 |
Ow0gICAgICAgICAgLypSb2JvdCBkb2Vzbid0IGNhcmUgKi8NICAgICAgICAg |
| 1018 |
IGJlZXAoKTsgDSAgICAgICAgICBiZWVwKCk7DSAgICAgICAgICBiZWVwKCk7 |
| 1019 |
IA0gICAgICAgICAgYmVlcCgpOw0gICAgICAgICAgZmQoIDIgKTsNICAgICAg |
| 1020 |
ICAgIGZkKCAzICk7DSAgICAgICAgICBiZWVwKCk7DSAgICAgICAgICBiZWVw |
| 1021 |
KCk7DSAgICAgICAgICBiZWVwKCk7IA0gICAgICAgICAgYmVlcCgpOw0gDSAg |
| 1022 |
ICB9DQ0gICB9DX0N |
| 1023 |
---559023410-1804928587-890546857=:21628-- |
| 1024 |
|
| 1025 |
From [email protected] Mon Jul 27 18:34:05 1998 |
| 1026 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 1027 |
id AA00723; Mon, 27 Jul 1998 18:34:05 -0400 |
| 1028 |
Received: from theory.phys.vt.edu (theory.phys.vt.edu [128.173.176.33]) |
| 1029 |
by aleve.media.mit.edu (8.8.7/ML970927) with ESMTP id RAA19984 |
| 1030 |
for <[email protected]>; Mon, 27 Jul 1998 17:22:26 -0400 (EDT) |
| 1031 |
Received: from localhost (wallace@localhost) |
| 1032 |
by theory.phys.vt.edu (8.8.5/8.8.5) with SMTP id RAA00312 |
| 1033 |
for <[email protected]>; Mon, 27 Jul 1998 17:22:24 -0400 (EDT) |
| 1034 |
Date: Mon, 27 Jul 1998 17:22:24 -0400 (EDT) |
| 1035 |
From: Mark Wallace <[email protected]> |
| 1036 |
To: [email protected] |
| 1037 |
Subject: sonar.c for the handyboard |
| 1038 |
Message-Id: <[email protected]> |
| 1039 |
Mime-Version: 1.0 |
| 1040 |
Content-Type: TEXT/PLAIN; charset=US-ASCII |
| 1041 |
|
| 1042 |
Hello, |
| 1043 |
I have a handyboard and 6500 series poloroid ultrasonic ranging |
| 1044 |
system. I have downloaded the sonar.c programs used to drive the |
| 1045 |
transducer for distance measurements. There appears to be a problem, or |
| 1046 |
atleast I think there is, with it. The sonar device is supposed to give |
| 1047 |
distances of up to 35ft but the TCNC time register is 16 bit and in the |
| 1048 |
program it says "if ((peekwork(0x100e)-start_time) < 0)" too much time has |
| 1049 |
elapsed and it returns -1. Therefore as soon as about 32700 counts goes |
| 1050 |
by, that value will go negative. I believe hex goes from 0 to 32768 then |
| 1051 |
-32768 to -1. In this case the difference will be < 0 if the object |
| 1052 |
is greater then about 9 ft. I have taken this out of the program and can |
| 1053 |
get accurate measurements up to atleast 30 ft but I have to look at the |
| 1054 |
value given and add multiples of 2^16 to it to figure out where it is. |
| 1055 |
Taking this out of the program also can get you stuck if you really are |
| 1056 |
out of range. |
| 1057 |
I have looked on the motorola web pages to see about this clock |
| 1058 |
and it says that the clock goes till it reachs $ffff and then flags |
| 1059 |
somewhere that there is an overflow and then starts over. I don't know |
| 1060 |
how to find out were in the chip this information might be stored. I know |
| 1061 |
the TCNT time register is at 0x100e from the notes on Simplified Sonar for |
| 1062 |
the Handy Board but I don't know where that overflow flag is stored. I |
| 1063 |
thought that maybe by setting this flag and using it in the loop you might |
| 1064 |
be about to get a greater distance out of you measurement. |
| 1065 |
Another question I have is about IC. I would like to display |
| 1066 |
numbers greater then 32000 and right now there are several int type |
| 1067 |
variables and normal C comands don't seem to work to make a "long" or any |
| 1068 |
other type that are larger then 32000. How does IC handle larger numbers? |
| 1069 |
I am only a student and don't have much experience with this stuff |
| 1070 |
so I would appreciate any feedback I can get on either of these problems. |
| 1071 |
Thanks. |
| 1072 |
|
| 1073 |
Mark Wallace |
| 1074 |
|
| 1075 |
e-mail [email protected] |
| 1076 |
[email protected] |
| 1077 |
Web page http://sps1.phys.vt.edu/~mwallace/index.html |
| 1078 |
|
| 1079 |
"What a waste it would be after 4 billion tortuous years of evolution if |
| 1080 |
the dominant organism contrived its own self-destruction" |
| 1081 |
Carl Sagan |
| 1082 |
|
| 1083 |
|
| 1084 |
From [email protected] Mon Aug 3 12:05:51 1998 |
| 1085 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 1086 |
id AA15988; Mon, 3 Aug 1998 12:05:51 -0400 |
| 1087 |
Received: from sps1.phys.vt.edu (sps1.phys.vt.edu [128.173.176.53]) |
| 1088 |
by aleve.media.mit.edu (8.8.7/ML970927) with ESMTP id LAA12381 |
| 1089 |
for <[email protected]>; Mon, 3 Aug 1998 11:16:53 -0400 (EDT) |
| 1090 |
Received: from localhost (mwallace@localhost) |
| 1091 |
by sps1.phys.vt.edu (8.8.7/8.8.7) with SMTP id LAA20283; |
| 1092 |
Mon, 3 Aug 1998 11:16:50 -0400 |
| 1093 |
Date: Mon, 3 Aug 1998 11:16:50 -0400 (EDT) |
| 1094 |
From: Mark Wallace <[email protected]> |
| 1095 |
To: [email protected] |
| 1096 |
Cc: [email protected] |
| 1097 |
Subject: Re: Polaroid trouble again |
| 1098 |
In-Reply-To: <[email protected]> |
| 1099 |
Message-Id: <[email protected]> |
| 1100 |
Mime-Version: 1.0 |
| 1101 |
Content-Type: TEXT/PLAIN; charset=US-ASCII |
| 1102 |
|
| 1103 |
I had this same problem when I got mine a few weeks ago. I ended up |
| 1104 |
putting a capacitor from pin 1 to pin 3 on U2 of the sonar driver board. |
| 1105 |
I also had to take out the 1k resistor from the BINH. It kept |
| 1106 |
BINH at 1 V instead of Zero and that seamed to cause problems. |
| 1107 |
As for the 6 ft problem, it should be closer to 9 ft. I think |
| 1108 |
the problem there is the IC code you used. If you used the code for |
| 1109 |
SONAR.C from the HB web site then there is a problem with it. What that |
| 1110 |
program does is take the difference in time from the internal clock. the |
| 1111 |
problem is that in the code it says that if the difference between start |
| 1112 |
time and currnet time is negative too much time has elapsed. Well, this |
| 1113 |
has a 16 bit counter so when the difference is greater the about 32,700 it |
| 1114 |
becomes negative. If you do the math, that means at about 9 ft that |
| 1115 |
happens so it tell you you are out of range. |
| 1116 |
The way I fixed this was to slow the clock down. |
| 1117 |
|
| 1118 |
I looked up information on the motorola web page and found where the |
| 1119 |
prescalers were for the clock. |
| 1120 |
If you want to slow it down by a factor of four you can just add |
| 1121 |
this line to you program in sonar_init() |
| 1122 |
|
| 1123 |
bit_set(0x1024, 1); |
| 1124 |
|
| 1125 |
I believe bit_set(0x1024, 2); will slow it down by a factor of 8 and |
| 1126 |
bit_set(0x1024, 3); will slow it down by a factor of 16. |
| 1127 |
There are better ways of fixing this problem but they appear much |
| 1128 |
more complicated. For example the motorola chip has an overflow flag that |
| 1129 |
says when the internal clock flips. You could incorporate that into your |
| 1130 |
code instead of slowing the clock down. Good luck and I hope this helps. |
| 1131 |
|
| 1132 |
Mark Wallace |
| 1133 |
|
| 1134 |
e-mail [email protected] |
| 1135 |
[email protected] |
| 1136 |
Web page http://sps1.phys.vt.edu/~mwallace/index.html |
| 1137 |
|
| 1138 |
"What a waste it would be after 4 billion tortuous years of evolution if |
| 1139 |
the dominant organism contrived its own self-destruction" |
| 1140 |
Carl Sagan |
| 1141 |
|
| 1142 |
On Mon, 3 Aug 1998, Alf Kuchenbuch wrote: |
| 1143 |
|
| 1144 |
> Hi! |
| 1145 |
> I am having trouble with my Polaroid sonar: |
| 1146 |
> When I keep my HB hooked up |
| 1147 |
> to external power, I will only get correct readings up to 20 inches. As |
| 1148 |
> soon as I use battery power without hooking it up to external power, the |
| 1149 |
> readings are correct up to 6 feet, not more! This sound like EMI, I |
| 1150 |
> guess. I tried all the capacitor tricks from HB mailing list, but in |
| 1151 |
> vain. Do you know a fix that works? |
| 1152 |
> |
| 1153 |
> Alf H. Kuchenbuch |
| 1154 |
> |
| 1155 |
|
| 1156 |
|
| 1157 |
From [email protected] Thu Jul 16 03:42:38 1998 |
| 1158 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 1159 |
id AA24945; Thu, 16 Jul 1998 03:42:38 -0400 |
| 1160 |
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1]) |
| 1161 |
by aleve.media.mit.edu (8.8.7/ML970927) with SMTP id CAA07415 |
| 1162 |
for <[email protected]>; Thu, 16 Jul 1998 02:44:58 -0400 (EDT) |
| 1163 |
Received: from Aus.Sun.COM ([129.158.80.6]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id XAA29734; Wed, 15 Jul 1998 23:44:52 -0700 |
| 1164 |
Received: from war.Aus.Sun.COM by Aus.Sun.COM id QAA03011 |
| 1165 |
(SMI-8.6/SMI-4.1 for <>); Thu, 16 Jul 1998 16:44:50 +1000 |
| 1166 |
Received: from drone by war.Aus.Sun.COM (SMI-8.6/SMI-SVR4) |
| 1167 |
id QAA10921; Thu, 16 Jul 1998 16:44:20 +1000 |
| 1168 |
Message-Id: <[email protected]> |
| 1169 |
Date: Thu, 16 Jul 1998 16:41:56 +1000 (EST) |
| 1170 |
From: Scott Seaton - Systems Consultant - ESG <[email protected]> |
| 1171 |
Reply-To: Scott Seaton - Systems Consultant - ESG <[email protected]> |
| 1172 |
Subject: Re: Handyboard/RWP without p-code |
| 1173 |
To: [email protected], [email protected] |
| 1174 |
Mime-Version: 1.0 |
| 1175 |
Content-Type: MULTIPART/mixed; BOUNDARY=Troop_of_Baboons_752_000 |
| 1176 |
X-Mailer: dtmail 1.2.0 CDE Version 1.2 SunOS 5.6 sun4u sparc |
| 1177 |
|
| 1178 |
--Troop_of_Baboons_752_000 |
| 1179 |
Content-Type: TEXT/plain; charset=us-ascii |
| 1180 |
Content-MD5: i/HKSIa/Vk0mZT5ml+q21A== |
| 1181 |
|
| 1182 |
Hi |
| 1183 |
|
| 1184 |
I suggest that you contact ImageCraft. |
| 1185 |
http://www.imagecraft.com/software/index.html or [email protected] |
| 1186 |
|
| 1187 |
They have a C compiler for 68HC11 CPU's that will do what you want, including a |
| 1188 |
library for the HandyBoard (see attached e-mail) ! |
| 1189 |
|
| 1190 |
I have no affiliation with ImageCraft (other than as a satisfied customer). |
| 1191 |
|
| 1192 |
Hope this helps |
| 1193 |
Scott |
| 1194 |
============================================================================== |
| 1195 |
,-_|\ Scott Seaton - Sun Enterprise Services - Systems Consultant |
| 1196 |
/ \ Sun Microsystems Australia Pty Ltd E-mail : [email protected] |
| 1197 |
\_,-\_+ 828 Pacific Highway Phone : +61 2 9844 5381 |
| 1198 |
v Gordon, N.S.W., 2072, AUSTRALIA Fax : +61 2 9844 5161 |
| 1199 |
============================================================================== |
| 1200 |
|
| 1201 |
--Troop_of_Baboons_752_000 |
| 1202 |
Content-Type: MESSAGE/rfc822; name=Mailbox |
| 1203 |
Content-Description: Mailbox |
| 1204 |
|
| 1205 |
From [email protected] Fri Jul 10 18:59:26 1998 |
| 1206 |
Return-Path: <[email protected]> |
| 1207 |
Received: from Aus.Sun.COM by war.Aus.Sun.COM (SMI-8.6/SMI-SVR4) |
| 1208 |
id SAA14426; Fri, 10 Jul 1998 18:59:26 +1000 |
| 1209 |
Received: from earth.sun.com by Aus.Sun.COM id SAA24238 |
| 1210 |
(SMI-8.6/SMI-4.1 for <<[email protected]>>); Fri, 10 Jul 1998 18:59:48 +1000 |
| 1211 |
Received: from iisesun.iise.CSIRO.AU (iisesun.iise.csiro.au [130.155.5.44]) |
| 1212 |
by earth.sun.com (8.8.8/8.8.8) with SMTP id BAA18609 |
| 1213 |
for <[email protected]>; Fri, 10 Jul 1998 01:59:44 -0700 (PDT) |
| 1214 |
Received: from lists1.best.com (lists1.best.com [206.86.8.15]) by iisesun.iise.CSIRO.AU (SMI-8.6/8.6.12-IISE-SWA) with ESMTP id SAA25847 for <[email protected]>; Fri, 10 Jul 1998 18:49:31 +1000 |
| 1215 |
Received: (from daemon@localhost) by lists1.best.com (8.9.0/8.8.BEST) id BAA15320 for [email protected]; Fri, 10 Jul 1998 01:04:34 -0700 (PDT) |
| 1216 |
Message-Id: <[email protected]> |
| 1217 |
From: Christina Willrich & Richard Man <[email protected]> |
| 1218 |
Subject: icc11 Handyboard library available |
| 1219 |
Date: Fri, 10 Jul 1998 00:58:49 -0700 |
| 1220 |
BestServHost: lists.best.com |
| 1221 |
MIME-Version: 1.0 |
| 1222 |
Content-Type: text/plain; charset="us-ascii" |
| 1223 |
Sender: [email protected] |
| 1224 |
Errors-To: [email protected] |
| 1225 |
Reply-To: [email protected] |
| 1226 |
To: [email protected] |
| 1227 |
content-length: 399 |
| 1228 |
Status: RO |
| 1229 |
X-Status: $$$$ |
| 1230 |
X-UID: 0000000001 |
| 1231 |
|
| 1232 |
At long last, I dusted off Chuck McManis Handyboard library and ported it |
| 1233 |
to V5. No reason why it can't work with V4.5 either ;-) Anyway, to try it |
| 1234 |
out, point your browser to |
| 1235 |
|
| 1236 |
ftp://ftp.imagecraft.com/pub/libhb.zip |
| 1237 |
|
| 1238 |
Chuck really did a great job with the LCD. There are commands to scroll, |
| 1239 |
move etc. Make sure you try the lcdtest2.c test. |
| 1240 |
|
| 1241 |
// richard |
| 1242 |
[email protected] http://www.imagecraft.com |
| 1243 |
|
| 1244 |
|
| 1245 |
--Troop_of_Baboons_752_000-- |
| 1246 |
|
| 1247 |
From [email protected] Mon Jul 6 11:54:19 1998 |
| 1248 |
Received: from aleve.media.mit.edu by hub.media.mit.edu; (5.65v3.2/1.1/06Jun95-8.2MPM) |
| 1249 |
id AA03667; Mon, 6 Jul 1998 11:54:19 -0400 |
| 1250 |
Received: from web04.globecomm.net (web04.globecomm.net [207.51.48.104]) |
| 1251 |
by aleve.media.mit.edu (8.8.7/ML970927) with ESMTP id TAA30534 |
| 1252 |
for <[email protected]>; Mon, 6 Jul 1998 19:24:28 -0400 (EDT) |
| 1253 |
From: [email protected] |
| 1254 |
Received: (from root@localhost) by web04.globecomm.net (8.8.8/8.8.0) id TAA03097; Mon, 6 Jul 1998 11:24:27 -0400 (EDT) |
| 1255 |
Date: Mon, 6 Jul 1998 11:24:27 -0400 (EDT) |
| 1256 |
Message-Id: <[email protected]> |
| 1257 |
Content-Type: multipart/mixed; boundary="0-0-0-0-0-0-0-0-____====$%&" |
| 1258 |
Mime-Version: 1.0 |
| 1259 |
To: Terri A Mortvedt <[email protected]>, [email protected] |
| 1260 |
Subject: Re: Steppers |
| 1261 |
|
| 1262 |
--0-0-0-0-0-0-0-0-____====$%& |
| 1263 |
Content-Type: text/plain |
| 1264 |
Content-Transfer-Encoding: quoted-printable |
| 1265 |
X-MIME-Autoconverted: from 8bit to quoted-printable by aleve.media.mit.edu id TAA30534 |
| 1266 |
|
| 1267 |
Dear Terri, |
| 1268 |
|
| 1269 |
If the motors turn sparatically, that means the coils |
| 1270 |
are probably not hooked up in the correct order. Try |
| 1271 |
swapping them around and see if anything improves. |
| 1272 |
|
| 1273 |
The motors you are using are the bipolar type. There=20 |
| 1274 |
is a decent way of hooking up unipolar steppers to |
| 1275 |
the HB at http://www.cctc.demon.co.uk/stepper.htm |
| 1276 |
A basic difference between bipolar and unipolar is |
| 1277 |
that unipolar motors have additional wires are=20 |
| 1278 |
connected to the power supply. Bipolars also have more |
| 1279 |
torque. |
| 1280 |
|
| 1281 |
Using fd(); and bk(); commands to power steppers is |
| 1282 |
probably a lot to handle. I recommend trying the=20 |
| 1283 |
method found on that link. There's even sample coding. |
| 1284 |
You will have to modify some variables for the turn |
| 1285 |
functions because your turning radius varies according |
| 1286 |
to your distance between motors. |
| 1287 |
|
| 1288 |
I modified the step(); function to produce a gradual=20 |
| 1289 |
increase in speed, and a gradual decrease in speed once |
| 1290 |
the specified steps are almost complete.=20 |
| 1291 |
|
| 1292 |
I will attach my motors.c file as is. |
| 1293 |
|
| 1294 |
|
| 1295 |
|
| 1296 |
_________________________________________________ |
| 1297 |
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= |
| 1298 |
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF |
| 1299 |
Brian Carvalho [ [email protected] ] |
| 1300 |
DeVRY Institute |
| 1301 |
New Jersey |
| 1302 |
_________________________________________________ |
| 1303 |
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= |
| 1304 |
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF |
| 1305 |
--------------------------------------------------- |
| 1306 |
Get free personalized email at http://www.iname.com |
| 1307 |
|
| 1308 |
--0-0-0-0-0-0-0-0-____====$%& |
| 1309 |
Content-Type: application/octet-stream |
| 1310 |
Content-disposition: inline; filename=Motors.c |
| 1311 |
Content-Transfer-Encoding: base64 |
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
LyogTW90b3JzLmMgKi8NCg0KLyoqKiBERUNMQVJBVElPTlMgKioqLw0KDQppbnQgRk9SV0FSRFMg |
| 1316 |
PSAwOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiB2YXJpYWJsZXMgZm9yIGRpcmVj |
| 1317 |
dGlvbiAqLw0KaW50IEJBQ0tXQVJEUyA9IDE7DQogDQppbnQgSEFMRlRVUk4gPSA3MDsgICAgICAg |
| 1318 |
ICAgICAgICAgICAgICAgICAgICAgIC8qIHZhcmlhYmxlcyBmb3IgdHVybmluZyAqLw0KaW50IFFV |
| 1319 |
QVJURVJUVVJOID0gSEFMRlRVUk4gLyAyOw0KIA0KaW50IFJJR0hUID0gMjsgICAgICAgICAgICAg |
| 1320 |
ICAgICAgICAgICAgICAgICAgICAgLyogdmFsdWVzIGZvciB0dXJucyAqLw0KaW50IExFRlQgPSA4 |
| 1321 |
Ow0KDQppbnQgcmlnaHRfbW90b3JfcG9pbnRlciA9IDA7ICAgICAgICAgICAgICAgICAgICAvKiBt |
| 1322 |
b3RvciBjb250cm9sIHZhbHVlcyAqLw0KaW50IGxlZnRfbW90b3JfcG9pbnRlciA9IDA7DQogDQog |
| 1323 |
DQppbnQgY3ljbGVfbGVuZ3RoID0gNDsgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBoYWxm |
| 1324 |
IHN0ZXBwaW5nIHZhbHVlcyAqLw0KaW50IGxlZnRfc3RlcF90YWJsZVs0XSA9IHs0OCw0OSw1MSw1 |
| 1325 |
MH07DQppbnQgcmlnaHRfc3RlcF90YWJsZVs0XSA9IHsxOTIsMTk2LDIwNCwyMDB9Ow0KDQpsb25n |
| 1326 |
IFNMT1cgPSAyNUw7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogbWlsbGlzZWNv |
| 1327 |
bmQgcGF1c2VzICovDQpsb25nIEZBU1QgPSA4TDsNCg0KLyoqKiBGVU5DVElPTlMgKioqLw0KDQoN |
| 1328 |
CnZvaWQgc2V0ZmFzdChsb25nIEYpDQp7DQoJCQlGQVNUID0gRjsNCn0NCg0Kdm9pZCBzZXRzbG93 |
| 1329 |
KGxvbmcgUykNCnsNCgkJCVNMT1cgPSBTOw0KfQ0KDQoNCnZvaWQgc3RlcHBlcnNfb3V0KHZvaWQp |
| 1330 |
DQp7DQoJCQlpbnQgY29udHJvbF9ieXRlID0gMDsNCgkJCWNvbnRyb2xfYnl0ZSArPSBsZWZ0X3N0 |
| 1331 |
ZXBfdGFibGVbbGVmdF9tb3Rvcl9wb2ludGVyXTsNCgkJCWNvbnRyb2xfYnl0ZSArPSByaWdodF9z |
| 1332 |
dGVwX3RhYmxlW3JpZ2h0X21vdG9yX3BvaW50ZXJdOw0KCQkJcG9rZSgweDBlLGNvbnRyb2xfYnl0 |
| 1333 |
ZSk7DQp9DQoNCnZvaWQgcmlnaHRfc3RlcChpbnQgZGlyZWN0aW9uKSAgICAgICAgICAgICAgICAg |
| 1334 |
IC8qIHJpZ2h0IG1vdG9yIGNvbnRyb2wgKi8NCnsNCgkJCWlmIChkaXJlY3Rpb24gPT0gRk9SV0FS |
| 1335 |
RFMpDQoJCQkJCSAgcmlnaHRfbW90b3JfcG9pbnRlciArPTE7DQoJCQllbHNlDQoJCQkJCSAgcmln |
| 1336 |
aHRfbW90b3JfcG9pbnRlciArPSAoY3ljbGVfbGVuZ3RoIC0gMSk7DQoNCgkJCXJpZ2h0X21vdG9y |
| 1337 |
X3BvaW50ZXIgJj0gKGN5Y2xlX2xlbmd0aCAtIDEpOw0KDQp9DQoNCnZvaWQgbGVmdF9zdGVwKGlu |
| 1338 |
dCBkaXJlY3Rpb24pICAgICAgICAgICAgICAgICAgIC8qIGxlZnQgbW90b3IgY29udHJvbCovDQp7 |
| 1339 |
DQoJCQlpZiAoZGlyZWN0aW9uID09IEZPUldBUkRTKQ0KCQkJCQkgIGxlZnRfbW90b3JfcG9pbnRl |
| 1340 |
ciArPSAxOw0KCQkJZWxzZQ0KCQkJCQkgIGxlZnRfbW90b3JfcG9pbnRlciArPSAoY3ljbGVfbGVu |
| 1341 |
Z3RoIC0gMSk7DQoNCgkJCWxlZnRfbW90b3JfcG9pbnRlciAmPSAoY3ljbGVfbGVuZ3RoIC0gMSk7 |
| 1342 |
DQoNCn0NCg0Kdm9pZCBhYm91dF9mYWNlKGludCBkaXIpICAgICAgICAgICAgICAgIC8qIDE4MCBk |
| 1343 |
ZWdyZWUgdHVybiBvbiBhIGRpbWUgKi8NCnsNCglpbnQgaTsNCg0KCWlmIChkaXIgPT0gUklHSFQp |
| 1344 |
DQoJCWZvciAoaT0wO2k8PUhBTEZUVVJOO2krKykNCgkJew0KCQkJbGVmdF9zdGVwKEZPUldBUkRT |
| 1345 |
KTsNCgkJCXJpZ2h0X3N0ZXAoQkFDS1dBUkRTKTsNCgkJCXN0ZXBwZXJzX291dCgpOw0KCQkJbXNs |
| 1346 |
ZWVwKFNMT1cpOw0KCQkJYW8oKTsNCgkJIH0NCg0KCSBlbHNlDQoJCSBmb3IgKGk9MDtpPD1IQUxG |
| 1347 |
VFVSTjtpKyspDQoJCSB7DQoJCQlsZWZ0X3N0ZXAoQkFDS1dBUkRTKTsNCgkJCXJpZ2h0X3N0ZXAo |
| 1348 |
Rk9SV0FSRFMpOw0KCQkJc3RlcHBlcnNfb3V0KCk7DQoJCQltc2xlZXAoU0xPVyk7DQoJCQlhbygp |
| 1349 |
Ow0KCQkgIH0NCn0NCg0Kdm9pZCByaWdodF90dXJuKCkgICAgICAgICAgICAgICAgICAgICAgIC8q |
| 1350 |
IDkwIGRlZ3JlZSByaWdodCB0dXJuIG9uIGEgZGltZSAqLw0Kew0KCQkJaW50IGk7DQoNCgkJCWZv |
| 1351 |
ciAoaT0wO2k8PVFVQVJURVJUVVJOO2krKykNCgkJCXsNCgkJCQkJICBsZWZ0X3N0ZXAoRk9SV0FS |
| 1352 |
RFMpOw0KCQkJCQkgIHJpZ2h0X3N0ZXAoQkFDS1dBUkRTKTsNCgkJCQkJICBzdGVwcGVyc19vdXQo |
| 1353 |
KTsNCgkJCQkJICBtc2xlZXAoU0xPVyk7DQoJCQkJCSAgYW8oKTsNCgkJCX0NCg0KfQ0KDQp2b2lk |
| 1354 |
IGxlZnRfdHVybigpICAgICAgICAgICAgICAgICAgICAgICAgLyogOTAgZGVncmVlIGxlZnQgdHVy |
| 1355 |
biBvbiBhIGRpbWUgKi8NCnsNCgkJCWludCBpOw0KDQoJCQlmb3IgKGk9MDtpPD1RVUFSVEVSVFVS |
| 1356 |
TjtpKyspDQoJCQl7DQoJCQkJCSAgbGVmdF9zdGVwKEJBQ0tXQVJEUyk7DQoJCQkJCSAgcmlnaHRf |
| 1357 |
c3RlcChGT1JXQVJEUyk7DQoJCQkJCSAgc3RlcHBlcnNfb3V0KCk7DQoJCQkJCSAgbXNsZWVwKFNM |
| 1358 |
T1cpOw0KCQkJCQkgIGFvKCk7DQoJCQl9DQp9DQoNCnZvaWQgcmlnaHRfd2hlZWwoKSAgICAgICAg |
| 1359 |
ICAgICAgICAgICAgICAvKiBncmFkdWFsIHJpZ2h0IHR1cm4gKi8NCnsNCgkJCWludCBpOw0KDQoJ |
| 1360 |
CQlmb3IgKGk9MDtpPD1IQUxGVFVSTjtpKyspDQoJCQl7DQoJCQkJCSAgbGVmdF9zdGVwKEZPUldB |
| 1361 |
UkRTKTsNCgkJCQkJICBzdGVwcGVyc19vdXQoKTsNCgkJCQkJICBtc2xlZXAoU0xPVyk7DQoJCQl9 |
| 1362 |
DQp9DQoNCnZvaWQgbGVmdF93aGVlbCgpICAgICAgICAgICAgICAgICAgICAgICAvKiBncmFkdWFs |
| 1363 |
IGxlZnQgdHVybiAqLw0Kew0KCQkJaW50IGk7DQoNCgkJCWZvciAoaT0wO2k8PUhBTEZUVVJOO2kr |
| 1364 |
KykNCgkJCXsNCgkJCQkJICByaWdodF9zdGVwKEZPUldBUkRTKTsNCgkJCQkJICBzdGVwcGVyc19v |
| 1365 |
dXQoKTsNCgkJCQkJICBtc2xlZXAoU0xPVyk7DQoJCQl9DQp9DQoNCg0Kdm9pZCBzdGVwIChpbnQg |
| 1366 |
ZGlyLCBpbnQgbnVtc3RlcHMsIGludCBkZWxheSkNCnsNCiAgICAgICAgaW50IHN0ZXAsc3RwOw0K |
| 1367 |
ICAgICAgICBpbnQgYmVnaW49bnVtc3RlcHMvMTA7DQoJaW50IGNvbnRpbnVlOw0KICAgICAgICBs |
| 1368 |
b25nIGdyYWQ9KGxvbmcpYmVnaW47DQoNCglzeXN0ZW1fcHdtX29mZigpOw0KDQoJZm9yIChzdGVw |
| 1369 |
PTA7c3RlcDxiZWdpbjtzdGVwKyspDQoJew0KCQltc2xlZXAoZ3JhZCk7DQoJCWxlZnRfc3RlcChk |
| 1370 |
aXIpOw0KCQlyaWdodF9zdGVwKGRpcik7DQoJCXN0ZXBwZXJzX291dCgpOw0KCQljb250aW51ZT1z |
| 1371 |
dGVwOw0KICAgICAgICAgICAgICAgIGdyYWQ9Z3JhZC0xTDsNCg0KCX0NCiAgICAgICAgd2hpbGUo |
| 1372 |
Y29udGludWU8YmVnaW4qOSkNCgl7DQoJCW1zbGVlcCgobG9uZylkZWxheSk7DQoJCWxlZnRfc3Rl |
| 1373 |
cChkaXIpOw0KCQlyaWdodF9zdGVwKGRpcik7DQoJCXN0ZXBwZXJzX291dCgpOw0KCQljb250aW51 |
| 1374 |
ZSsrOw0KICAgICAgICAgICAgICAgIHN0cD1jb250aW51ZTsNCgkgfQ0KDQogICAgICAgICB3aGls |
| 1375 |
ZShzdHA8bnVtc3RlcHMpDQogICAgICAgICB7DQogICAgICAgICAgICAgIGRlbGF5PWRlbGF5KzE7 |
| 1376 |
DQogICAgICAgICAgICAgIG1zbGVlcCgobG9uZylkZWxheSk7DQogICAgICAgICAgICAgIGxlZnRf |
| 1377 |
c3RlcChkaXIpOw0KICAgICAgICAgICAgICByaWdodF9zdGVwKGRpcik7DQogICAgICAgICAgICAg |
| 1378 |
IHN0ZXBwZXJzX291dCgpOw0KICAgICAgICAgICAgICBzdHArKzsNCiAgICAgICAgIH0NCglhbygp |
| 1379 |
Ow0KDQp9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICANCg0K |
| 1380 |
|
| 1381 |
|
| 1382 |
--0-0-0-0-0-0-0-0-____====$%&-- |