All products manufactured by Keithley MetraByte are warranted against defective materials
and worksmanship for a period of one year from the date of delivery to the original
purchaser. Any product that is found to be defective within the warranty period will, at the
option of Keith@ MetraByte, be repaired or replaced. This warranty does not apply to
products damaged by improper use.
Warning
Keithley MetraByte assumes no liability for damages
consequent to the use of this product. This product is not
designed with components of a level of reliability suitable
for use in life support or critical applications.
Disclaimer
Information furnished by Keithley MetraByte is believed to be accurate and reliable.
However, the Keithley MetraByte Corporation assumes no responsibility for the use of such
information nor for any infringements of patents or other rights of third parties that may
result from its use. No license is granted by implication or otherwise under any patent
rights of Keithley MetraByte Corporation.
Notes
Keithley MetraByte/Asyst/DAC is also referred to here-in as Keith@ MetroByte.
BasicTM is a trademark of Dartmouth College.
IBM@ is a registered trademark of International Business Machines Corporation.
PC, XT, AT, PS/2, and Micro Channel Architecture@ (MCA) are trademarks of
International Business Machines Corporation.
Microsoft* is a registered trademark of Microsoft Corporation.
Turbo C@ is a registered trademark of Borland International.
- iv -
Contents
CHAPTER 1
1.1
1.2
CHAPTER 2
2.1
2.2
2.3
2.4
2.5
2.6
INTRODUCTION
Overview
Implementation
INTERFACE DRIVERS
Microsoft C & QuickC
Small Model .....................................
Medium Model ....................................
Large Model
Microsoft C Example. ...............................
Borland Turbo
Small Model
Medium Model ....................................
Large Model.,
Turbo C Example.
Microsoft PASCAL.
Medium Model
Microsoft PASCAL Example.
Borland Turbo PASCAL.
Compact Model..
Large Model
Turbo PASCAL Example.
Microsoft FORTRAN.
Large Model
Integer (Default) Function Or Subroutine.
Microsoft FORTRAN Example. ..........................
MetraByte’s PCF-M5 is for Pascal, C, and Fortran programmers writing data acquisition and control
routines for the MSTEP-5 Board.
languages;
l Microsoft C fV4.0 - 6.0)
l Microsoft QuickC (Vl .O - 2.0)
l Borland Turbo C (Vl .O - 2.0)
l Microsoft PASCAL W3.0 - 4.0)
l Borland Turbo PASCAL (V3.0 - 5.0)
l Microsoft FORTRAN (V4.0 - 4.1)
The PCF-MS supports all memory models for the following
1
The PCF-M5 consists of several assembly language drivers for the various supported languages along
with example programs for each language. This manual is structured to illustrate memory model
usage for each of the above languages and to include a brief example program at the end of each
language section. Full source listings are included on the supplied disk.
This manual is not an introduction or operating guide to the supported MSTEPS boards. You should
be familiar with the boards’ various operating MODES, PARAMETERS, and ERROR codes before
attempting PCF-MS implementation. Refer to the main sections of this manual supplied with your
MSTEP-5 MetraByte board for a complete discussion of hardware and related functionality.
PCF-M5 Distribution Software is furnished on a 5.25” floppy diskette. A 3.5” diskette version is
available as an option.
Al .2 IMPLEMENTATION
Before working with this interface package, you are urged to become familiar with MSTEP-5 board
functions and specifications. Example programs herein do not assume any knowledge of these boards
since the programs are general in nature and do not actually implement features of any specific board.
They are limited to the actual language interface for the various languages supported.
In the following chapter, each interface driver (implemented via a CALL statement) consists of three
position-dependent parameters. These are MODE, ARGUMENT (or PARAM), STPNUM, and FLAG,
as follows:
l-l
PCF-M5 USER GUIDE
MODE
PARAM
STl’NUM
FLAG
Type of function to be executed by the MSTEP-5.
Function-dependent arguments required for execution.
Step Number, which is a long integer that specifies the direction and
number of steps to travel, or it returns optical shaft encoder counts. The
sign indicates direction (+ = clockwise, - = counter-clockwise). Not all
MODES use StpNum data, but it must always be included in the CALL
parameter list.
Error number, if any, corresponding to selected MODE
* * * * *
1-2
INTERFACE
2.1 MICROSOFT C (V4.0 - 6.0) & QUICKC (Vi .O - 2.0)
Small Model
CHAPTER
2
DRIVERS
Model:
Passes:
Sequence:
Default Calling
Convention:
Example:
‘c’ Call:
‘c’ Declaration:
.ASM Subroutine:
The following assembly code shows how the driver handles user arguments:
-mscs-mstep proc near
push bp
mw~ W,sp
.
POP bp
ret ; return
-xnscs-mstep endp
Small (“/AS”) switch on command line
word size pointers (offset, no DS register)
Arguments Passed Right to Left
Arguments Passed by Value (Passing pointers to a subroutine is
considered pass-by-value convention)
;
; [bpt4] holds offset of Mode
; [bpt6] holds offset of Param
; [bpt8] holds offset of StpNum
; [bptlo] holds offset of Flag
Program execution here
;
I
;
*restore bp & sp prior to exit
I
Other:
This information is provided for those wishing to create their own drivers:
.
-mscs-mstep is declared “PUBLIC” in the .ASM file
l mscs-mstep is declared “extern” in the “C” file
2-1
PCF-MS USER GUIDE
l The .ASM file contains the “.model small” directive (MASM & TASM only)
l Add leading underscore “-‘I to all mscs-mstep occurrences in .ASM file
l mscs-mstep is a near call
l mscs-mstep must be in a segment fname-TEXT (where fname is the name of the file where
mscs-mstep resides) if .ASM file contains mixed model procedures.
Medium Model
Model:
Passes:
Sequence:
Medium (“/AM”) switch on command line
Word-size pointers (offset, no DS register)
Arguments Passed Right to Left
The following assembly code shows how the driver handles user arguments:
-mscm_mstep proc far
push bp
mew bptw
.
.
.
far CALL (dword return address)
;
save base pointer
;
save stack pointer
;
; [bp+C] holds offset of Mode
; [bpt8] holds offset of Param
; [bptlO] holds offset of StpNum
; [bpt12] holds offset of Flag
Program execution here
;
.
I
restore bp & sp prior to exit
POP bp
ret
;return
;
-mscm_mstep endp
Other:
This information is provided for those wishing to create their own drivers:
.
-mscm-mstep is declared “PUBLIC” in the .ASM file
l mscm-mstep is declared “extem” in the “c” file
l The .ASM file contains the “.model medium” directive (MASM & TASM only)
l Add leading underscore “-” to all mscm-mstep occurrences in .ASM file
l mscm-mstep is a far call
2-2
CHAPTER 2: INTERFACE DRIVERS
l mscm_mstep must be in a segment fname_TEXT (where fname is the name of the file where
mscm-mstep resides), else Linker returns an error.
Large Model
Model:
Passes:
Sequence:
Large (“/AL”) switch on command line
dword size pointers (offset and DS register)
Arguments Passed Right to Left
Default Calling
Convention:
Arguments Passed by Value
Example
‘c’ Call:
‘c’ Declaration:
mscl-mstep (&Mode, Param, &StpNum, &Flag);
extem void mscl-mstep(int*, unsigned long*, int?;
.ASM Subroutine:
The following assembly code shows how the driver handles user arguments:
-mscl-mstep proc far
push bp
mov bprsp
far CALL (dword return address)
;
save base pointer
;
save stack pointer
;
; [bpt6] holds offset of Mode
.
.
.
.
; [bptlO] holds offset of Param
; [bptll] holds offset of StpNum
; [bpt18] holds offset of Flag
Program execution here
;
;
.
POP bp
ret
;return
;
*restore bp & sp prior to exit
,
-mscl-mstep endp
Other:
This information is provided for those wishing to create their own drivers:
-mscl-mstep is declared “PUBLIC” in the .ASM file
mscl-mstep is declared “extern” in the “c” file
The .ASM file contains the “.model large” directive (MASM & TASM only)
Add leading underscore
“-” to all mscl-mstep occurrences in .ASM file
Both code and data use dword (segment/offset) pointers
mscl-mstep must be in a segment fname_TEXT (where fname is the name of the file where
mscl-mstep resides), else Linker returns an error.
2-3
Loading...
+ 24 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.