' ' ' #################### ' ##### PROLOG ##### ' #################### ' PROGRAM "MyFirst" ' 1-8 char program/file name without .x or any .extent VERSION "0.0001" ' version number - increment before saving altered program ' ' You can stop the PDE from inserting the following PROLOG comment lines ' by removing them from the prolog.xxx file in your \xb\xxx directory. ' ' Programs contain: 1: PROLOG - no executable code - see below ' 2: Entry function - start execution at 1st declared func ' * = optional 3: Other functions - everything else - all other functions ' ' The PROLOG contains (in this order): ' * 1. Program name statement PROGRAM "progname" ' * 2. Version number statement VERSION "0.0000" ' * 3. Import library statements IMPORT "libName" ' * 4. Composite type definitions TYPE ... END TYPE ' 5. Internal function declarations DECLARE/INTERNAL FUNCTION Func (args) ' * 6. External function declarations EXTERNAL FUNCTION FuncName (args) ' * 7. Shared constant definitions $$ConstantName = literal or constant ' * 8. Shared variable declarations SHARED variable ' ' ****** Comment libraries in/out as needed ***** ' IMPORT "xma" ' Math library : SIN/ASIN/SINH/ASINH/LOG/EXP/SQRT... IMPORT "xcm" ' Complex library : complex number library (trig, etc) IMPORT "xst" ' Standard library : required by most programs IMPORT "xgr" ' GraphicsDesigner : required by GuiDesigner programs IMPORT "xui" ' GuiDesigner : required by GuiDesigner programs ' IMPORT "kernel32" DECLARE FUNCTION Entry () ' ' ' ###################### ' ##### Entry () ##### ' ###################### ' ' Programs contain: ' 1. A PROLOG with type/function/constant declarations. ' 2. This Entry() function where execution begins. ' 3. Zero or more additional functions. ' FUNCTION Entry () DCB dcb COMMTIMEOUTS cto PcCommPort$ = "COM1" hCom = CreateFileA(&PcCommPort$,GENERIC_READ| GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0) GetCommState(hCom,&dcb) CloseHandle(hCom) hCom = CreateFileA(&PcCommPort$,GENERIC_READ| GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0) SetupComm(hCom,8192,8192) cto.ReadIntervalTimeout = 1000 cto.ReadTotalTimeoutMultiplier = 0 cto.ReadTotalTimeoutConstant = 1000 cto.WriteTotalTimeoutMultiplier = 0 cto.WriteTotalTimeoutConstant = 1000 dummy = SetCommTimeouts(hCom,&cto) PRINT "SetCommTimeouts :",dummy dcb.BaudRate = 57600 dcb.Parity = 0 dcb.StopBits = 0 dummy = SetCommState(hCom,&dcb) PRINT "SetCommState :",dummy tx = 0xFF ' fhandle = OPEN(PcCommPort$,$$RWSHARE) ' WRITE [fhandle], tx WRITE [hCom], tx WRITE [hCom], tx WRITE [hCom], tx ' dummy = CLOSE(fhandle) PRINT "Written :",dummy CloseHandle(hCom) END FUNCTION END PROGRAM