From 2ecafa09c47312ea3174d028961a3de9d9fbc9da Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周二, 04 12月 2012 18:47:43 +0800
Subject: [PATCH] Add missing function prototype - SCPI_ParamText

---
 README.md |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 52311cc..ed3fd62 100644
--- a/README.md
+++ b/README.md
@@ -43,11 +43,14 @@
 
 Source codes are devided into few files to provide better portability to other systems.
 
-- *scpi.c* - provides the core parser library
+- *scpi_parser.c* - provides the core parser library
 - *scpi_error.c* - provides basic error handling (error queue of the instrument)
 - *scpi_ieee488.c* - provides basic implementation of IEEE488.2 mandatory commands
 - *scpi_minimal.c* - provides basic implementation of SCPI mandatory commands
 - *scpi_utils.c* - provides string handling routines and conversion routines
+- *scpi_units.c* - provides handling of special numners (DEF, MIN, MAX, ...) and units
+- *scpi_fifo.c* - provides basic implementation of error queue FIFO
+- *scpi_debug.c* - provides debug functions
 
 - *test-parser.c* - is the basic non-interactive demo of the parser
 
@@ -58,6 +61,7 @@
 	scpi_command_t scpi_commands[] = {
 		{ .pattern = "*IDN?", .callback = SCPI_CoreIdnQ,},
 		{ .pattern = "*RST", .callback = SCPI_CoreRst,},
+		{ .pattern = "MEASure:VOLTage:DC?", .callback = DMM_MeasureVoltageDcQ,},
 		SCPI_CMD_LIST_END
 	};
 
@@ -68,28 +72,35 @@
 		.error = NULL,
 		.reset = NULL,
 		.test = NULL,
+		.srq = NULL,
 	};
 
 Important thing is command buffer. Maximum size is up to you and it should be larger than any possible largest command. 
 
-	#define SCPI_BUFFER_LENGTH 256
-	char myBuffer[SCPI_BUFFER_LENGTH];
+	#define SCPI_INPUT_BUFFER_LENGTH 256
+	static char scpi_input_buffer[SCPI_INPUT_BUFFER_LENGTH];
 
-	scpi_buffer_t scpi_buffer = {
-		.length = SCPI_BUFFER_LENGTH,
-		.data = myBuffer,
-	};
 
 The last structure is scpi context used in parser library.
 
-	scpi_context_t scpi_context;
+	scpi_t scpi_context = {
+		.cmdlist = scpi_commands,
+		.buffer = {
+			.length = SCPI_INPUT_BUFFER_LENGTH,
+			.data = scpi_input_buffer,
+		},
+		.interface = &scpi_interface,
+		.registers = scpi_regs,
+		.units = scpi_units_def,
+		.special_numbers = scpi_special_numbers_def,
+	};
 
 All these structures should be global variables of the c file or allocated by function like malloc. It is common mistake to create these structures inside a function as local variables of this function. This will not work. If you don't know why, you should read something about [function stack.](http://stackoverflow.com/questions/4824342/returning-a-local-variable-from-function-in-c).
 
 
-Now we are ready to connect everything together
+Now we are ready to initialize SCPI context. It is possible to use more SCPI contexts and share some configurations (command list, registers, units list, error callback...)
 
-	SCPI_Init(&scpi_context, scpi_commands, &scpi_buffer, &scpi_interface);
+	SCPI_Init(&scpi_context);
 
 Test implementation of function myWrite, which outputs everything to stdout, can be
 	

--
Gitblit v1.9.1