Industrologic, Inc.
3201 Highgate Lane
St. Charles, MO
63301
USA
Phone: (636) 723-4000
www.industrologic.com
info@industrologic.com
A "command" consists of an instruction and its "argument", and will be performed as soon as entered. A program line entry consists of a number from 1 to 2730, a space, an instruction, and a byte or word argument, depending on the instruction type. Byte arguments can be entered as decimal values or quoted single character strings, e.g. "x".
Instructions entered while programming are saved as three-byte tokenized instructions, not as BASIC source code. This allows for up to 2730 program lines. (8192 / 3 = 2730). Instructions that involve line numbers or EEPROM locations will have word (2 byte) arguments. All other instructions will have byte arguments. Instruction arguments that are limited to a single byte (values from 0 to 255) and 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.
Instructions that manipulate the I/O port bits of the microcontroller must be used in ways that are compatible with the port hardware. If any port bit is to be used as an input, it must be set 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 IC51 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 IC51 during program upload, syntax errors occur, and the lines are ignored.
Although all 26 byte variables are considered general purpose, certain instructions read or write specific variables. The variables that are not used specifically by any instructions are E, F, G, I, J, K, L, O, P, Q, R, T, U, V, X, and Z.
The following is a list of byte variables that can be read and displayed, but cannot be assigned values by the user program. The user program must read KEY, KEY2, and INT often enough to insure that they contain current and valid values.
KEY the ASCII value of the last character received at Serial
Port 1 (cleared after being read)
KEY2 the ASCII value of the last character received at Serial
Port 2 (cleared after being read)
(See Appendix A for a table of these values)
INT the number of low going pulses that have occurred at
the I/O signal INT (cleared after being read)
(A) a special description of variable A used to display the ASCII
character rather than the numeric value
BAUD=[arg] Set baud rate of Serial Port 1 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-IC51, you will also need to change it
in your terminal software!)
Example:
BAUD=96 set Serial Port 1 baud rate to 9600
BOOTON Run your program when TMB-IC51 starts (i.e., on power up)
BOOTOFF Turn off the BOOTON feature (both are saved in EEPROM)
Note: The BOOTON feature can be overridden by pressing the pushbutton switch
SW1 while power is applied to the IC51. TMB-IC51 will then return a prompt
at 9600 baud (regardless of the baud rate specified with the BAUD instruction).
NEW Erase all program lines
LIST Display the program lines (if there are more than 20 lines the
listing will pause until you press a key)
RUN Run the program from the command prompt (>)
END Stop the program and return to the prompt
The program can be stopped with the END instruction, by having no further
lines to execute, (possibly by going to a non-existant line number above the
rest of the lines), or by telling the program to go to line zero. If the
program does not have a method of exiting in response to some program condition,
the power will need to be cycled to return to the prompt.
DELAY [arg] Pause the program for [arg] tenths (1/10) of a second GOTO [arg] Jump to the instructions beginning at line number [arg] GOSUB [arg] Call 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 loopSubroutines and loops may only be one layer deep, that is, a subroutine may not contain another GOSUB instruction, and an ENDLOOP instruction must be performed before another LOOP instruction is performed.
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
10 GOSUB A call subroutine at the line number of the value of variable A
(if the value of A is 20 it would be the same as GOSUB 20)
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 character
(This instruction sends characters out the serial port)
See Appendix A for a table of these values
The PRINT instruction does not include a carriage return/line feed sequence
(13D/10D or 0DH/0AH) after displaying a value or character like most BASIC
languages. If either of these characters are desired they will need to be
displayed separately.
Any character that has an ASCII value outside the range of normally displayable characters (32 to 126) can be sent as an ASCII value.
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.
The ESCAPE key will cancel value entry with the INPUT instruction, (but not stop the program)
Examples: PRINT 13 send a carriage return to the serial port PRINT 10 send a line feed to the serial port PRINT 27 send the "escape" character to the serial port PRINT "A" send an upper case A to the serial port PRINT "a" send a lower case A to the serial port PRINT 97 send a lower case A to the serial port INPUT A wait for a value and then set variable A to that value A=66 ASCII code for 'B" PRINT (A) send ASCII character "B" to serial port
BA=[arg] Set the byte variables A and B to a byte or word value in [arg]
Examples:
BA=10 set variable B to 0 and variable A to 10
BA=1000 set variable B to 3 and variable A to 232
A=[arg] Set byte variable A to [arg]
A=A+[arg] Add the value in [arg] to variable A
A=A-[arg] Subtract the value in [arg] from variable A
A=A*[arg] Multiply variable A by the value in [arg]
A=A/[arg] Divide variable A by the value in [arg], (remainder is discarded)
A=A MOD[arg] Remainder of dividing variable A by the value in [arg]
A=A AND [arg] Logical AND variable A by the value in [arg]
A=A OR [arg] Logical OR variable A by the value in [arg]
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]
IF A=B [arg] If variable A equals variable B jump to line number [arg]
IF A<>B [arg] If variable A does not equal variable B jump to line number [arg]
IF A<B [arg} If variable A is less than variable B jump to line number [arg]
IF A>B [arg] If variable A is greater than variable B jump to line number [arg]
Examples:
A=KEY get value of last character at Serial Port 1
B=67 set variable B to the ASCII value for "C", which is 67
IF A=B 30 if character was "C" then jump to line 30
A=A+B add the value of variable B to variable A
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)
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)
A=A*10 multiply variable A by 10 (e.g., if A contained 10 it would
become 100, if A contained 30 it would roll over to 44)
A=A/5 divide variable A by 5 (e.g., if A contained 10 it would
become 2, if A contained 202 it would become 40)
A=A MOD 7 divide variable A by 7 and return the remainder in variable A
(e.g., if A contained 10 it would become 3, if A contained 21 it
would become 0)
A=A AND 128 logical AND variable A with 128 [80 hex] (e.g., if A contained 240
[F0 hex] it would become 128 [80 hex])
become 128, if A contained 30 it would roll over to 44)
A=A OR 16 logical OR variable A with 16 [10 hex] (e.g., if A contained 128
[80 hex] it would become 144 [90 hex])
IF A=0 10 if variable A is equal to 0 then jump to line 10
IF A<>0 15 if variable A is not equal to 0 then jump to line 15
IF A<B 20 if variable A is less than variable B then jump to line 20
BAUD2=[arg] Set baud rate of Serial Port 2 to [arg] times 100. Allowable values
are 192, 96, 48, 24, 12, 6, 3. This instruction must be used before
sending or receiving characters at Serial Port 2.
Example:
BAUD2=3 set Serial Port 1 baud rate to 300
PRINT2 [arg] Send a byte value out Serial Port 2 in decimal as a character.
This instruction works just like the PRINT instruction,
but for Serial Port 2. For formatting details see PRINT.
The LCD instructions, particularly the initialization sequence, involve LCD signal timing and delays, and therefore take a relatively long time to complete compared to other instructions.
LCDCMD=[arg] Send the command byte [arg] to the LCD. Refer to the data sheet of
the LCD module used for the list of command values and their effects.
(Many LCD's have similar commands which are shown in the examples.)
Examples:
LCDCMD=0 Zero is a special case argument that is not an LCD command. When this
value is used, the LCDCMD instruction sends a sequence of commands
that initialize the LCD. This instruction and value must be used
before using any other LCD instruction.
LCDCMD=1 Clear LCD display
LCDCMD=2 Set cursor to "home" position
LCDCMD=8 Display off
LCDCMD=12 Display on, cursor off
LCDCMD=13 Display on, cursor off, blinking of cursor position character on
(large block)
LCDCMD=14 Display on, cursor on, cursor position character does not blink
(underline)
LCDCMD=15 Display on, cursor on, blinking of cursor position character on
(large block)
LCDCMD=16 Move cursor left
LCDCMD=20 Move cursor right
LCDCMD=24 Scroll display left
LCDCMD=30 Scroll display right
LCDPRN [arg] Display a byte value at the next cursor location on the LCD in
decimal or hexadecimal, or as a character. This instruction works
just like the PRINT instruction, but for the LCD. For formatting
details see PRINT.
LCDCUR=[arg] Move the LCD cursor to position [arg]. Refer to the data sheet of
the LCD module used to determine which line and column of the LCD
correspond to a particular cursor position. See Appendix B for a
list of common LCD modules and their cursor addresses.
RELAY1=[arg] Turn on Relay 1 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY2=[arg] Turn on Relay 2 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY3=[arg] Turn on Relay 3 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY4=[arg] Turn on Relay 4 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY5=[arg] Turn on Relay 5 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY6=[arg] Turn on Relay 6 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY7=[arg] Turn on Relay 7 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAY8=[arg] Turn on Relay 8 if [arg] is 1, turn it off if 0 (uses bit 0 of [arg])
RELAYS=[arg] Change on/off status of all relays based on [arg], where
Relays 8-1 are controlled by bits 7-0 of [arg] respectively
Examples:
RELAY1=1 turn on Relay 1
RELAYS=128 turn on Relay 8, turn off Relays 1 through 7
RELAYS=255 turn on all relays
DO1=[arg] Set digital output #1 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO2=[arg] Set digital output #2 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO3=[arg] Set digital output #3 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO4=[arg] Set digital output #4 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO5=[arg] Set digital output #5 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO6=[arg] Set digital output #6 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO7=[arg] Set digital output #7 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO8=[arg] Set digital output #8 high if [arg] is 1, low if 0 (uses bit 0 of [arg])
DO=[arg] Change on/off status of all digital outputs based on [arg], where
outputs 8-1 are controlled by bits 7-0 of [arg] respectively
Examples:
DO=255 set all digital outputs high
DO=1 set digital output #1 high, digital outputs #2 through #8 low
DI=[arg] Change on/off status of all digital I/O based on [arg], where
DI8-DI1 are controlled by bits 7-0 of [arg] respectively
If any digital I/O is to be used as an input, it must be set high, (its power up setting.)
IF DI1=0 [arg] If digital I/O #1 is low jump to line number [arg]
IF DI1=1 [arg] If digital I/O #1 is high jump to line number [arg]
IF DI2=0 [arg] If digital I/O #2 is low jump to line number [arg]
IF DI2=1 [arg] If digital I/O #2 is high jump to line number [arg]
IF DI3=0 [arg] If digital I/O #3 is low jump to line number [arg]
IF DI3=1 [arg] If digital I/O #3 is high jump to line number [arg]
IF DI4=0 [arg] If digital I/O #4 is low jump to line number [arg]
IF DI4=1 [arg] If digital I/O #4 is high jump to line number [arg]
IF DI5=0 [arg] If digital I/O #5 is low jump to line number [arg]
IF DI5=1 [arg] If digital I/O #5 is high jump to line number [arg]
IF DI6=0 [arg] If digital I/O #6 is low jump to line number [arg]
IF DI6=1 [arg] If digital I/O #6 is high jump to line number [arg]
IF DI7=0 [arg] If digital I/O #7 is low jump to line number [arg]
IF DI7=1 [arg] If digital I/O #7 is high jump to line number [arg]
IF DI8=0 [arg] If digital I/O #8 is low jump to line number [arg]
IF DI8=1 [arg] If digital I/O #8 is high jump to line number [arg]
(The argument to IF instructions can be a byte or word)
Examples:
DI=255 set all digital I/O high
DI1=1 set digital I/O high for use as an input
IF DI1=0 100 if digital I/O #1 is low jump to line number 100
INT=[arg] Set digital I/O INT high if [arg] is 1, low if 0 (uses bit 0 of [arg]) LED=[arg] Turn on LED if [arg] is 1, turn off if 0 (uses bit 0 of [arg])If INT is to be used as an input, it must be set high, (its power up setting.)
IF INT=0 [arg] If digital I/O INT is low jump to line number [arg]
IF INT=1 [arg] If digital I/O INT is high jump to line number [arg]
IF SW1=0 [arg] If switch SW1 is low (pressed) jump to line number [arg]
IF SW1=1 [arg] If switch SW1 is high (not pressed) jump to line number [arg]
(The argument to IF instructions can be a byte or word)
Examples:
INT=1 set interrupt input high for use as an input
IF INT=0 100 if interrupt input is low jump to line number 100
IF SW1=0 200 if SW1 is pressed jump to line number 100
LED=1 turn on the LED
SELAI [arg] Select Analog Input to read with the READAI, IF AI<BA [arg],
and IF AI>[arg] instructions
After the following instructions, variable B will contain the high byte and
variable A will contain the low byte of the word value corresponding to the
voltage read from the selected analog input.
READAI Read the Analog Input and place the word value in variables B and A.
BAVOLTS Convert the word value representing voltage in variables B and A
into binary-coded-decimal (BCD) digits in variables A, B, C, and D.
After this instruction the variables will contain the following: A=volts, from 0 to 5,
B=tenths of volts, from 0 to 9, C=hundredths of volts, from 0 to 9, and D=thousandths
of volts, from 0 to 9. The voltage can then be displayed in the desired format
and resolution by displaying whichever digits are significant.
Example:
SELAI 8 select Analog Input #8
READAI get word value from Analog Input
BAVOLTS convert the variables to voltage
PRINT A display volts
PRINT "." display decimal point
PRINT B display tenths
PRINT C display hundredths
PRINT D display thousandths
IF AI<BA [arg] If the word value read from the Analog Input is less than the word
value in variables B and A then jump to line number [arg].
IF AI>BA [arg] If the word value read from the Analog Input is greater than the
word value in variables B and A then jump to line number [arg].
Example:
BA=3276 set value in variables A and B to A/D value for 4.000 volts
IF AI<BA 200 if the analog input is less than 4 volts goto line 200
The BAVOLTS instruction can also be used at the command prompt to determine
the values for variables B and A.
BA=xxxx set variables A and B to value from 0 to 4095 BAVOLTS convert to voltage PRINT A display volts PRINT B display tenths of volts PRINT C display hundredths of volts PRINT D display thousandths of volts
H = hours, 0 to 23 (24 hour format, e.g., 12 midnight is 0 hours, 12 noon is 12 hours, 11 PM is 23 hours)
M = minutes, 0 to 59
S = seconds, 0 to 59
N = month, 1 to 12
D = day of the month, 1 to 31
Y = year, 0 to 99
W = day of week, 1 to 7 (you may use any number to represent any day)
WRITERTC set clock using the values in variables H, M, S, N, D, Y, W READRTC read clock and place the values in variables H, M, S, N, D, Y, W Examples: H=23 23 hundred hours (11 PM) M=0 zero minutes S=0 zero seconds N=1 January D=1 first day of month Y=5 2005 W=7 Saturday WRITERTC set clock to 11:00 PM on Saturday December 1st, 2005 READRTC read clock values PRINT H display hours PRINT ":" PRINT M display minutes PRINT ":" PRINT S display seconds
When data is written to an EEPROM address, it is likely that the data will represent program instructions and arguments, which TMB-IC51 will attempt to RUN and LIST. In order to prevent the program from running this data as an instruction, an END instruction must be placed at a line number lower than any data address used so that the program will stop before reaching the data. If this is not done, the program may do any number of undesirable things, e.g., erasing itself or changing the baud rate unexpectedly. It is also suggested that the highest possible EEPROM addresses be used for data so that it is LISTED after the normal program lines.
Most EEPROMs may be written tens of thousands of times, but even this limit could be exceeded if the program wrote to the EEPROM in an unintended loop caused by incorrect programming, so some caution should be used. EEPROMs may be read an unlimited number of times.
WRITEEE [arg] Write the value in variable A to the EEPROM byte at address [arg]
READEE [arg] Read the EEPROM byte at address [arg], put the value in variable A
(The argument to EEPROM instructions can be a byte or word)
Examples:
A=21 set variable A value
WRITTEE 8189 write variable A to EEPROM location 8189 (highest recommended)
READEE 8189 read EEPROM location 8189 and place value in variable A
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

end of manual