Stanford Research Systems SR510 Manual page 49

Lock-in amplifier
Table of Contents

Advertisement

Program Example 3:
IBM PC, Microsoft C v3.0,
via RS232
Machine language routines to interface to the
COM1: RS232 port are provided in the file
RS232.OBJ found on the SR565 disk. These
routines allow for simple interfacing to the SR510
at 19.2 kbaud from C programs.
#include <stdio.h>
/*
Compile with >MSC program name/AL;
link with RS232.OBJ (on SR565 disk)
RS232.OBJ defines:
init ()
txstr (str);
rxstr (str);
If an error occurs, your procedure nocom() is called.
Nocom() must be a C procedure in your program.
Example program to read the SR510 outputs and ramp the x6 analog
Output using Microsoft C v3.0 (large model) and the COM1: port.
Set all switches in SW2 to UP on SR510 for 19.2 kbaud.
*/
main ()
{
char str1[20], str2[20];
float v1,x;
init ();
txstr ("w0$");
x = 0;
while (1)
{
txstr ("q$");
rxstr (str1);
sscanf (str1, "%f", &v1);
Initializes COM1: to 19.2 kbaud
str must terminate with '$' char
Char *str;
Sends string str to COM1:
str must be declared with 15 characters
or more length.
Fills str with string received from COM1:
/* init COM1: port to 19.2 kbaud */
/* set character interval to 0 */
/* read channel 1 output */
/* into str1 */
To use these routines, the large model must be
used. Compile with the /AL switch and link with
RS232.OBJ.
Only two wires between the IBM PC's ASYNC port
and the SR530 are needed (pins #2 & #3 of the
RS232), but pins 5,6,8 and 20 should be
connected together on the connector at the IBM
end.
/* scan str1 for a float variable */
45

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents