Industrologic, Inc.
3201 Highgate Lane
St. Charles, MO
63301
USA
Phone: (636) 723-4000
www.industrologic.com
info@industrologic.com
TMB includes features that make it easy to write and understand bit manipulation programs. When entering programs it will understand values entered in decimal or hexadecimal as well as single byte character strings. It also features commands that can change the display of number values from decimal to hexadecimal.
Instructions entered while programming are saved as two-byte tokenized instructions, not as BASIC source code, therefore, all instruction arguments and line numbers, are limited to a single byte, (values from 0 to 255). Values that exceed this limit at run time will "roll over" or "roll under" back to a byte value, and will not cause a run-time error.
Similarly, instructions that use a limited range of values and are given values outside that range will not cause a run-time error, but will either ignore the instruction or convert the illegal value to a legal value.
A "command" consists of an instruction and its single byte "argument", and will be performed as soon as entered. A program line entry consists of a number from 1 to 255, a space, an instruction, and a single byte argument.
Lower case characters are converted to upper case when typed since all instructions must be in upper case.
Line numbers and arguments are always a single byte and can be entered as decimal values, e.g. x xx xxx xD xxD xxxD, hexadecimal values, e.g. xH xxH, or quoted single character strings, e.g. "x".
Instructions that manipulate the ports of the microcontroller must be used in ways that are compatible with the port hardware. If any bit of P1 is to be used as an input, it must be to a logic level "high" state, or "1". (On power up the port pins are set high.)
Comments may be added to program files created and saved on a host computer and uploaded, but the program saved in the T51 will not contain comments. Comments must be on separate lines, and any line that does not begin with a program line number may be a comment. When comment lines are sent to the T51 during program upload, syntax errors occur, and the lines are ignored.
| A | a general purpose byte variable. |
| P1 | the byte value read from port P1. |
| KEY | the ASCII value of the last character received. KEY cannot be assigned and is cleared when read. See Appendix A for a table of these values |
The command instructions will normally be used only as a command at the prompt, and the rest of the instructions will normally be used in a program, but may be used as a command at the prompt to see how the instruction works.
| BAUD=[arg] | set baud rate to [arg] times 100, and save in EEPROM allowable values are 192, 96, 48, 24, 12, 6, 3 (if you change the baud rate in TMB, you will also need to change it in your terminal software!) |
| Example: | |
| BAUD=96 | set baud rate to 9600 |
| BOOTON | run your program when TMB starts (i.e., on power up) |
| BOOTOFF | turn off the BOOTON feature (both are saved in EEPROM) |
| NEW | erase all program lines |
| LIST | display the program lines (if there are more than 24 lines the listing will pause until you press a key) |
| RUN | run the program from the command prompt (TMB>) (control C to stop the program) |
| DELAY [arg] | pause the program for [arg] tenths (1/10) of a second |
| GOTO [arg] | jump to the instructions at line number [arg] |
| GOSUB [arg] | call a subroutine at line number [arg] (1 layer deep only) |
| RETURN | return to next instruction after the last GOSUB |
| LOOP [arg] | begin a loop with [arg] iterations (1 layer deep only) |
| ENDLOOP | terminate a loop |
| Examples: | |
| DELAY 255 | delay 25.5 seconds |
| 1 GOSUB 10 | call subroutine at line 10 |
| 2 GOTO 1 | jump to line 1 |
| 10 PRINT "A" | send an upper case A to the serial port |
| 11 RETURN | jump to line following the GOSUB instruction |
| 1 LOOP 255 | start a loop of 255 |
| 2 PRINT "A" | send an upper case "A" to the serial port |
| 3 ENDLOOP | jump back to line 2 until 255 loops have been done |
| PRINT [arg] | display a byte value in decimal/hexadecimal, or as a character (this instruction sends characters out the serial port) see Appendix A for a table of these values |
| HEX | display values in hexadecimal (try this at the command prompt) |
| DECIMAL | display values in decimal (returns it to normal) |
| INPUT [arg] | wait for a value to be entered (followed by a carriage return) and then put the value in [arg] (this instruction waits for characters from the serial port) see Appendix A for a table of these values |
| Examples: | |
| PRINT 0DH | send a carriage return to the serial port |
| PRINT 13 | send a carriage return to the serial port |
| PRINT 0AH | send a line feed to the serial port |
| PRINT 10 | send a line feed to the serial port |
| PRINT "A" | send an upper case A to the serial port |
| PRINT 65 | send an upper case A to the serial port |
| PRINT 97 | send a lower case A to the serial port |
| INPUT P1 | wait for a value and then set P1 to that value e.g., 80H [carriage return] will set P1.7 high |
| INPUT A | wait for a value and then set variable A to that value |
The ESCAPE key will cancel value entry with the INPUT instruction, (but not stop the program).
| A=A+[arg] | add the value in [arg] to variable A |
| A=A-[arg] | subtract the value in [arg] from variable A |
| A=[arg] | set byte variable A to [arg] |
| BIT [arg] | convert byte variable A to 0 or 1 based on bit [arg] (0-7) (do a logical AND of variable A with [arg] and shift the bit to bit 0 where it can be tested with IF A described below) |
| IF A=0 [arg] | if variable A is zero jump to line number [arg] |
| IF A<>0 [arg] | if variable A is not zero jump to line number [arg] |
| OLDA | return variable A to the value before the last BIT instruction, addition, or subtraction (used when making multiple checks of A) |
| Examples: | |
| A=A+10 | add 10 to variable A (e.g., if A contained 10 it would become 20, if A contained 255 it would roll over to 9) |
| OLDA | return variable A to 10 |
| A=A-1 | subtract 1 from A (e.g., if A contained 2 it would become 1, if A contained 0 it would roll under to 255) |
| BIT 7 | logical AND variable A with 80 hex and shift to bit 0 (e.g., if A contained C0 hex, then it would become 1) |
| IF A=0 10 | if variable A is equal to 0 then jump to line 10 |
| IF A<>0 15 | if variable A is equal to 0 then jump to line 15 |
| P1=[arg] | set port P1 to [arg] |
| P1.X=[arg] | set port P1 bit X (0-7) to [arg] (0 or 1) |
| P3.7=[arg] | set port P3 bit 7 to [arg] (0 or 1) |
| Examples: | |
| P1=1 | set P1 bit 0 high, the other bits low |
| P1=80H | set P1 bit 7 high, the other bits low |
| P1.7=0 | set P1 bit 7 low |
| P3.7=1 | set P7.3 high |
Decimal Control Char. Control Decimal Decimal
Value Character Abbreviation Key Value Character Value Character
-------------------------------------------------------------------------------------------
00 NULL NUL ^@ 45 - (hyphen) 90 Z
01 START OF HEADING SOH ^A 46 . (period) 91 [ (left bracket)
02 START OF TEXT STX ^B 47 / 92 \ (backslash)
03 END OF TEXT ETX ^C 48 0 93 ] (right bracket)
04 END OF TRANSMIT EOT ^D 49 1 94 ^ (carat)
05 ENQUIRY ENQ ^E 50 2 95 _ (underscore)
06 ACKNOWLEDGE ACK ^F 51 3 96 ` (accent)
07 BEEP BEL ^G 52 4 97 a
08 BACK SPACE BS ^H 53 5 98 b
09 HORIZONTAL TAB HT ^I 54 6 99 c
10 LINE FEED LF ^J 55 7 100 d
11 VERTICAL TAB VT ^K 56 8 101 e
12 FORM FEED FF ^L 57 9 102 f
13 CARRIAGE RETURN CR ^M 58 : 103 g
14 SHIFT OUT SO ^N 59 ; 104 h
15 SHIFT IN SI ^O 60 < 105 i
15 DEVICE LINK ESC DLE ^P 61 = 106 j
17 DC1 X-ON DC1 ^Q 62 > 107 k
18 DC2 DC2 ^R 63 ? 108 l
19 DC3 X-OFF DC3 ^S 64 @ 109 m
20 DC4 DC4 ^T 65 A 110 n
21 NEG. ACKNOWLEDGE NAK ^U 66 B 111 o
22 SYNC. IDLE SYN ^V 67 C 112 p
23 END OF TX BLOCK ETB ^W 68 D 113 q
24 CANCEL CAN ^X 69 E 114 r
25 END MEDIUM EM ^Y 70 F 115 s
26 SUBSTITUTE SUB ^Z 71 G 116 t
27 ESCAPE ESC 72 H 117 u
28 RIGHT ARROW (on PC) 73 I 118 v
29 LEFT ARROW (on PC) 74 J 119 w
30 UP ARROW (on PC) 75 K 120 x
31 DOWN ARROW (on PC) 76 L 121 y
32 BLANK SPACE 77 M 122 z
33 ! 78 N 123 { (left brace)
34 " (double quote) 79 O 124 | (vertical bar)
35 # (number sign) 80 P 125 } (right brace)
36 $ 81 Q 126 ~ (tilde)
37 % 82 R 127 DELETE
38 & 83 S
39 ' (single quote) 84 T
40 ( (open parenthesis) 85 U
41 ) (close parenthesis) 86 V
42 * 87 W
43 + 88 X
44 , (comma) 89 Y