Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 171 → Rev 183

/cvi/instr/SP2155.c
0,0 → 1,142
#include <formatio.h>
#include <utility.h>
#include <ansi_c.h>
#include <rs232.h>
#include "SP2155.h"
 
#define COMWAIT 1.0
#define COMDELAY 0.05
 
static int SP2155_Port;
static int nin, nout, ires;
static char SP2155_Send[100], SP2155_Receive[100];
 
void _VI_FUNC SP2155_Open (int port)
{
SP2155_Port=port;
 
OpenComConfig (SP2155_Port, "", 38400, 0, 8, 1, 512, 512);
SetXMode (SP2155_Port, 0);
SetCTSMode (SP2155_Port, LWRS_HWHANDSHAKE_OFF);
SetComTime (SP2155_Port, COMWAIT);
 
return;
}
 
int _VI_FUNC SP2155_Cmd (char *cmd, double wait)
{
Delay(COMDELAY);
FlushInQ (SP2155_Port);
nout = sprintf (SP2155_Send, "%s\r", cmd);
ComWrt (SP2155_Port, SP2155_Send, nout);
if (wait!=0.) SetComTime (SP2155_Port, wait);
nin = ComRdTerm (SP2155_Port, SP2155_Receive, 90, 0xa);
if (wait!=0.) SetComTime (SP2155_Port, COMWAIT);
if (CompareStrings (SP2155_Receive, nin-3, "ok\r", 0, 0)) return -1;
nin=nin-5;
SP2155_Receive[nin]=0;
return (nin);
}
 
void _VI_FUNC SP2155_Echo (int mode)
{
if (mode) {
SP2155_Cmd ("ECHO",0);
}else{
SP2155_Cmd ("NO-ECHO",0);
}
return;
}
 
int _VI_FUNC SP2155_GetWavelength (void)
{
//** returns wavelength in angstrems
 
int ia;
float wl;
SP2155_Cmd ("?NM",0);
sscanf(SP2155_Receive," %f ",&wl);
ia = floor (10*wl+0.5);
return (ia);
}
 
void _VI_FUNC SP2155_SetWavelength (int wavel)
{
//** sets wavelength in angstrems
 
float wl;
char cmd[100];
wl=(float)wavel/10.;
sprintf(cmd,"%0.1f GOTO",wl);
SP2155_Cmd (cmd,10);
}
 
int _VI_FUNC SP2155_GetGrating (void)
{
int ig;
SP2155_Cmd ("?GRATING",0);
sscanf(SP2155_Receive," %d ",&ig);
return (ig);
}
 
void _VI_FUNC SP2155_SetGrating (int grating)
{
char cmd[100];
 
if ((grating!=1)&&(grating!=2)) return;
sprintf(cmd,"%0d GRATING",grating);
SP2155_Cmd (cmd,30);
}
 
int _VI_FUNC SP2155_GetTurret (void)
{
return (1);
}
 
void _VI_FUNC SP2155_SetTurret (int turret)
{
}
 
void _VI_FUNC SP2155_SetSpeed (int aperm)
{
}
 
void _VI_FUNC SP2155_Scan (int wavel)
{
}
 
void _VI_FUNC SP2155_Close (void)
{
CloseCom (SP2155_Port);
}
 
#ifdef SP2155_MAIN
 
#include <cvirte.h>
 
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
int ig,iangstrem;
if (InitCVIRTE (hInstance, 0, 0) == 0) return -1; /* out of memory */
 
SP2155_Open (7);
SP2155_Echo (0);
SP2155_SetGrating (1);
ig=SP2155_GetGrating ();
printf("grating=%d\n",ig);
// SP2155_Cmd ("?TURRET",0);
SP2155_Close ();
return 0;
}
 
#endif
/cvi/instr/SP2155.fp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: instr/SP2155.h
===================================================================
--- instr/SP2155.h (nonexistent)
+++ instr/SP2155.h (revision 183)
@@ -0,0 +1,26 @@
+#include <cvidef.h>
+#include <ivi.h>
+
+void _VI_FUNC SP2155_Open (int port);
+
+int _VI_FUNC SP2155_Cmd (char *cmd, double wait);
+
+void _VI_FUNC SP2155_Echo (int mode);
+
+int _VI_FUNC SP2155_GetWavelength (void);
+
+void _VI_FUNC SP2155_SetWavelength (int wavel);
+
+int _VI_FUNC SP2155_GetGrating (void);
+
+void _VI_FUNC SP2155_SetGrating (int grating);
+
+int _VI_FUNC SP2155_GetTurret (void);
+
+void _VI_FUNC SP2155_SetTurret (int turret);
+
+void _VI_FUNC SP2155_SetSpeed (int aperm);
+
+void _VI_FUNC SP2155_Scan (int wavel);
+
+void _VI_FUNC SP2155_Close (void);
Index: instr/SP2155.prj
===================================================================
--- instr/SP2155.prj (nonexistent)
+++ instr/SP2155.prj (revision 183)
@@ -0,0 +1,167 @@
+[Project Header]
+Version = 551
+Platform Code = 4
+Pathname = "/c/MeasurementStudio/cvi/instr/SP2155/SP2155.prj"
+CVI Dir = "/c/measurementstudio/cvi"
+VXIplug&play Framework Dir = "/C/VXIpnp/winnt"
+Number of Files = 3
+Sort Type = "No Sort"
+Target Type = "Executable"
+Build Configuration = "Debug"
+Warn User If Debugging Release = 1
+Flags = 16
+Drag Bar Left = 135
+Window Top = 454
+Window Left = 337
+Window Bottom = 756
+Window Right = 877
+
+[File 0001]
+File Type = "Function Panel"
+Path = "/c/MeasurementStudio/cvi/instr/SP2155/SP2155.fp"
+Res Id = 1
+Exclude = False
+Disk Date = 3336640388
+Project Flags = 0
+Window Top = 0
+Window Left = 0
+Window Height = 0
+Window Width = 0
+
+[File 0002]
+File Type = "CSource"
+Path = "/c/MeasurementStudio/cvi/instr/SP2155/SP2155.c"
+Res Id = 2
+Exclude = False
+Disk Date = 3336640388
+Project Flags = 0
+Compile Into Object File = False
+Object Format = "Win32-MSVC"
+ForceCompile_Debug = False
+ForceCompile_Release = False
+Window Top = 101
+Window Left = 396
+Window Height = 0
+Window Width = 0
+Source Window State = "1,108,112,108,0,-1,0,0,0,89,0,4,0,4,0,25,118,0,136,2,"
+Header Dependencies = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,"
+
+[File 0003]
+File Type = "Include"
+Path = "/c/MeasurementStudio/cvi/instr/SP2155/SP2155.h"
+Res Id = 3
+Exclude = False
+Disk Date = 3336640388
+Project Flags = 0
+Window Top = 551
+Window Left = 294
+Window Height = 0
+Window Width = 0
+Source Window State = "1,23,24,23,0,-1,0,0,0,89,0,0,0,0,0,25,4,0,22,0,"
+
+[SCC Options]
+Use global settings = True
+SCC Provider = ""
+SCC Project = ""
+Local Path = ""
+Auxiliary Path = ""
+Perform Same Action For .h File As For .uir File = "Ask"
+Comment = ""
+Username = ""
+Use Default Comment = False
+Use Default Username = False
+Do Not Include PRJ File in Actions = True
+Suppress CVI Error Messages = False
+
+[Compiler Options]
+Default Calling Convention = "cdecl"
+Max Number Of Errors = 10
+Require Prototypes = True
+Require Return Values = True
+Enable Pointer Mismatch Warning = False
+Enable Unreachable Code Warning = False
+Track Include File Dependencies = True
+Prompt For Missing Includes = True
+Stop On First Error File = False
+Bring Up Err Win For Warnings = True
+Show Build Dialog = False
+O Option Compatible With 5.0 = False
+
+[Run Options]
+Stack Size = 250000
+Debugging Level = "Standard"
+Save Changes Before Running = "Ask"
+Break On Library Errors = True
+Break On First Chance Exceptions = False
+Hide Windows = False
+Break At First Statement = False
+
+[Compiler Defines]
+Compiler Defines = "/DWIN32_LEAN_AND_MEAN /DSP2155_MAIN"
+
+[Command Line Args]
+Command Line Args = ""
+
+[Included Headers]
+Header 0001 = "/c/MeasurementStudio/cvi/instr/SP2155/SP2155.h"
+Header 0002 = "/c/MeasurementStudio/cvi/include/cvidef.h"
+Header 0003 = "/c/MeasurementStudio/cvi/include/ivi.h"
+Header 0004 = "/c/MeasurementStudio/cvi/include/visa.h"
+Header 0005 = "/c/MeasurementStudio/cvi/include/ansi/stdarg.h"
+Header 0006 = "/c/MeasurementStudio/cvi/include/cvirte.h"
+Header 0007 = "/c/MeasurementStudio/cvi/include/visatype.h"
+Header 0008 = "/c/MeasurementStudio/cvi/include/vpptype.h"
+Header 0009 = "/c/MeasurementStudio/cvi/include/rs232.h"
+Header 0010 = "/c/MeasurementStudio/cvi/include/utility.h"
+Header 0011 = "/c/MeasurementStudio/cvi/include/ansi_c.h"
+Header 0012 = "/c/MeasurementStudio/cvi/include/ansi/assert.h"
+Header 0013 = "/c/MeasurementStudio/cvi/include/ansi/ctype.h"
+Header 0014 = "/c/MeasurementStudio/cvi/include/ansi/errno.h"
+Header 0015 = "/c/MeasurementStudio/cvi/include/ansi/float.h"
+Header 0016 = "/c/MeasurementStudio/cvi/include/ansi/limits.h"
+Header 0017 = "/c/MeasurementStudio/cvi/include/ansi/locale.h"
+Header 0018 = "/c/MeasurementStudio/cvi/include/ansi/math.h"
+Header 0019 = "/c/MeasurementStudio/cvi/include/ansi/setjmp.h"
+Header 0020 = "/c/MeasurementStudio/cvi/include/ansi/signal.h"
+Header 0021 = "/c/MeasurementStudio/cvi/include/ansi/stddef.h"
+Header 0022 = "/c/MeasurementStudio/cvi/include/ansi/stdio.h"
+Header 0023 = "/c/MeasurementStudio/cvi/include/ansi/stdlib.h"
+Header 0024 = "/c/MeasurementStudio/cvi/include/ansi/string.h"
+Header 0025 = "/c/MeasurementStudio/cvi/include/ansi/time.h"
+Header 0026 = "/c/MeasurementStudio/cvi/include/formatio.h"
+Max Header Number = 26
+
+[Create Executable]
+Executable File_Debug = "/c/MeasurementStudio/cvi/instr/SP2155/SP2155_dbg.exe"
+Target Creation Date_Debug = 3336640387
+Force Creation of Target_Debug = False
+Executable File_Release = ""
+Target Creation Date_Release = 0
+Force Creation of Target_Release = False
+Icon File = ""
+Application Title = ""
+DLL Exports = "Include File Symbols"
+DLL Import Library Choice = "Gen Lib For Current Mode"
+Use VXIPNP Subdirectories for Import Libraries = False
+Use Dflt Import Lib Base Name = True
+Where to Copy DLL = "Do not copy"
+Add Type Lib To DLL = False
+Include Type Lib Help Links = False
+Type Lib FP File = ""
+Type Lib Guid = ""
+Uses DataSocket = 0
+Uses NIReports = 0
+Uses DCom95 = 0
+Instrument Driver Support Only = False
+
+[External Compiler Support]
+UIR Callbacks File Option = 0
+Using LoadExternalModule = False
+Create Project Symbols File = True
+UIR Callbacks Obj File = ""
+Project Symbols H File = ""
+Project Symbols Obj File = ""
+
+[DLL Debugging Support]
+External Process Path = ""
+