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