hsuterry avatar hsuterry committed 6b63055

use macro to replace important string and number

Comments (0)

Files changed (1)

GPIB_a34401/a34401/a34401.m

 
 #import "a34401.h"
 #include <NI488/ni488.h>
+#define A34401_ADDR 22
+#define A34401_CUR_CMD  "MEASure:CURRent:DC?"
+#define A34401_VOL_CMD  "MEASure:VOLTage:DC?"
+#define A34401_RES_CMD  "MEASure:RESistance?"
 
 @implementation a34401
 -(void) awakeFromNib
 {
     Device=0;
     BoardIndex=0;
-    PrimaryAddress = 22;      /* Primary address of the device           */
+    PrimaryAddress = A34401_ADDR;      /* Primary address of the device           */
     SecondaryAddress = 0;    /* Secondary address of the device         */
     result_str=[[NSMutableString alloc]init];
     [result_str setString:@""];
      * Main Application Body - Write the majority of your GPIB code here.
      *****************************************************************************/
     
-    ibwrt(Device, "MEASure:VOLTage:DC?", 19);     /* Send the identification query command   */
+    ibwrt(Device, A34401_VOL_CMD, 19);     /* Send the identification query command   */
     if (ibsta & ERR) {
         [self GpibError:"ibwrt Error"];
     }
      * Main Application Body - Write the majority of your GPIB code here.
      *****************************************************************************/
     
-    ibwrt(Device, "MEASure:CURRent:DC?", 19);     /* Send the identification query command   */
+    ibwrt(Device, A34401_CUR_CMD, 19);     /* Send the identification query command   */
     if (ibsta & ERR) {
         [self GpibError:"ibwrt Error"];
     }
      * Main Application Body - Write the majority of your GPIB code here.
      *****************************************************************************/
     
-    ibwrt(Device, "MEASure:RESistance?", 19);     /* Send the identification query command   */
+    ibwrt(Device, A34401_RES_CMD, 19);     /* Send the identification query command   */
     if (ibsta & ERR) {
         [self GpibError:"ibwrt Error"];
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.