 
This module is made by Wea Kouang Chen.

This module's function provide a simple way to solve RS232 comm port problem.
You can use the same program to communicate with different hardware by different script file.

The module is name "MAIN.bas".It cooperate with a form and three script files.
The form is name "Form1.frm".The script files are "Difinition.txt","Main.txt" and "Replay.txt".
The form has a MSCOMM controller at least.
The file ,"Difinition.txt", is registered some I/O command.
The DIFINITION.txt file content must be like 
		order1:your command
		order2:your command
		...
		...
		...
You can refer to "Difinition.txt".

The MAIN.txt file is assembler-like script file.
The MAIN.txt file content must be like
		      START
		label operand operation
		...
		...
		...
		...
		      END
You can refer to "Main.txt"
The first line must be "START" and the last line must be "END".
If your MAIN.txt file doesn't need label,you must replace a space or a tab key.

You can use DO,LOOP,WAIT,RECEIVE,PAUSE AND order1,order2,order3,order4,order5,order6,order7,order8,order9 operand in your MAIN file.
You may look them as simple assembler instruction set.
	"DO..LOOP n" is a loop instruction set,n is a integer.If n is 3,the instructions can be run 3 times in DO..LOOP area.
	"WAIT n" is a waiting instruction,n is a integer.If n is 2,the whole program will wait 2 seconds.
	"RECEIVE n" is a receive data instruction from RS232 comm port,n is a integer.
		If n is 4,the comm port will receive 4 bytes into AX property in main.bas module.
		If you don't know how data bytes will be receive, you can use "OK" to replace n in RECEIVE instruction.
	"PAUSE ON" is a pause function,which can stop running in main.bas module and then turn to run Form1.frm or the form designed by yourself.
		If the mathod main.continue which is included in your form or Form1.frm was running, the control of the program will be returned to the next line of "PAUSE ON".
	"order1 " ~ "order9 " is your command set.The module,main.bas,can interpret order1~order9 to your command and send it out to RS232 port.
	May be your command need some data and you can write it follow as :
		order1 00 01 02 03 04 256 vbCrLf
		order2 "string" vbCrLf
		The vbCrLf means that you need press "ENTER" key at last word.

The content of Replay.txt file is same with RS232 port output.

Many property is provided by the module and is used in your form or "Form1.frm".
They are AX and PAUSE property.The Ax's data type is Variant and PAUSE's data type is Boolean.

You can use "RECEIVE 4" instruction receive 4 bytes data into Main.AX and 
	use "PAUSE ON" instruction turn the program's control to your form or Form1 in Difinition.txt file 
	then you can calculate Main.AX in your form or Form1.

The property PAUSE is turned true after use "PAUSE ON" instuction in Dinintion.txt file.

Many mathod is provided by the module and it is used in your form or Form1.They are Initial and Continue mathod.

When you run the Main.Initial mathod,the module Main will send I/O command in main.txt to RS232 port from first line to the end and line by line.
When your running is paused by "PAUSE ON",you can continue run I/O command by used Main.Contiune mathod.
if your I/O command--"PAUSE ON", is in "DO..LOOP n" area,your loop--"DO,,LOOP n",will be stop by "PAUSE ON" command and turn the program's control to your form or Form1.
if you have any question,you can E-Mail to wea@dgt.gov.tw or hellowea@ms52.hinet.net	.





