From dfebea1e8296ebcd185fe25847f06b1c2b352e90 Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Fri, 16 Oct 2015 18:49:49 +0200 Subject: [PATCH] arduino example for 64K progmem --- examples/test-arduino/.gitignore | 4 + .../test-arduino/build-arduino-library.py | 74 ++++ examples/test-arduino/scpi-def.cpp | 339 ++++++++++++++++++ examples/test-arduino/scpi-def.h | 18 + .../scpi-parser/library.properties | 9 + .../test-arduino/scpi-parser/src/.gitignore | 2 + .../scpi-parser/src/scpi-parser.h | 6 + examples/test-arduino/scpi_user_config.h | 28 ++ examples/test-arduino/test-arduino.ino | 110 ++++++ examples/test-arduino/test-arduino.sln | 28 ++ 10 files changed, 618 insertions(+) create mode 100644 examples/test-arduino/.gitignore create mode 100644 examples/test-arduino/build-arduino-library.py create mode 100644 examples/test-arduino/scpi-def.cpp create mode 100644 examples/test-arduino/scpi-def.h create mode 100644 examples/test-arduino/scpi-parser/library.properties create mode 100644 examples/test-arduino/scpi-parser/src/.gitignore create mode 100644 examples/test-arduino/scpi-parser/src/scpi-parser.h create mode 100644 examples/test-arduino/scpi_user_config.h create mode 100644 examples/test-arduino/test-arduino.ino create mode 100644 examples/test-arduino/test-arduino.sln diff --git a/examples/test-arduino/.gitignore b/examples/test-arduino/.gitignore new file mode 100644 index 00000000..2bb578fa --- /dev/null +++ b/examples/test-arduino/.gitignore @@ -0,0 +1,4 @@ +__vm +.vs +test-arduino.vcxproj +test-arduino.vcxproj.filters \ No newline at end of file diff --git a/examples/test-arduino/build-arduino-library.py b/examples/test-arduino/build-arduino-library.py new file mode 100644 index 00000000..f98b5d0f --- /dev/null +++ b/examples/test-arduino/build-arduino-library.py @@ -0,0 +1,74 @@ +''' +This script creates scpi-parser library that is compatible with Arduino IDE. +As a convinience, it also copies a newly create library into arduino libraries +directory so any Arduino sketch can see it. +Execute this script if scpi-parser is changed or scpi_user_config.h (from this directory) is changed. +''' +from __future__ import (print_function) + +import os +import platform +import sys +import shutil + +# +# make scpi-parser as arduino compatible library +# +scpi_parser_dir = os.path.join(os.path.dirname(__file__), 'scpi-parser') +libscpi_dir = os.path.join(os.path.dirname(__file__), '../../libscpi') + +def rm_then_cp(src, dest): + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(src, dest) + +# copy *.h files +rm_then_cp(os.path.join(libscpi_dir, 'inc/scpi'), os.path.join(scpi_parser_dir, 'src/scpi')) + +# modify config.h +config_h_file_path = os.path.join(scpi_parser_dir, 'src/scpi/config.h') +config_h_file = open(config_h_file_path) +tmp_file_path = config_h_file_path + ".tmp" +tmp_file = open(tmp_file_path, "w") +for line in config_h_file: + if line == '#ifdef SCPI_USER_CONFIG\n': + tmp_file.write('// This is automatically added by the build-arduino-library.py\n') + tmp_file.write('#define SCPI_USER_CONFIG 1\n') + tmp_file.write('\n') + tmp_file.write(line) +config_h_file.close() +tmp_file.close() +os.unlink(config_h_file_path) +os.rename(tmp_file_path, config_h_file_path) + +# copy scpi_user_config.h +shutil.copyfile(os.path.join(os.path.dirname(__file__), 'scpi_user_config.h'), os.path.join(scpi_parser_dir, 'src/scpi/scpi_user_config.h')) + +# copy *.c files +rm_then_cp(os.path.join(libscpi_dir, 'src'), os.path.join(scpi_parser_dir, 'src/impl')) + +# +# find arduino libraries directory +# +ARDUINO_LIB_DIR_CANDIDATES = { + 'Linux': ['Arduino/libraries/', 'Documents/Arduino/libraries/'], + 'Darwin': ['Documents/Arduino/libraries/'], + 'Windows': ['Documents\\Arduino\\libraries\\', 'My Documents\\Arduino\\libraries\\'] +} + +home_dir = os.path.expanduser('~') + +arduino_libs_dir = None + +candidates = ARDUINO_LIB_DIR_CANDIDATES.get(platform.system()) +if candidates: + for candidate_dir in ARDUINO_LIB_DIR_CANDIDATES.get(platform.system()): + arduino_libs_dir = os.path.join(home_dir, candidate_dir) + if os.path.exists(arduino_libs_dir): + break + +if arduino_libs_dir: + # copy arduino scpi-parser library to the arduino libraries folder + rm_then_cp(scpi_parser_dir, os.path.join(arduino_libs_dir, 'scpi-parser')) +else: + print("Arduino libraries directory not found!") diff --git a/examples/test-arduino/scpi-def.cpp b/examples/test-arduino/scpi-def.cpp new file mode 100644 index 00000000..35568983 --- /dev/null +++ b/examples/test-arduino/scpi-def.cpp @@ -0,0 +1,339 @@ +/*- + * Copyright (c) 2012-2013 Jan Breuer, + * + * All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file scpi-def.c + * @date Thu Nov 15 10:58:45 UTC 2012 + * + * @brief SCPI parser test + * + * + */ + +#include +#include +#include +#include "scpi/scpi.h" +#include "scpi-def.h" + +#if USE_64K_PROGMEM_FOR_CMD_LIST +#include +#endif + +scpi_result_t DMM_MeasureVoltageDcQ(scpi_t * context) { + scpi_number_t param1, param2; + char bf[15]; + fprintf(stderr, "meas:volt:dc\r\n"); // debug command name + + // read first parameter if present + if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m1, false)) { + // do something, if parameter not present + } + + // read second paraeter if present + if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m2, false)) { + // do something, if parameter not present + } + + + SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m1, bf, 15); + fprintf(stderr, "\tP1=%s\r\n", bf); + + + SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m2, bf, 15); + fprintf(stderr, "\tP2=%s\r\n", bf); + + SCPI_ResultDouble(context, 0); + + return SCPI_RES_OK; +} + +scpi_result_t DMM_MeasureVoltageAcQ(scpi_t * context) { + scpi_number_t param1, param2; + char bf[15]; + fprintf(stderr, "meas:volt:ac\r\n"); // debug command name + + // read first parameter if present + if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m1, false)) { + // do something, if parameter not present + } + + // read second paraeter if present + if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m2, false)) { + // do something, if parameter not present + } + + + SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m1, bf, 15); + fprintf(stderr, "\tP1=%s\r\n", bf); + + + SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m2, bf, 15); + fprintf(stderr, "\tP2=%s\r\n", bf); + + SCPI_ResultDouble(context, 0); + + return SCPI_RES_OK; +} + +scpi_result_t DMM_ConfigureVoltageDc(scpi_t * context) { + double param1, param2; + fprintf(stderr, "conf:volt:dc\r\n"); // debug command name + + // read first parameter if present + if (!SCPI_ParamDouble(context, ¶m1, true)) { + return SCPI_RES_ERR; + } + + // read second paraeter if present + if (!SCPI_ParamDouble(context, ¶m2, false)) { + // do something, if parameter not present + } + + fprintf(stderr, "\tP1=%lf\r\n", param1); + fprintf(stderr, "\tP2=%lf\r\n", param2); + + return SCPI_RES_OK; +} + +scpi_result_t TEST_Bool(scpi_t * context) { + scpi_bool_t param1; + fprintf(stderr, "TEST:BOOL\r\n"); // debug command name + + // read first parameter if present + if (!SCPI_ParamBool(context, ¶m1, true)) { + return SCPI_RES_ERR; + } + + fprintf(stderr, "\tP1=%d\r\n", param1); + + return SCPI_RES_OK; +} + +scpi_choice_def_t trigger_source[] = { + {"BUS", 5}, + {"IMMediate", 6}, + {"EXTernal", 7}, + SCPI_CHOICE_LIST_END /* termination of option list */ +}; + +scpi_result_t TEST_ChoiceQ(scpi_t * context) { + + int32_t param; + const char * name; + + if (!SCPI_ParamChoice(context, trigger_source, ¶m, true)) { + return SCPI_RES_ERR; + } + + SCPI_ChoiceToName(trigger_source, param, &name); + fprintf(stderr, "\tP1=%s (%ld)\r\n", name, (long int) param); + + SCPI_ResultInt32(context, param); + + return SCPI_RES_OK; +} + +scpi_result_t TEST_Numbers(scpi_t * context) { + + fprintf(stderr, "RAW CMD %.*s\r\n", (int) context->param_list.cmd_raw.length, context->param_list.cmd_raw.data); + + return SCPI_RES_OK; +} + +scpi_result_t TEST_Text(scpi_t * context) { + char buffer[100]; + size_t copy_len; + + if (!SCPI_ParamCopyText(context, buffer, sizeof (buffer), ©_len, false)) { + buffer[0] = '\0'; + } + + fprintf(stderr, "TEXT: ***%s***\r\n", buffer); + + return SCPI_RES_OK; +} + +scpi_result_t TEST_ArbQ(scpi_t * context) { + const char * data; + size_t len; + + SCPI_ParamArbitraryBlock(context, &data, &len, false); + + SCPI_ResultArbitraryBlock(context, data, len); + + return SCPI_RES_OK; +} + +/** + * Reimplement IEEE488.2 *TST? + * + * Result should be 0 if everything is ok + * Result should be 1 if something goes wrong + * + * Return SCPI_RES_OK + */ +scpi_result_t My_CoreTstQ(scpi_t * context) { + + SCPI_ResultInt32(context, 0); + + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasureVoltageDCRatio(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasureCurrentDC(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasureCurrentAC(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasureResistance(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasureFResistance(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasureFrequency(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_MeasurePeriod(scpi_t * context) { + SCPI_ResultInt32(context, 0); + return SCPI_RES_OK; +} + +#define SCPI_COMMANDS \ + SCPI_COMMAND("*CLS", SCPI_CoreCls) \ + SCPI_COMMAND("*ESE", SCPI_CoreEse) \ + SCPI_COMMAND("*ESE?", SCPI_CoreEseQ) \ + SCPI_COMMAND("*ESR?", SCPI_CoreEsrQ) \ + SCPI_COMMAND("*IDN?", SCPI_CoreIdnQ) \ + SCPI_COMMAND("*OPC", SCPI_CoreOpc) \ + SCPI_COMMAND("*OPC?", SCPI_CoreOpcQ) \ + SCPI_COMMAND("*RST", SCPI_CoreRst) \ + SCPI_COMMAND("*SRE", SCPI_CoreSre) \ + SCPI_COMMAND("*SRE?", SCPI_CoreSreQ) \ + SCPI_COMMAND("*STB?", SCPI_CoreStbQ) \ + SCPI_COMMAND("*TST?", My_CoreTstQ) \ + SCPI_COMMAND("*WAI", SCPI_CoreWai) \ + SCPI_COMMAND("SYSTem:ERRor[:NEXT]?", SCPI_SystemErrorNextQ) \ + SCPI_COMMAND("SYSTem:ERRor:COUNt?", SCPI_SystemErrorCountQ) \ + SCPI_COMMAND("SYSTem:VERSion?", SCPI_SystemVersionQ) \ + SCPI_COMMAND("STATus:QUEStionable[:EVENt]?", SCPI_StatusQuestionableEventQ) \ + SCPI_COMMAND("STATus:QUEStionable:ENABle", SCPI_StatusQuestionableEnable) \ + SCPI_COMMAND("STATus:QUEStionable:ENABle?", SCPI_StatusQuestionableEnableQ) \ + SCPI_COMMAND("STATus:PRESet", SCPI_StatusPreset) \ + SCPI_COMMAND("MEASure:VOLTage:DC?", DMM_MeasureVoltageDcQ) \ + SCPI_COMMAND("CONFigure:VOLTage:DC", DMM_ConfigureVoltageDc) \ + SCPI_COMMAND("MEASure:VOLTage:DC:RATio?", SCPI_MeasureVoltageDCRatio) \ + SCPI_COMMAND("MEASure:VOLTage:AC?", DMM_MeasureVoltageAcQ) \ + SCPI_COMMAND("MEASure:CURRent:DC?", SCPI_MeasureCurrentDC) \ + SCPI_COMMAND("MEASure:CURRent:AC?", SCPI_MeasureCurrentAC) \ + SCPI_COMMAND("MEASure:RESistance?", SCPI_MeasureResistance) \ + SCPI_COMMAND("MEASure:FRESistance?", SCPI_MeasureFResistance) \ + SCPI_COMMAND("MEASure:FREQuency?", SCPI_MeasureFrequency) \ + SCPI_COMMAND("MEASure:PERiod?", SCPI_MeasurePeriod) \ + SCPI_COMMAND("SYSTem:COMMunication:TCPIP:CONTROL?", SCPI_SystemCommTcpipControlQ) \ + SCPI_COMMAND("TEST:BOOL", TEST_Bool) \ + SCPI_COMMAND("TEST:CHOice?", TEST_ChoiceQ) \ + SCPI_COMMAND("TEST#:NUMbers#", TEST_Numbers) \ + SCPI_COMMAND("TEST:TEXT", TEST_Text) \ + SCPI_COMMAND("TEST:ARBitrary?", TEST_ArbQ) \ + +#if USE_64K_PROGMEM_FOR_CMD_LIST + +#define SCPI_COMMAND(P, C) static const char C ## _pattern[] PROGMEM = P; +SCPI_COMMANDS +#define SCPI_COMMAND(P, C) {C ## _pattern, C}, +static const scpi_command_t scpi_commands[] PROGMEM = { + SCPI_COMMANDS + SCPI_CMD_LIST_END +}; + +#else + +#define SCPI_COMMAND(P, C) {P, C}, +static const scpi_command_t scpi_commands[] = { + SCPI_COMMANDS + SCPI_CMD_LIST_END +}; + +#endif + + +static scpi_interface_t scpi_interface = { + /* error */ SCPI_Error, + /* write */ SCPI_Write, + /* control */ SCPI_Control, + /* flush */ SCPI_Flush, + /* reset */ SCPI_Reset, +}; + +#define SCPI_INPUT_BUFFER_LENGTH 256 +static char scpi_input_buffer[SCPI_INPUT_BUFFER_LENGTH]; + +static scpi_reg_val_t scpi_regs[SCPI_REG_COUNT]; + + +scpi_t scpi_context = { + /* cmdlist */ scpi_commands, + /* buffer */ + { /* length */ SCPI_INPUT_BUFFER_LENGTH, /* position */ 0, /* data */ scpi_input_buffer}, + /* param_list */ + { /* cmd */ NULL, /* lex_state */ + {NULL, NULL, 0}, /* cmd_raw */ + {0, 0, NULL}}, + /* interface */ &scpi_interface, + /* output_count */ 0, + /* input_count */ 0, + /* cmd_error */ FALSE, + /* error_queue */ NULL, + /* registers */ scpi_regs, + /* units */ scpi_units_def, + /* user_context */ NULL, + /* parser_state */ + { /* programHeader */ + {SCPI_TOKEN_UNKNOWN, NULL, 0}, /* programData */ + {SCPI_TOKEN_UNKNOWN, NULL, 0}, /* numberOfParameters */ 0, /* termination */ SCPI_MESSAGE_TERMINATION_NONE + }, + /* idn */ + {"MANUFACTURE", "INSTR2013", NULL, "01-02"}, +}; + diff --git a/examples/test-arduino/scpi-def.h b/examples/test-arduino/scpi-def.h new file mode 100644 index 00000000..4bfc06c7 --- /dev/null +++ b/examples/test-arduino/scpi-def.h @@ -0,0 +1,18 @@ +#ifndef __SCPI_DEF_H_ +#define __SCPI_DEF_H_ + +#include "scpi/scpi.h" + +extern scpi_t scpi_context; + +size_t SCPI_Write(scpi_t * context, const char * data, size_t len); +int SCPI_Error(scpi_t * context, int_fast16_t err); +scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val); +scpi_result_t SCPI_Reset(scpi_t * context); +scpi_result_t SCPI_Flush(scpi_t * context); + + +scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context); + +#endif // __SCPI_DEF_H_ + diff --git a/examples/test-arduino/scpi-parser/library.properties b/examples/test-arduino/scpi-parser/library.properties new file mode 100644 index 00000000..0ffbd7ca --- /dev/null +++ b/examples/test-arduino/scpi-parser/library.properties @@ -0,0 +1,9 @@ +name=SCPI Parser +version=1.0.0 +author=Jan Breuer +maintainer=??? +sentence=Open Source SCPI device library +paragraph=SCPI Parser library aims to provide parsing ability of SCPI commands on instrument side. +category=Communication +url=https://github.com/j123b567/scpi-parser +architectures=* diff --git a/examples/test-arduino/scpi-parser/src/.gitignore b/examples/test-arduino/scpi-parser/src/.gitignore new file mode 100644 index 00000000..c82ec627 --- /dev/null +++ b/examples/test-arduino/scpi-parser/src/.gitignore @@ -0,0 +1,2 @@ +impl +scpi \ No newline at end of file diff --git a/examples/test-arduino/scpi-parser/src/scpi-parser.h b/examples/test-arduino/scpi-parser/src/scpi-parser.h new file mode 100644 index 00000000..bafba2f8 --- /dev/null +++ b/examples/test-arduino/scpi-parser/src/scpi-parser.h @@ -0,0 +1,6 @@ +#ifndef ARDUINO_SCPI_PARSER_H +#define ARDUINO_SCPI_PARSER_H + +#include "scpi/scpi.h" + +#endif // ARDUINO_SCPI_PARSER_H \ No newline at end of file diff --git a/examples/test-arduino/scpi_user_config.h b/examples/test-arduino/scpi_user_config.h new file mode 100644 index 00000000..7b72f27b --- /dev/null +++ b/examples/test-arduino/scpi_user_config.h @@ -0,0 +1,28 @@ +#ifndef __SCPI_USER_CONFIG_H_ +#define __SCPI_USER_CONFIG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define USE_COMMAND_TAGS 0 +#define USE_64K_PROGMEM_FOR_CMD_LIST 0 +#define SCPI_MAX_CMD_PATTERN_SIZE 128 + +// strtoull is not defined on some arduino boards +// TODO mvladic:find better way to do this +#ifndef strtoull +#define strtoull strtoul +#endif + +// strtoll is not defined on some arduino boards +// TODO mvladic:find better way to do this +#ifndef strtoll +#define strtoll strtol +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/examples/test-arduino/test-arduino.ino b/examples/test-arduino/test-arduino.ino new file mode 100644 index 00000000..666ea52a --- /dev/null +++ b/examples/test-arduino/test-arduino.ino @@ -0,0 +1,110 @@ +#include + +#include "scpi-def.h" + +/* + * + */ + +void SerialPrintf(const char *format, ...) { + char buffer[512]; + va_list args; + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + + Serial.println(buffer); +} + + +/* + * + */ + +size_t SCPI_Write(scpi_t * context, const char * data, size_t len) { + (void) context; + return Serial.write(data, len); +} + +scpi_result_t SCPI_Flush(scpi_t * context) { + return SCPI_RES_OK; +} + +int SCPI_Error(scpi_t * context, int_fast16_t err) { + (void) context; + + SerialPrintf("**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err)); + return 0; +} + +scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val) { + if (SCPI_CTRL_SRQ == ctrl) { + SerialPrintf("**SRQ: 0x%X (%d)\r\n", val, val); + } else { + SerialPrintf("**CTRL %02x: 0x%X (%d)\r\n", ctrl, val, val); + } + return SCPI_RES_OK; +} + +scpi_result_t SCPI_Reset(scpi_t * context) { + SerialPrintf("**Reset\r\n"); + return SCPI_RES_OK; +} + +scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context) { + return SCPI_RES_ERR; +} + +/* + * + */ + +void setup() { + int result; + + Serial.begin(9600); + while (!Serial); + Serial.println("serial com ready"); + + SCPI_Init(&scpi_context); + +#define TEST_SCPI_INPUT(cmd) result = SCPI_Input(&scpi_context, cmd, strlen(cmd)) + + TEST_SCPI_INPUT("*CLS\r\n"); + TEST_SCPI_INPUT("*RST\r\n"); + TEST_SCPI_INPUT("MEAS:volt:DC? 12,50;*OPC\r\n"); + TEST_SCPI_INPUT("*IDN?\r\n"); + TEST_SCPI_INPUT("SYST:VERS?"); + TEST_SCPI_INPUT("\r\n*ID"); + TEST_SCPI_INPUT("N?"); + TEST_SCPI_INPUT(""); // emulate command timeout + + TEST_SCPI_INPUT("*ESE\r\n"); // cause error -109, missing parameter + TEST_SCPI_INPUT("*ESE #H20\r\n"); + + TEST_SCPI_INPUT("*SRE #HFF\r\n"); + + TEST_SCPI_INPUT("IDN?\r\n"); // cause error -113, undefined header + + TEST_SCPI_INPUT("SYST:ERR?\r\n"); + TEST_SCPI_INPUT("SYST:ERR?\r\n"); + TEST_SCPI_INPUT("*STB?\r\n"); + TEST_SCPI_INPUT("*ESR?\r\n"); + TEST_SCPI_INPUT("*STB?\r\n"); + + TEST_SCPI_INPUT("meas:volt:dc? 0.01 V, Default\r\n"); + TEST_SCPI_INPUT("meas:volt:dc?\r\n"); + TEST_SCPI_INPUT("meas:volt:dc? def, 0.00001\r\n"); + TEST_SCPI_INPUT("meas:volt:dc? 0.00001\r\n"); + + TEST_SCPI_INPUT("test:text 'a'\r\n"); + TEST_SCPI_INPUT("test:text 'a a'\r\n"); + TEST_SCPI_INPUT("test:text 'aa a'\r\n"); + TEST_SCPI_INPUT("test:text 'aaa aaaa'\r\n"); + + (void)result; +} + +void loop() { + // put your main code here, to run repeatedly: + +} diff --git a/examples/test-arduino/test-arduino.sln b/examples/test-arduino/test-arduino.sln new file mode 100644 index 00000000..1cb377fc --- /dev/null +++ b/examples/test-arduino/test-arduino.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-arduino", "test-arduino.vcxproj", "{D892828B-A3AA-4222-9815-F9BD316186EB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D892828B-A3AA-4222-9815-F9BD316186EB}.Debug|x64.ActiveCfg = Debug|x64 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Debug|x64.Build.0 = Debug|x64 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Debug|x86.ActiveCfg = Debug|Win32 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Debug|x86.Build.0 = Debug|Win32 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Release|x64.ActiveCfg = Release|x64 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Release|x64.Build.0 = Release|x64 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Release|x86.ActiveCfg = Release|Win32 + {D892828B-A3AA-4222-9815-F9BD316186EB}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal