Automatización de la Generación y Medida de Mezclas
Transcription
Automatización de la Generación y Medida de Mezclas
Automatización de la Generación y Medida de Mezclas Gaseosas Mediante MassFlow TITULACIÓ: Enginyeria Tècnica en Electrònica Industrial AUTOR: Raphaël Verlaat DIRECTOR: Jesús Brezmes LLecha DATA: Juny / 2.007. Índice: 1. Introducción.......................................................................................................... 3 1.1. Antecedentes...................................................................................................... 3 1.2. Objetivos............................................................................................................ 3 2. Memoria Descriptiva............................................................................................. 4 2.1. Funcionalidad del Programa ............................................................................... 4 2.2. Esquema General ............................................................................................... 5 2.3. Manual del Usuario ............................................................................................ 6 2.3.1. Establecer la comunicación....................................................................... 6 2.3.2. El Planificador........................................................................................... 8 2.3.3. Planificar una Medida................................................................................ 9 2.3.4. Editar una Medida ................................................................................... 11 2.3.5. Definir un Nuevo Tramo.......................................................................... 13 2.3.6. Crear una Medida Nueva o Copiar una Existente..................................... 14 2.3.7. Ejecución de un Proceso.......................................................................... 15 3. Memoria de Cálculo ............................................................................................ 17 3.1. Flujograma....................................................................................................... 17 3.2. Código ............................................................................................................. 18 3.2.1. Programa Principal (Programa.bas) ......................................................... 18 3.2.2. API Comunicación Mass Flow (modFlowbusAPI.bas) ............................ 55 3.2.3. Desarrollo de las funciones de la API (modFlowbusAvanzado.bas) ....... 105 3.2.4. API para Tarjeta de Adquisición de Datos (nidaq32.bas) ....................... 141 3.2.5. Funciones Sobre la API (nidex32.bas) ................................................... 149 3.2.6. Módulo de constantes para la API de la Adq. de datos(nidaqcns.inc) ..... 151 3.2.7. Módulo de errores de la API de Adquisición de Datos (nidaqerr.inc) ..... 169 3.2.8. Formulario de conexión (frmConexion.frm) .......................................... 189 3.2.9. Formulario del Planificador (frmPlanificador.frm) ................................. 194 3.2.10. Formulario para Planificar una Nueva Medida (frmPlanificar.frm) ........ 196 3.2.11. Formulario para Listar las Medidas Existentes (frmMedidas.frm) ......... 200 3.2.12. Formulario para Crear/Copiar una Medida Nueva (frmNewMedida.frm) 203 3.2.13. Formulario para Crear un Nuevo Tramo (frmTramo.frm) ...................... 206 3.2.14. Formulario para Monitorizar la Ejecución del Proceso (frmProceso.frm) 211 3.2.15. Temporizador de TimeOut (clsTemporizadorTimeOut.cls) .................... 219 4. Conclusiones..................................................................................................... 222 5. Anexos.............................................................................................................. 223 1. Introducción 1.1. Antecedentes En el laboratorio de la universidad URV se dispone de una cámara de test de mezclas gaseosas. Estas mezclas se controlan a través de controladores de flujo másico (en adelante Mass Flow Controllers). Actualmente para la gestión de los Mass Flow Controllers se utilizan en el laboratorio dos programas subministrados por la propia casa Bronkhorst HI-TEC. El primero de estos programas es el FLOWDDE encargado de la comunicación a través del puerto serie entre el PC y los Mass Flows. En él se pueden definir todos los parámetros relativos a la comunicación (puerto, velocidad, paridad…) y establecer dicha comunicación correctamente. Además, el FLOWDDE se encargará de obtener la configuración actual de los Mass Flows (Nº de nodos, direcciones de memoria, canales…) para establecer dicha comunicación con una configuración adecuada. Una vez establecida la comunicación, el segundo programa, llamado FLOWVIEW, se encargará de establecer los setpoints que nos interese en los Mass Flows, entendiendo por setpoint el valor en tanto por ciento de apertura (o fondo de escala) al que queremos tener cada uno de los Mass Flows. Además, también podemos establecer con el FLOWVIEW cuál es el gas que circula por los tubos y calibrar los Mass Flow correctamente en función de dicho gas. La principal limitación de la configuración actual es la automatización de este proceso, ya que para poder controlar las cantidades de gas a mezclar, el tiempo de mezcla y obtener datos relativos a la mezcla se debe hacer todo manualmente. 1.2. Objetivos Con el objetivo de paliar las limitaciones comentadas en el apartado anterior, se pretende construir un programa capaz de automatizar el proceso de mezcla de gases, determinar el tiempo de mezcla y adquirir un muestreo de datos para su posterior tratamiento con MATLAB. Los objetivos a cubrir son: Ø Diseñar un programa que controle los Mass Flow Controllers. Ø Programar una tarjeta de adquisición de datos. Ø Guardar el muestreo de datos obtenido en ficheros para el posterior tratamiento con MATLAB. Ø Integrar todo el control en una agenda de experimentos. Ø Facilitar a la comunidad universitaria que utiliza la cámara de test el estudio de la mezcla de gases. 3 2. Memoria Descriptiva 2.1. Funcionalidad del Programa Para crear el programa de control de los Mass Flows y de adquisición de datos utilizaremos Visual Basic estableciendo los siguientes pasos de ejecución: Ejecutaremos el programa con una pantalla inicial. Dicha pantalla inicial tendrá los parámetros de configuración del programa y de conexión así como la velocidad, el puerto de comunicación y los canales de lectura de la tarjeta de adquisición de datos. La comunicación tanto con los Mass Flows como con la tarjeta de adquisición de datos se hará a través de 2 API’s, una para cada dispositivo. En ellas encontraremos todas las funciones necesarias para poder realizar correctamente la conexión a través del puerto serie. Una vez establecida correctamente la conexión pasaremos a una pantalla que mostrará las tareas ya planificadas y el estado de cada una. Indicará que tareas han finalizado correctamente en ejecuciones anteriores del programa, así como también repasará todas aquellas que estando planificadas no se han podido llevar a cabo por alguna razón, poniéndolas en un estado de no procesado. A través de una serie de botones y con la idea de dar un tratamiento más visual al programa, se permitirá el acceso a diferentes pantallas que nos permitirán modificar los parámetros relacionados con el experimento en cuestión. A través de las diferentes pantallas podremos ir estableciendo diferentes setpoints. Estos setpoints los podremos ir variando según avance el tiempo. La variación de estos setpoints hará variar la concentración de los diferentes gases en la mezcla final. Para cada tramo (definiremos tramo como el tiempo transcurrido desde que hemos establecido un setpoint hasta que establecemos otro setpoint diferente o acabamos con el proceso actual) estableceremos un valor concreto de setpoint para cada uno de los tres Mass Flows. Durante la ejecución de dicho tramo podremos establecer si queremos o no recoger datos de la tarjeta de adquisición de datos y cada cuanto tiempo. Es decir, podremos establecer un tiempo de muestreo. La escala de este intervalo será en segundos y podremos definir un decimal. Entenderemos por medida, entonces, la ejecución de uno o más tramos consecutivos durante un tiempo determinado. Una vez establecidos los parámetros dentro de cada medida, podremos planificarla tantas veces como queramos, y obtener los resultados para su estudio. 4 Tras planificar una medida, ésta quedará en estado pendiente hasta que venza la hora de inicio de su ejecución. Entonces el programa se encargará de ir variando los parámetros del sistema de acuerdo con las indicaciones establecidas por la medida. Automáticamente se irán recogiendo, si así se hubiesen establecido, los datos correspondientes a las mediciones hechas en la tarjeta de adquisición de datos para almacenarlas en los ficheros. Durante la ejecución del proceso establecido aparece una pantalla que monitoriza los datos obtenidos y los parámetros establecidos Todo ello está hecho con dos propósitos: El primer propósito es mostrar al usuario la evolución del sistema y así saber en cada momento que valores se han conseguido establecer: valores como el setpoint establecido, el caudal de gas que circula por los Mass Flows (lo que se denomina measure) o el tiempo que resta hasta el final de la ejecución total de la medida. Finalmente también el valor en voltios que se puede leer en la tarjeta de adquisición de datos y que se mostrará gráficamente por la pantalla. En segundo propósito es el hecho de que el usuario pueda visualizar la evolución cosa que da la sensación de actividad y le indica al usuario que el sistema está trabajando y que todo va según lo esperado. Dicha pantalla de monitorización del proceso no debe ser cerrada mientras dure la ejecución sino ésta quedará interrumpida. De hecho para cerrarla únicamente se puede hacer a través de un botón, que tras una confirmación, dará el proceso por finalizado, dejando el estado en “No Ejecutado”. Cerrará todos los ficheros abiertos y cerrará la ventana de monitorización. El sistema quedará en reposo a la espera del vencimiento de la siguiente planificación. Se considerará el estado de reposo para los Mass Flows (0%) cifra que corresponderá dichos Mass Flows cuando éstos están totalmente cerrados. Esto es así para impedir la circulación de los gases y el consecuente vaciado de las botellas. Teniendo el programa en cualquier fase (por ejemplo, pendiente de ejecutar alguna planificación o bien ejecutándola), si se desea, se puede planificar la ejecución de otras medidas que se ejecutarían con posterioridad. Eso sí, se debe tener en cuenta que mientras se está ejecutando una medida no pueda entrar ninguna otra en ejecución ya que el sistema está ocupado con la mezcla actual. Es por eso que no se debe permitir el solapamiento en la planificación de medidas. Es más, se establecerá un intervalo de al menos 5 minutos entre la ejecución de dos medidas y la próxima planificación, para así dar tiempo a preparar al sistema las condiciones necesarias para que se realice la medida o para que ésta se controle correctamente para conseguir adecuadamente la mezcla que se pretende experimentar. Finalmente cuando deseemos acabar con la ejecución del programa, con el botón salir, se cerrarán las comunicaciones y se acabará con la ejecución del programa. 2.2. Esquema General El sistema de la cámara de test de mezcla de gases lo componen 3 controladores de flujo másico (Mass Flow Controllers) de la casa Bronkhorst de HI-TEC. Estos controladores son del tipo EL-FLOW (laboratory style) F201-CV y controlan el flujo de gas que dejan pasar a la mezcla. A su vez el grado de apertura o fondo de escala de los Mass Flows es determinado a través del PC estableciendo el setpoint concreto. Para ello se utiliza una tarjeta de adquisición de datos de la Nacional Instruments con referencia 6023E. 5 El esquema general seria el siguiente: Figura 1. Esquema General del Sistema. 2.3. Manual del Usuario 2.3.1. Establecer la comunicación Al iniciar la ejecución del programa, la primera pantalla que aparece es la que establece los parámetros iniciales y de conexión. Esta pantalla presenta, por defecto, los últimos valores establecidos y si es la primera vez que se ejecuta el programa, entonces, mostrará los valores preconfigurados que son: Ø Puerto de comunicación: El primero disponible. Ø Velocidad de conexión: 38400 Baudios. Ø Canales activados: Ninguno. La pantalla es la correspondiente a la figura 1. 6 Figura 1. Conexión. Si observamos la pantalla, en primera instancia los campos aparecen protegidos. Si no estamos de acuerdo con la configuración actual, se puede pulsar el botón “Cambiar Configuración” y se desprotegen los campos para poder modificarlos. Puerto: Establece el puerto de comunicaciones a través del cual se conectará el ordenador con los MassFlows. Los puertos disponibles serán los que tiene disponibles el ordenador. Baudios: Establece la velocidad de conexión entre el ordenador y los MassFlows. La velocidad por defecto es 38400 y las disponibles son: 4800, 9600, 19200, 38400. Canales de lectura activados: Se disponen de 16 canales para la adquisición de datos. Cada uno de estos canales se puede activar o desactivar independientemente. Esto dependerá de la configuración del sistema y de los canales que el usuario quiera leer. Tanto si inicialmente estábamos de acuerdo con la configuración que propuso el programa como si hemos cambiado los parámetros, presionando “Aceptar” intentaremos la comunicación con los MassFlows. Si ésta tiene éxito pasaremos a la pantalla del planificador y se guardará dicha configuración para la próxima vez que se ejecute el programa. Si pasado un tiempo la comunicación no se establece, se abortará el intento y se dejará que el usuario establezca otra configuración diferente o lo intente con la misma si lo cree oportuno. Actuando sobre “Cancelar” el programa no intenta la conexión y sale del programa. 7 2.3.2. El Planificador Después de establecer la conexión con éxito, la primera pantalla que aparece es la del planificador. Esta pantalla tiene la función de actuar de “Programa Principal”. En ella planificamos la ejecución de los diferentes procesos y comprobamos el estado de su ejecución. En la pantalla observamos diferentes campos: Num: Indica el número de orden de una planificación. Es único para cada planificación y ayuda a identificarla. Nombre de la Medida: Indica el nombre de la medida de la cual hemos planificado su ejecución. Fecha de Inicio: Indica en que día se inicia la ejecución del proceso. Hora de Inicio: Indica a que hora se inicia la ejecución del proceso. Fecha de Finalización: Teniendo en cuenta la duración de la ejecución del proceso el programa calcula el día que finalizará el proceso. Hora de Finalización: Teniendo en cuenta la duración de la ejecución del proceso el programa calcula a que hora del día finalizará el proceso. Estado: Indica en que estado se encuentran los procesos planificados. Estos estados pueden ser: Ø Completado: El proceso planificado se ejecutado correctamente y ha concluido satisfactoriamente. Ø No Ejecutado: El proceso no se ha ejecutado correctamente. Esto ocurre si por ejemplo iniciamos el programa a una hora determinada y había procesos que ya deberían haberse ejecutado. O bien si por el contrario durante la ejecución del proceso ocurre alguna incidencia que altere la ejecución normal del programa o se aborta intencionadamente el proceso. Ø Pendiente: Indica que un proceso esta planificando y pendiente de su vencimiento para iniciar su ejecución. Ø En Ejecución: Indica que un proceso se encuentra actualmente en ejecución. La pantalla que le corresponde se muestra a continuación en la figura 2. 8 Figura 2. Planificador. Los diferentes botones realizan las siguientes acciones: Ø Planificar Medida: Pasamos a la pantalla encargada de planificar una ejecución de entre las medidas existentes. Ø Desplanificar Medida: Se encarga del paso inverso a “Planificar Medida”. Si nos interesa que no se realice la ejecución de una medida planificada en estado “Pendiente”, seleccionaremos la medida en cuestión y actuaremos sobre este botón. Nos pedirá una confirmación de la desplanificación y, si aceptamos, el programa procederá a eliminar dicha medida del planificador. Si actuamos sobre una medida planificada en otro estado diferente a “Pendiente”, después de la confirmación de la acción, eliminará el registro correspondiente con la idea de limpiar el planificador. El botón “Desplanificar Medida” no puede actuar sobre los procesos que se encuentran en ejecución, cuyos estados corresponden a “En Ejecución”. Ø Editar Medidas: Se accede a la operativa para editar, borrar o modificar las medidas existentes. Ø Eliminar Completados: Elimina del planificador todas las medidas en estado diferente a “Pendiente” o “En Ejecución”. Tiene como finalidad eliminar las entradas correspondientes a las medidas ya procesadas y limpiar el planificador. Salir: Cierra la comunicación con los MassFlows y termina con la ejecución del programa. 2.3.3. Planificar una Medida Si estando en la pantalla del planificar se acciona el botón “Planificar Medida” se accede a la siguiente pantalla que se muestra en la figura 3: 9 Figura 3. Planificar una Medida. En ella podemos establecer los parámetros necesarios para planificar una nueva ejecución de una medida existente. En el primer campo, “Fecha de Inicio”, se informa por defecto con la fecha de hoy. Si nos interesa que el día de la ejecución sea un día diferente, actuando sobre el desplegable, nos mostrará un calendario en el cual podremos señalar el día que preferimos para que se ejecute el proceso. En el campo “Hora de Inicio” podemos actuar para establecer a que hora queremos que empiece la ejecución del proceso. Esta deberá ser siempre necesariamente superior a cinco minutos de la hora actual, entendiendo por hora actual la hora y la fecha en el momento que pulsemos el botón “Aceptar”. Tampoco podrá coincidir la fecha y la hora de inicio o de fin de una planificación con todo el intervalo de tiempo de ejecución de alguna planificación ya establecida con anterioridad. Si esto ocurre o cambiamos la hora de la nueva planificación o borramos primeramente la planificación que causa el solapamiento. El campo “Medida” es un desplegable sobre el que podremos actuar para obtener todas las medidas disponibles y estaremos obligados a seleccionar una para establecer la planificación. En el campo “Nombre de Archivo” deberemos establecer un nombre y una ruta para guardar los archivos de datos que se generan durante la ejecución del proceso de una medida planificada. Se generarán 2 ficheros: - Uno .dat con los datos más relevantes de la ejecución y el muestreo de datos obtenidos para dar la idea al usuario del transcurso de la ejecución. - Y un segundo fichero con el mismo nombre .mat con los datos únicamente del muestreo obtenido para su posterior tratamiento por MATLAB. 10 El literal que aparece al final de la pantalla que indica “Fecha y Hora de Finalización” se calcula a partir de la fecha y la hora establecidas por el usuario y sabiendo la duración de ésta. Una vez introducidos todos los parámetros se pulsará el botón “Aceptar” y si todos los parámetros son correctos, se planificará la nueva ejecución. Si no es así dejaremos la pantalla actual el programa devolverá el error correspondiente y será entonces cuando se permitirá corregir de nuevos los parámetros. Si se actúa sobre el botón “Cancelar” la nueva ejecución no se planificará y volveremos a la pantalla del planificador. 2.3.4. Editar una Medida Si estando en la pantalla del planificador actuamos sobre el botón “Editar Medida” accederemos a la pantalla que muestra la figura 4, donde podremos actuar sobre todas las opciones para crear, borrar o modificar una medida nueva o existente. Figura 4. Editar una Medida. 11 Una medida es un proceso que agrupa una serie de tramos. Y un tramo se considera el tiempo transcurrido entre el establecimiento de un setpoint en los MassFlows y el establecimiento del siguiente setpoint o el final del proceso. Por tanto una medida vendrá definida por uno o más tramos agrupados bajo un nombre. Este nombre será el que aparecerá en el desplegable que hay al principio de la pantalla que muestra la figura 4. Una vez seleccionado el nombre se actualizará la pantalla con los diferentes tramos que contiene la medida seleccionada. El orden de la disposición de los tramos, y por tanto de sus diferentes setpoints, tiene mucha importancia ya que actúa directamente en el proceso y la secuencia de mezcla de los gases. Estos tramos se pueden reordenar seleccionando el tramo que queremos desplazar y actuando sobre las flechas “arriba” y “abajo” para cambiar el orden de éstos. Se permitirá modificar el orden de los tramos aunque la medida esté planificada para su ejecución. Únicamente se prohibirá la alteración de éstos si la medida entra o está en ejecución. Al final de la pantalla aparece un literal que indica el tiempo total de ejecución de la medida seleccionada. Si nos interesa definir un nuevo tramo (un nuevo setpoint) actuaremos sobre el botón “Nuevo Tramo” y accederemos a las opciones para definir el nuevo tramo. Para poder actuar sobre este botón deberemos tener una medida seleccionada. Si nos interesa eliminar un tramo existente actuaremos sobre el botón “Eliminar Tramo”. Nos pedirá confirmación de la acción a realizar. Para poder actuar sobre este botón deberemos tener una medida seleccionada. Si por el contrario queremos crear una medida nueva bien sin tramos o bien copia con los tramos de una medida ya existente actuaremos sobre el botón “Crear Medida”. Si lo que se pretende es borrar toda una medida incluidos sus tramos y su nombre actuaremos sobre el botón “Eliminar Medida”. Una vez concluidas las acciones, para salir de la pantalla de edición de medida y volver al planificador pulsaremos el botón “OK”. Deberemos tener en cuenta que: Ø No podremos ni insertar tramos ni eliminarlos, ni eliminar una medida si ésta está planificada. Deberemos primero eliminar su planificación. 12 Ø Si una medida tiene su ejecución planificada y la seleccionamos nos aparecerá un mensaje que nos indicará que cualquier cambio que realicemos afectará a la planificación. Por otro lado los botones que modifican el número de tramos o la propia medida aparecerán inhabilitados. Podremos hacer cambios mientras el tiempo que queda hasta la ejecución de la medida sea superior a un minuto. Ø Si eliminamos todos los tramos de una medida o a una medida nueva, no le definimos ningún tramo y salimos de la pantalla, el nombre de esta medida desaparece. 2.3.5. Definir un Nuevo Tramo Si estando en la pantalla donde se editan las medidas (ver figura 4) se actúa sobre el botón de “Crear Tramo” se accede directamente a la pantalla que se muestra en la figura 5. Figura 5. Definir un Tramo. En ella se aprecian tres barras desplazables que sirven para establecer el grado de apertura o cierre (el tanto por ciento) de los diferentes MassFlows para poder establecer el setpoint cuando toque. En la casilla “Tiempo” se establecerá un tiempo comprendido entre 1 y 525.600 minutos que corresponde a un año. Este tiempo representará el intervalo de tiempo desde el establecimiento del setpoint hasta el establecimiento del siguiente setpoint o el final de la medida si no existe ningún tramo más definido. 13 Existe un área definida bajo el literal “¿Tomar medidas durante la ejecución del tramo?”. Indica si quiere o no leer datos de la tarjeta de adquisición y cada cuanto tiempo. Para ello hay que marcar la opción “Sí” si se quiere leer o “No” sino se quiere leer y en la casilla “Tiempo del intervalo” indicar cuanto tiempo. Este valor es un valor de entre 0 (Si no se quiere leer) y 86.400 segundos que corresponden a un día. Una vez establecidos los datos correctos se pulsa “Aceptar” y en la pantalla de editar medida se incluirá el nuevo tramo al final de la medida. Si se actúa sobre el botón “Cancelar” no se insertará el tramo y se cerrará la pantalla volviendo a la pantalla anterior de editar medidas. 2.3.6. Crear una Medida Nueva o Copiar una Existente Si estando en la pantalla de editar medidas (ver figura 4) se quiere crear una medida nueva aparte de las ya existentes y pulsamos el botón de “Crear Medida” accedemos directamente a la pantalla que muestra la figura 6. Figura 6. Creando una Medida Nueva. En ella disponemos de dos opciones: - la primera, si seleccionamos la opción “Crear medida nueva” se habilitará el campo “Medida Nueva” donde podremos poner el nuevo nombre y si oprimimos “Aceptar” regresaremos a la pantalla de editar medidas, donde la medida seleccionada será la nueva medida y no habrá ningún tramo añadido. - la segunda, si seleccionamos la opción “Crear copia de una medida existente” (ver figura 7) se deshabilitarán las dos casillas. En la casilla “Medida Existente” desplegaremos 14 la barra y seleccionaremos una de entre las diferentes medidas que existen en ese momento. A continuación en la casilla “Medida Nueva” introduciremos el nuevo nombre para la nueva medida. Esta vez, al oprimir el botón “Aceptar”, regresaremos al igual que antes a la pantalla de editar medidas, la medida seleccionada será la nueva medida y los tramos que se mostrarán serán los mismos que los de la medida de que se ha hecho la copia. Figura 7. Copiando una Medida Existente. Si accedemos al botón “Cancelar” no daremos de alta ninguna medida y también volveremos a la pantalla de editar medidas, sin alterar nada. 2.3.7. Ejecución de un Proceso Automáticamente, si estando planificado un proceso vence el plazo de inicio, se abre una ventana que monitoriza la ejecución del proceso (ver figura 8). Existe una gráfica que irá mostrando en función del tiempo la evolución de la adquisición de datos a través de los diferentes canales representados en los diferentes colores que indica el apartado “Canales”. Sólo se representarán los canales que se hayan indicado al inicio (ver figura 1) como canales activados. El apartado “Tiempo restante”, indica el tiempo en “hh:mm:ss” que queda hasta concluir con la medida. En el apartado Parámetros existen 3 parámetros recogidos para cada MassFlow: Set: Indica el setpoint real establecido para cada MassFlow. Cdl: Indica en función del gas que hay conectado a cada MassFlow y del volumen de gas que circula, el caudal (Measure) real que circula para el setpoint establecido. 15 Gas: Muestra el nombre del gas configurado como conectado a los MassFlows. Figura 8. Proceso en Ejecución. Si accionamos el botón “Terminar Proceso” abortará la ejecución del proceso en curso y en el planificador el estado del proceso correspondiente será “No Ejecutado”. 16 3. Memoria de Cálculo 3.1. Flujograma El flujograma correspondiente a la aplicación sería el siguiente: Figura 9. Flujograma. 17 3.2. Código A continuación se adjunta el código referente a la aplicación implementada. El siguiente esquema general indica los elementos existentes: Figura 10. Esquema de la Aplicación. 3.2.1. Programa Principal (Programa.bas) ' Tipo de dato para el planificador Public Type typPlanificador Nombre As String Fecha_ini As String Hora_ini As String Date_ini As Date Fecha_fin As String Hora_fin As String Date_fin As Date Tiempo As Double Estado As String Path As String End Type 18 ' Tipo de dato para las medidas Public Type typMedidas Nombre As String Numero As Integer Tramo As Integer Nodo3 As Integer Nodo4 As Integer Nodo5 As Integer Medidas As Boolean Intervalo As Double Tiempo As Double TmpTot As Double End Type 'Variable para saber estado de ejecución Public Type typEstado Medida As String Tramo As Integer Inicio As Date Fin As Date Nodo3 As Integer Nodo4 As Integer Nodo5 As Integer End Type Dim arrMedidas() As typMedidas Dim Num_med As Integer Dim Num_Array_Med As Integer Dim arrPlanif() As typPlanificador Dim Num_plan As Integer Dim Num_Array_Plan As Integer Dim ind As Integer Dim Lst As ListItem Dim Tiempo_Intervalo As Double Dim T_Transcurrido As Double Global Estado_act As typEstado Dim Direc_def As String 19 'Datos de archivo Dim intArchivo_Datos As Integer Dim strArchivo_Nombre As String Private Type Configuracion IdApl As Integer Abierto As Boolean Puerto As String Baudios As String Canal(16) As Boolean End Type Global cfg As Configuracion Global Salir_PGM As Boolean Sub main() Dim txtError As String 'Se establece el directorio de trabajo Direc_def = App.Path & "\" Call Crear_Direc_Medidas ReDim arrMedidas(50) Num_med = 0 Num_Array_Med = 50 ReDim arrPlanif(50) Num_plan = 0 Num_Array_Plan = 50 Salir_PGM = False Call Inicializar_cfg Call Inicializar_Array_Medidas Call Inicializar_Array_Planif cfg.IdApl = modFlowbusAPI.OpenDLL(0) frmConexion.Show vbModal If (cfg.Abierto) Then frmPlanificador.Show 20 End If Do While Not Salir_PGM DoEvents Loop Call Guardar_cfg If (cfg.Abierto) Then txtError = modFlowbusAvanzado.CloseCommunication End If If (Len(txtError) <> 0) Then MsgBox (txtError) End If End Sub Public Sub Agregar_Tramo(Tramo_ent As typMedidas) Dim i, j, Tramo, Numero As Integer Dim Tiempo_tot As Double Do While ((i <= Num_med) And (Tramo_ent.Nombre <> arrMedidas(i).Nombre)) i = i + 1 Loop Tiempo_tot = 0 Tramo = 1 Numero = 0 Do While ((i <= Num_med) And (Tramo_ent.Nombre = arrMedidas(i).Nombre)) Tiempo_tot = arrMedidas(i).TmpTot Tramo = Tramo + 1 Numero = arrMedidas(i).Numero arrMedidas(i).TmpTot = arrMedidas(i).TmpTot + Tramo_ent.Tiempo i = i + 1 Loop 'En caso de que deba ser el último elemento de la tabla If (i > Num_med) Then 21 Num_med = Num_med + 1 Else 'Va intercalado en la tabla Num_med = Num_med + 1 For j = Num_med To i + 1 Step -1 arrMedidas(j) = arrMedidas(j - 1) Next j End If If (Numero = 0) Then Numero = Obtener_Num_Medida End If arrMedidas(i) = Tramo_ent arrMedidas(i).Numero = Numero arrMedidas(i).Tramo = Tramo arrMedidas(i).TmpTot = Tiempo_tot + Tramo_ent.Tiempo Call Refrescar_Lista_Medidas(Tramo_ent.Nombre, True) Call Validar_Array_Medidas End Sub Function Obtener_Num_Medida() As Integer Dim Num, i As Integer Num = 0 For i = 1 To Num_med If (arrMedidas(i).Numero > Num) Then Num = arrMedidas(i).Numero End If Next i If (Num = 0) Then Num = 1 End If Obtener_Num_Medida = Num End Function Sub Validar_Array_Medidas() 22 'Call Mostrar_Matriz 'si quedan menos de 5 elementos libres se amplia en 50 elementos la array If ((Num_Array_Med - Num_med) < 5) Then Num_Array_Med = Num_Array_Med + 50 ReDim Preserve arrMedidas(Num_Array_Med) MsgBox ("Se redimensiona el array medidas añadiendo elementos: " & UBound(arrMedidas)) End If 'Si quedan más de 60 elementos libres se quitan 50 Do While ((Num_Array_Med - Num_med) > 60) Num_Array_Med = Num_Array_Med - 50 ReDim Preserve arrMedidas(Num_Array_Med) MsgBox ("Se redimensiona el array medidas quitando elementos: " & UBound(arrMedidas)) Loop End Sub Sub Refrescar_Lista_Medidas(ByVal Nombre As String, ByVal Guardar As Boolean) Dim i As Integer Dim TmpTot, Horas, Mins As Double Dim Nombre_Archivo As String 'Se borran todos lo elementos frmMedidas.lstMedidas.ListItems.Clear 'Y se vuelven a insertar For i = 1 To Num_Array_Med If (arrMedidas(i).Nombre = Nombre) Then TmpTot = arrMedidas(i).TmpTot Set Lst = frmMedidas.lstMedidas.ListItems.Add(, , arrMedidas(i).Nodo3 & "%") Lst.SubItems(1) = arrMedidas(i).Nodo4 & "%" Lst.SubItems(2) = arrMedidas(i).Nodo5 & "%" Lst.SubItems(3) = arrMedidas(i).Tiempo & " mins" If (arrMedidas(i).Medidas) Then Lst.SubItems(4) = "Sí" Else: Lst.SubItems(4) = "No" 23 End If Lst.SubItems(5) = arrMedidas(i).Intervalo & " segs" End If Next i Mins = TmpTot Horas = Int(Mins / 60) Mins = Mins - (Horas * 60) frmMedidas.lblTmpTot = "Tiempo total de ejecución: " & Horas & "h:" & Mins & "m" & " (" & TmpTot & " mins)." If (Guardar) Then 'Grabar archivo de inicio Call Copias_Seguridad_Medidas Archivo = FreeFile Nombre_Archivo = Direc_def & "Medidas.ini" Open Nombre_Archivo For Binary As Archivo For i = 1 To Num_med Put Archivo, , arrMedidas(i) Next i Close Archivo Call Eliminar_Temporal_Medidas End If End Sub Public Function Mover_Tramo(Nombre As String, Tramo As Integer, Accion As Boolean) As Integer Dim i, Tramo_aux, Sig, Pos, Res As Integer Dim Med_aux As typMedidas Dim Enc_uno, Enc_dos As Boolean If (Accion) Then Sig = Tramo - 1 Else: Sig = Tramo + 1 End If 24 Pos = 0 'Buscamos el tramo siguiente/anterior For i = 1 To Num_med If ((arrMedidas(i).Nombre = Nombre) And (arrMedidas(i).Tramo = Sig)) Then Med_aux = arrMedidas(i) Pos = i Tramo_aux = arrMedidas(i).Tramo Enc_uno = True End If Next i 'Buscamos el tramo seleccionado For i = 1 To Num_med If ((arrMedidas(i).Nombre = Nombre) And (arrMedidas(i).Tramo = Tramo) And (Enc_uno)) Then arrMedidas(Pos) = arrMedidas(i) arrMedidas(Pos).Tramo = Tramo_aux Med_aux.Tramo = arrMedidas(i).Tramo arrMedidas(i) = Med_aux Enc_dos = True End If Next i If (Not Enc_uno) Then If (Accion) Then Res = MsgBox("Ya se encuentra en la primera posición", , "Aviso") Else: Res = MsgBox("Ya se encuentra en la última posición", , "Aviso") End If ElseIf (Not Enc_dos) Then Res = MsgBox("Error en la aplicación!!!") End If Call Refrescar_Lista_Medidas(Nombre, True) Call Validar_Array_Medidas If (Pos = 0) Then Mover_Tramo = Tramo Else: Mover_Tramo = arrMedidas(Pos).Tramo 25 End If End Function Sub Cargar_cmbMedida_Medidas() Dim i As Integer For i = 1 To Num_med If (arrMedidas(i).Tramo = 1) Then frmMedidas.cmbMedida.AddItem (arrMedidas(i).Nombre) End If Next i End Sub Sub Cargar_cmbMedida_Planificar() Dim i As Integer For i = 1 To Num_med If (arrMedidas(i).Tramo = 1) Then frmPlanificar.cmbMedida.AddItem (arrMedidas(i).Nombre) End If Next i End Sub Sub Cargar_cmbCopia() Dim i As Integer For i = 1 To Num_med If (arrMedidas(i).Tramo = 1) Then frmNewMedida.cmbCopia.AddItem (arrMedidas(i).Nombre) End If Next i End Sub Sub Inicializar_Array_Medidas() Dim Archivo As Integer Dim Elem As typMedidas 26 Dim Nombre_Archivo As String Archivo = FreeFile Nombre_Archivo = Direc_def & "Medidas.ini" Open Nombre_Archivo For Binary As Archivo Get Archivo, , Elem Do While (Not EOF(Archivo)) Num_med = Num_med + 1 arrMedidas(Num_med) = Elem Call Validar_Array_Medidas Get Archivo, , Elem Loop Close Archivo 'Call Mostrar_Matriz End Sub Sub Mostrar_Matriz() Dim i As Integer MsgBox ("Matriz Medidas" & vbCrLf & _ "Num_med: " & Num_med & vbCrLf & _ "Num_Array_Med: " & Num_Array_Med & vbCrLf & _ "Ubound: " & UBound(arrMedidas)) For i = 1 To Num_Array_Med MsgBox ("Elemento " & i & ":" & vbCrLf & _ "Nombre: " & arrMedidas(i).Nombre & vbCrLf & _ "Numero: " & arrMedidas(i).Numero & vbCrLf & _ "Nodo3: " & arrMedidas(i).Nodo3 & vbCrLf & _ "Nodo4: " & arrMedidas(i).Nodo4 & vbCrLf & _ "Nodo5: " & arrMedidas(i).Nodo5 & vbCrLf & _ "Medidas: " & arrMedidas(i).Medidas & vbCrLf & _ "Tiempo: " & arrMedidas(i).Tiempo & vbCrLf & _ "Tramo: " & arrMedidas(i).Tramo & vbCrLf & _ "TmpTot: " & arrMedidas(i).TmpTot) 27 Next i End Sub Sub Mostrar_Matriz_Planif() Dim i As Integer MsgBox ("Matriz Planif" & vbCrLf & _ "Num_plan: " & Num_plan & vbCrLf & _ "Num_Array_plan: " & Num_Array_Plan & vbCrLf & _ "Ubound: " & UBound(arrPlanif)) For i = 1 To Num_Array_Plan MsgBox ("Elemento " & i & ":" & vbCrLf & _ "Nombre: " & arrPlanif(i).Nombre & vbCrLf & _ "Date_ini: " & arrPlanif(i).Date_ini & vbCrLf & _ "Fecha_ini: " & arrPlanif(i).Fecha_ini & vbCrLf & _ "Hora_ini: " & arrPlanif(i).Hora_ini & vbCrLf & _ "Date_fin: " & arrPlanif(i).Date_fin & vbCrLf & _ "Fecha_fin: " & arrPlanif(i).Fecha_fin & vbCrLf & _ "Hora_fin: " & arrPlanif(i).Hora_fin & vbCrLf & _ "Estado: " & arrPlanif(i).Estado & vbCrLf & _ "Tiempo: " & arrPlanif(i).Tiempo & vbCrLf & _ "Path: " & arrPlanif(i).Path) Next i End Sub Sub Copiar_Medida(Original, Copia As String) Dim i, Tope, Numero As Integer Tope = Num_med Numero = Obtener_Num_Medida For i = 1 To Tope If (arrMedidas(i).Nombre = Original) Then Num_med = Num_med + 1 arrMedidas(Num_med) = arrMedidas(i) arrMedidas(Num_med).Nombre = Copia arrMedidas(Num_med).Numero = Numero 28 Call Validar_Array_Medidas End If Next i End Sub Sub Eliminar_Tramo(Nombre As String, Tramo As Integer) Dim i As Integer Dim Tiempo As Integer 'Se busca el tramo en cuestión i = 1 Do While ((i <= Num_med) And ((arrMedidas(i).Nombre <> Nombre) Or (arrMedidas(i).Tramo <> Tramo))) i = i + 1 Loop 'Se elimina el registro buscado If (i <= Num_med) Then Tiempo = arrMedidas(i).Tiempo Eliminar_Elemento_Medidas (i) End If 'Se recalculan los tramos For i = 1 To Num_med If ((arrMedidas(i).Nombre = Nombre) And (arrMedidas(i).Tramo > Tramo)) Then arrMedidas(i).Tramo = arrMedidas(i).Tramo - 1 End If If (arrMedidas(i).Nombre = Nombre) Then arrMedidas(i).TmpTot = arrMedidas(i).TmpTot - Tiempo End If Next i Call Refrescar_Lista_Medidas(Nombre, True) End Sub Sub Eliminar_Elemento_Medidas(Elemento As Integer) Dim i As Integer 29 For i = Elemento To Num_med arrMedidas(i) = arrMedidas(i + 1) Next i Num_med = Num_med - 1 Call Validar_Array_Medidas End Sub Sub Eliminar_Medida(Nombre As String) Dim i As Integer 'Se eliminan todos los tramos de la medida i = 1 Do While (i <= Num_med) If (arrMedidas(i).Nombre = Nombre) Then Call Eliminar_Elemento_Medidas(i) Else: i = i + 1 End If Loop Call Refrescar_Lista_Medidas(Nombre, True) End Sub Function Obtener_Tiempo_Total(Nombre As String) As Double Dim i As Integer i = 1 Do While ((i <= Num_med) And (arrMedidas(i).Nombre <> Nombre)) i = i + 1 Loop If (i <= Num_med) Then Obtener_Tiempo_Total = arrMedidas(i).TmpTot Else: Obtener_Tiempo_Total = 0 End If End Function Function Obtener_FechaFin(ByVal Fecha_ent As Date, Tiempo_ent As Double) As Date 30 Dim Dia_ent, Mes_ent, Año_ent, Horas_ent, Min_ent As Integer Dim Num_dias, Num_horas, Num_min As Integer Dim Dia_sal, Mes_sal, Año_sal, Hora_sal, Min_sal As Integer Dim Dias_rest, Dia_act, Mes_act, Año_act, Dias_mes As Integer Dim Encontrado, Fecha_fmt, Hora_str As String Fecha_fmt = Format(Fecha_ent, "dd/mm/yyyy HH:mm") Dia_ent = Int(Mid(Fecha_fmt, 1, 2)) Mes_ent = Int(Mid(Fecha_fmt, 4, 2)) Año_ent = Int(Mid(Fecha_fmt, 7, 4)) Horas_ent = Int(Mid(Fecha_fmt, 12, 2)) Min_ent = Int(Mid(Fecha_fmt, 15, 2)) Num_dias = Int(Tiempo_ent / 1440) Num_min = Tiempo_ent - (Num_dias * 1440) Num_horas = Int(Num_min / 60) Num_min = Num_min - (Num_horas * 60) 'se suman los minutos If ((Num_min + Min_ent) > 59) Then Min_sal = Min_ent + Num_min - 60 If (Num_horas = 23) Then Num_horas = 0 Num_dias = Num_dias + 1 Else: Num_horas = Num_horas + 1 End If Else: Min_sal = Min_ent + Num_min End If 'Se suman las horas If ((Num_horas + Horas_ent) > 23) Then Hora_sal = Horas_ent + Num_horas - 24 Num_dias = Num_dias + 1 Else: Hora_sal = Horas_ent + Num_horas End If 'Se suman los días Encontrado = "N" 31 Dias_rest = Num_dias Dia_act = Dia_ent Mes_act = Mes_ent Año_act = Año_ent Do While (Encontrado = "N") Select Case (Mes_act) Case 2 If ((Año_act Mod 4 = 0) And ((Año_act Mod 100 <> 0) Or (Año_act Mod 400 = 0))) Then Dias_mes = 29 Else: Dias_mes = 28 End If Case 4, 6, 9, 11 Dias_mes = 30 Case Else Dias_mes = 31 End Select If (Dias_rest > (Dias_mes - Dia_act)) Then Dias_rest = Dias_rest - (Dias_mes - Dia_act) Dia_act = 0 If (Mes_act = 12) Then Mes_act = 1 Año_act = Año_act + 1 Else: Mes_act = Mes_act + 1 End If Else: Dia_sal = Dia_act + Dias_rest Mes_sal = Mes_act Año_sal = Año_act Encontrado = "S" End If Loop Obtener_FechaFin = Dia_sal & "/" & Mes_sal & "/" & Año_sal & " " & Hora_sal & ":" & Min_sal End Function Function Añadir_Planificacion(ByVal Medida As String, ByVal Fecha As Date, ByVal Path As String) As Boolean Dim i, Ind_ant As Integer Dim Fecha_fin As Date 32 Dim strFecha_ini, strFecha_fin As String Dim Insertado As Boolean Dim TmpTot As Double Insertado = True 'Se busca el lugar que le toca, según planificacción i = 1 Do While ((i <= Num_plan) And (Formato_Date(arrPlanif(i).Fecha_ini, arrPlanif(i).Hora_ini) < Fecha)) i = i + 1 Loop TmpTot = Obtener_Tiempo_Total(Medida) Fecha_fin = Obtener_FechaFin(Fecha, TmpTot) strFecha_ini = Format(Fecha, "dd/mm/yyyy HH:mm") strFecha_fin = Format(Fecha_fin, "dd/mm/yyyy HH:mm") 'Se valida que no se solape con otra medida If (i > 1) Then If ((Fecha <= arrPlanif(i - 1).Date_fin) And (arrPlanif(i - 1).Estado = "Pendiente")) Then Insertado = False End If End If If (Insertado) Then Num_plan = Num_plan + 1 If (i <= Num_plan) Then For j = Num_plan To i + 1 Step -1 MsgBox ("se asigna a la posicion: " & j) arrPlanif(j) = arrPlanif(j - 1) Next j arrPlanif(i).Nombre = Medida arrPlanif(i).Fecha_ini = Mid(strFecha_ini, 1, 10) arrPlanif(i).Hora_ini = Mid(strFecha_ini, 12, 5) arrPlanif(i).Date_ini = Fecha arrPlanif(i).Fecha_fin = Mid(strFecha_fin, 1, 10) arrPlanif(i).Hora_fin = Mid(strFecha_fin, 12, 5) arrPlanif(i).Date_fin = Fecha_fin arrPlanif(i).Estado = "Pendiente" 33 arrPlanif(i).Tiempo = TmpTot arrPlanif(i).Path = Path Else: arrPlanif(Num_plan).Nombre = Medida arrPlanif(Num_plan).Fecha_ini = Mid(strFecha_ini, 1, 10) arrPlanif(Num_plan).Hora_ini = Mid(strFecha_ini, 12, 5) arrPlanif(Num_plan).Date_ini = Fecha arrPlanif(Num_plan).Fecha_fin = Mid(strFecha_fin, 1, 10) arrPlanif(Num_plan).Hora_fin = Mid(strFecha_fin, 12, 5) arrPlanif(Num_plan).Date_fin = Fecha_fin arrPlanif(Num_plan).Estado = "Pendiente" arrPlanif(Num_plan).Tiempo = TmpTot arrPlanif(i).Path = Path End If Call Refrescar_Lista_Planificador Call Validar_Array_Planif End If If (ind = 0) Then ind = Num_plan End If Añadir_Planificacion = Insertado End Function Sub Refrescar_Lista_Planificador() Dim i, Archivo As Integer Dim TmpTot, Horas, Mins As Double Dim Nombre_Archivo As String 'Se borran todos los elementos frmPlanificador.lstPlanif.ListItems.Clear 'Y se vuelven a insertar For i = 1 To Num_plan Set Lst = frmPlanificador.lstPlanif.ListItems.Add(, , i) Lst.SubItems(1) = arrPlanif(i).Nombre Lst.SubItems(2) = arrPlanif(i).Fecha_ini Lst.SubItems(3) = arrPlanif(i).Hora_ini Lst.SubItems(4) = arrPlanif(i).Fecha_fin 34 Lst.SubItems(5) = arrPlanif(i).Hora_fin Lst.SubItems(6) = arrPlanif(i).Estado Next i 'Grabar archivo de inicio Call Copias_Seguridad_Planificador Archivo = FreeFile Nombre_Archivo = Direc_def & "Planif.ini" Open Nombre_Archivo For Binary As Archivo For i = 1 To Num_plan Put Archivo, , arrPlanif(i) Next i Close Archivo Call Eliminar_Temporal_Planificador End Sub Sub Validar_Array_Planif() 'Call Mostrar_Matriz 'si quedan menos de 5 elementos libres se amplia en 50 elementos la array If ((Num_Array_Plan - Num_plan) < 5) Then Num_Array_Plan = Num_Array_Plan + 50 ReDim Preserve arrPlanif(Num_Array_Plan) MsgBox ("Se redimensiona el array planif añadiendo elementos: " & UBound(arrPlanif)) End If 'Si quedan más de 60 elementos libres se quitan 50 Do While ((Num_Array_Plan - Num_plan) > 60) Num_Array_Plan = Num_Array_Plan - 50 ReDim Preserve arrPlanif(Num_Array_Plan) MsgBox ("Se redimensiona el array planif quitando elementos: " & UBound(arrPlanif)) Loop End Sub 35 Sub Inicializar_Array_Planif() Dim i, Archivo As Integer Dim Elem As typPlanificador Dim Nombre_Archivo As String Archivo = FreeFile Nombre_Archivo = Direc_def & "Planif.ini" Open Nombre_Archivo For Binary As Archivo Get Archivo, , Elem Do While (Not EOF(Archivo)) Num_plan = Num_plan + 1 arrPlanif(Num_plan) = Elem Call Validar_Array_Planif Get Archivo, , Elem Loop Close Archivo 'Estudiar estados Fecha_act = Now For i = 1 To Num_plan If ((arrPlanif(i).Estado <> "Completado") And (arrPlanif(i).Date_ini < Fecha_act)) Then arrPlanif(i).Estado = "No Ejecutado" End If If ((arrPlanif(i).Estado = "Pendiente") And (ind = 0)) Then ind = i End If Next i 'Call Mostrar_Matriz_Planif End Sub Function Formato_Date(ByVal Fecha As String, ByVal Hora As String) As Date Dim Fecha_sal, Hora_sal As String If ((Fecha = "") Or (Fecha = " ")) Then 36 Fecha_sal = "01/01/0000" Else: Fecha_sal = Fecha End If If ((Hora = "") Or (Hora = " ")) Then Hora_sal = "00:00" Else: Hora_sal = Hora End If Formato_Date = Fecha_sal & " " & Hora_sal End Function Sub Eliminar_Elemento_Planificador(Index As Integer) Dim i As Integer For i = Index To Num_plan arrPlanif(i) = arrPlanif(i + 1) Next i Num_plan = Num_plan - 1 End Sub Sub Eliminar_planificacion(Index As Integer) Call Eliminar_Elemento_Planificador(Index) Call Refrescar_Lista_Planificador Call Validar_Array_Planif End Sub Function Eliminar_Completados() As Integer Dim i, Eliminados, Index As Integer MsgBox ("num_plan: " & Num_plan) i = 1 Eliminados = 0 Do While (i <= Num_plan) Index = i If (arrPlanif(i).Estado = "Completado") Then 37 Eliminados = Eliminados + 1 Call Eliminar_Elemento_Planificador(Index) Else: i = i + 1 End If Loop MsgBox ("num_plan: " & Num_plan) Call Refrescar_Lista_Planificador Call Validar_Array_Planif Eliminar_Completados = Eliminados End Function Sub Set_Tiempo_Intervalo(Tiempo As Double) Tiempo_Intervalo = Tiempo If (Tiempo_Intervalo > 0) Then frmPlanificador.tmrIntervalo.Enabled = True Else: frmPlanificador.tmrIntervalo.Enabled = False T_Transcurrido = 0 End If End Sub Function Get_Tiempo_Intervalo() As Double Dim Acabado As Boolean T_Transcurrido = T_Transcurrido + 1 If ((T_Transcurrido = Tiempo_Intervalo) And (Tiempo_Intervalo > 0)) Then Acabado = True T_Transcurrido = 0 Else: Acabado = False End If Get_Tiempo_Intervalo = Acabado End Function Sub Copias_Seguridad_Planificador() On Error Resume Next Dim Nombre_Archivo1, Nombre_Archivo2 As String 38 'Se hacen copias de seguridad de los archivos existentes del planificador Nombre_Archivo1 = Direc_def & "Planif.old" Nombre_Archivo2 = Direc_def & "Planif.tmp" FileCopy Nombre_Archivo1, Nombre_Archivo2 Kill Nombre_Archivo1 Nombre_Archivo1 = Direc_def & "Planif.ini" Nombre_Archivo2 = Direc_def & "Planif.old" FileCopy Nombre_Archivo1, Nombre_Archivo2 Kill Nombre_Archivo1 End Sub Sub Copias_Seguridad_Medidas() On Error Resume Next Dim Nombre_Archivo1, Nombre_Archivo2 As String 'Se hacen copias de seguridad de los archivos existentes de las medidas Nombre_Archivo1 = Direc_def & "Medidas.old" Nombre_Archivo2 = Direc_def & "Medidas.tmp" FileCopy Nombre_Archivo1, Nombre_Archivo2 Kill Nombre_Archivo1 Nombre_Archivo1 = Direc_def & "Medidas.ini" Nombre_Archivo2 = Direc_def & "Medidas.old" FileCopy Nombre_Archivo1, Nombre_Archivo2 Kill Nombre_Archivo1 End Sub Sub Eliminar_Temporal_Medidas() On Error Resume Next Dim Nombre_Archivo As String Nombre_Archivo = Direc_def & "Medidas.tmp" Kill Nombre_Archivo End Sub Sub Eliminar_Temporal_Planificador() 39 On Error Resume Next Dim Nombre_Archivo As String Nombre_Archivo = Direc_def & "Planif.tmp" Kill Nombre_Archivo End Sub Function Existe_Path(Path As String) As Integer Dim i As Integer i = 1 Do While ((i <= Num_plan) And ((Path <> arrPlanif(i).Path) Or (arrPlanif(i).Estado <> "Pendiente"))) i = i + 1 Loop If (i > Num_plan) Then i = 0 End If Existe_Path = i End Function Sub Validar_Planificacion() If (Estado_act.Medida = "") Then If ((Now > arrPlanif(ind).Date_ini) And (arrPlanif(ind).Estado = "Pendiente")) Then Call Iniciar_Ejecucion End If Else If (Now > Estado_act.Fin) Then Call Cambiar_Tramo_Ejecucion End If End If End Sub 40 Sub Iniciar_Ejecucion() Dim ind_tram As Integer arrPlanif(ind).Estado = "En Ejecución" Call Refrescar_Lista_Planificador Estado_act.Medida = arrPlanif(ind).Nombre ind_tram = Obtener_Indicador_Siguiente_Tramo(Estado_act.Medida, 0) If (ind_tram > 0) Then Estado_act.Tramo = arrMedidas(ind_tram).Tramo Estado_act.Inicio = arrPlanif(ind).Date_ini Estado_act.Fin = Obtener_FechaFin(arrPlanif(ind).Date_ini, arrMedidas(ind_tram).Tiempo) Call Iniciar_Fichero(arrPlanif(ind).Path) Print #intArchivo_Datos, "Estados de los nodos: -Nodo3: " & arrMedidas(ind_tram).Nodo3 & "%. -Nodo4: " & arrMedidas(ind_tram).Nodo4 & "%. -Nodo5: " & arrMedidas(ind_tram).Nodo5 & "%." Print #intArchivo_Datos, " " If (arrMedidas(ind_tram).Medidas) Then Set_Tiempo_Intervalo (arrMedidas(ind_tram).Intervalo) Else: Print #intArchivo_Datos, "- Tramo sin medidas" Set_Tiempo_Intervalo (0) End If Call Establecer_Setpoint(arrMedidas(ind_tram).Nodo3, arrMedidas(ind_tram).Nodo4, arrMedidas(ind_tram).Nodo5) frmProceso.Show vbModeless, Me Else: Res = MsgBox("La medida: " & arrPlanif(ind).Nombre & ", que se pretendia ejecutar no existe", "Error") arrPlanif(ind).Estado = "No Ejecutado" If (ind < Num_plan) Then ind = ind + 1 End If End If End Sub Function Obtener_Indicador_Siguiente_Tramo(ByVal Medida As String, Tramo As Integer) As Integer Dim i, Tramo_act, Ind_act As Integer For i = 1 To Num_med If ((arrMedidas(i).Nombre = Medida) And (arrMedidas(i).Tramo > Tramo) And ((arrMedidas(i).Tramo < Tramo_act) Or (Tramo_act = 0))) Then 41 Tramo_act = arrMedidas(i).Tramo Ind_act = i End If Next i Obtener_Indicador_Siguiente_Tramo = Ind_act End Function Sub Crear_Direc_Medidas() On Error Resume Next Dim Nombre_Directorio As String Nombre_Directorio = Direc_def & "Medidas\" MkDir (Nombre_Directorio) End Sub Function Obtener_Direc_Medidas() As String Obtener_Direc_Medidas = Direc_def & "Medidas\" End Function Sub Cambiar_Tramo_Ejecucion() Dim ind_tram As Integer Dim Caudal3 As Integer Dim Caudal4 As Integer Dim Caudal5 As Integer ind_tram = Obtener_Indicador_Siguiente_Tramo(Estado_act.Medida, Estado_act.Tramo) If (ind_tram > 0) Then Call Obtener_Caudal(Caudal3, Caudal4, Caudal5) Print #intArchivo_Datos, " " Print #intArchivo_Datos, "Caudal 3: " & Caudal3 & "% - Caudal 4: " & Caudal4 & "% - Caudal 5: " & Caudal5 & "%" Print #intArchivo_Datos, " " Estado_act.Tramo = arrMedidas(ind_tram).Tramo Estado_act.Inicio = Estado_act.Fin 42 Estado_act.Fin = Obtener_FechaFin(Estado_act.Inicio, arrMedidas(ind_tram).Tiempo) Print #intArchivo_Datos, "Tramo " & Estado_act.Tramo & ":" Print #intArchivo_Datos, " " Print #intArchivo_Datos, "Estados de los nodos: -Nodo3: " & arrMedidas(ind_tram).Nodo3 & "%. -Nodo4: " & arrMedidas(ind_tram).Nodo4 & "%. -Nodo5: " & arrMedidas(ind_tram).Nodo5 & "%." Print #intArchivo_Datos, " " If (arrMedidas(ind_tram).Medidas) Then Set_Tiempo_Intervalo (arrMedidas(ind_tram).Intervalo) Else: Print #intArchivo_Datos, "- Tramo sin medidas" Set_Tiempo_Intervalo (0) End If Call Establecer_Setpoint(arrMedidas(ind_tram).Nodo3, arrMedidas(ind_tram).Nodo4, arrMedidas(ind_tram).Nodo5) Else: Call Acabar_Proceso("Completado") End If End Sub Sub Iniciar_Fichero(ByVal Path As String) intArchivo_Datos = FreeFile Open Path For Output As intArchivo_Datos Print #intArchivo_Datos, "Datos medida: " & Estado_act.Medida Print #intArchivo_Datos, "Tramo 1:" Print #intArchivo_Datos, " " End Sub Sub Tomar_Medidas() Dim i As Integer Dim Estado As Integer Dim Valor_ret As Integer Dim Ignorar_Avisos As Integer Dim Valor As Double Dim can(16) As String Dim str_Canales As String For i = 1 To 16 If (cfg.Canal(i)) Then 43 Estado = AI_VRead(1, i, 1, Valor) Valor_ret = NIDAQErrorHandler(Estado, "AI_VRead", Ignorar_Avisos) If (Estado = 0) Then If (Valor > 0) Then can(i) = Format(Valor, "0.00") Else: can(i) = "Err" End If Else: can(i) = "Err" End If Else: can(i) = "ND" End If str_Canales = str_Canales & "[Can " & i & ": " & can(i) & "] " Next i Print #intArchivo_Datos, Format(Fecha_ent, "dd/mm/yyyy HH:mm") & " - " & str_Canales End Sub Sub Establecer_Setpoint(ByVal Nodo3 As Integer, ByVal Nodo4 As Integer, ByVal Nodo5 As Integer) Dim txtError As String Dim ValError As Integer Dim Estado As Byte Dim Valor As String Dim Res As Integer If (Not cfg.Abierto) Then MsgBox ("Puerto comunicaciones cerrado") Else: 'Se establece el valor del nodo 3 Valor = Int(32000 * (Nodo3 / 100)) txtError = modFlowbusAvanzado.WriteParameterDirect(3, 1, 1, "i", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txterrorm, , "Error MassFlow 1") txtError = "" End If 44 'Se establece el valor del nodo 4 Valor = Int(32000 * (Nodo4 / 100)) txtError = modFlowbusAvanzado.WriteParameterDirect(4, 1, 1, "i", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txterrorm, , "Error MassFlow 2") txtError = "" End If 'Se establece el valor del nodo 5 Valor = Int(32000 * (Nodo5 / 100)) txtError = modFlowbusAvanzado.WriteParameterDirect(5, 1, 1, "i", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txterrorm, , "Error MassFlow 3") txtError = "" End If End If End Sub Sub Obtener_Caudal(ByRef Caudal3 As Integer, ByRef Caudal4 As Integer, ByRef Caudal5 As Integer) Dim txtError As String Dim ValError As Integer Dim txtCaudal As String Dim Estado As Byte Dim Res As Integer If (Not cfg.Abierto) Then txtError = "Puerto comunicaciones no abierto" Res = MsgBox(txtError, , "Error MassFlows") Else 'Obtener Caudal Nodo3 txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 0, "i", 0, 150, txtCaudal, ValError, Estado) 45 If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow 3") Caudal3 = 0 txtError = "" Else Caudal3 = Int(txtCaudal * (100 / 32000)) End If 'Obtener Caudal Nodo4 txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 0, "i", 0, 150, txtCaudal, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow 4") Caudal4 = 0 txtError = "" Else Caudal4 = Int(txtCaudal * (100 / 32000)) End If 'Obtener Caudal Nodo5 txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 0, "i", 0, 150, txtCaudal, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow 5") Caudal5 = 0 txtError = "" Else Caudal5 = Int(txtCaudal * (100 / 32000)) End If End If End Sub Sub Inicializar_cfg() Dim Archivo As Integer Dim Nombre_Archivo As String Archivo = FreeFile 46 Nombre_Archivo = Direc_def & "Config.ini" Open Nombre_Archivo For Binary As Archivo Get Archivo, , cfg Close Archivo End Sub Sub Guardar_cfg() Dim Archivo As Integer Dim Nombre_Archivo As String Call Copias_Seguridad_cfg cfg.Abierto = False Archivo = FreeFile Nombre_Archivo = Direc_def & "Config.ini" Open Nombre_Archivo For Binary As Archivo Put Archivo, , cfg Close Archivo End Sub Sub Copias_Seguridad_cfg() On Error Resume Next Dim Nombre_Archivo1, Nombre_Archivo2 As String 'Se hacen copias de seguridad de los archivos de configuración existentes Nombre_Archivo1 = Direc_def & "Config.old" Nombre_Archivo2 = Direc_def & "Config.tmp" FileCopy Nombre_Archivo1, Nombre_Archivo2 Kill Nombre_Archivo1 Nombre_Archivo1 = Direc_def & "Config.ini" Nombre_Archivo2 = Direc_def & "Config.old" FileCopy Nombre_Archivo1, Nombre_Archivo2 Kill Nombre_Archivo1 47 End Sub Function Tiempo_Horas(ByVal Tiempo As Integer) As String Dim Horas As Integer Dim minutos As Integer Horas = Int(Tiempo / 60) minutos = Tiempo - Horas Tiempo_Horas = Format(Horas & ":" & minutos & ":00", "HH:mm:ss") End Function Sub Obtener_Setpoint(ByRef Nodo3 As Integer, ByRef Nodo4 As Integer, ByRef Nodo5 As Integer) Dim txtError As String Dim ValError As Integer Dim Estado As Byte Dim Valor As String Dim Res As Integer If (Not cfg.Abierto) Then MsgBox ("Puerto comunicaciones cerrado") Else 'Se obtiene el valor del nodo 3 txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 1, "i", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow 3") txtError = "" Nodo3 = 0 Else Nodo3 = Int(Valor * (100 / 32000)) End If 'Se obtiene el valor del nodo 4 txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 1, "i", 0, 150, Valor, ValError, Estado) 48 If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow 4") txtError = "" Nodo4 = 0 Else Nodo4 = Int(Valor * (100 / 32000)) End If 'Se obtiene el valor del nodo 5 txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 1, "i", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow 5") txtError = "" Nodo5 = 0 Else Nodo5 = Int(Valor * (100 / 32000)) End If End If End Sub Sub Obtener_Gas(ByRef Gas3 As String, ByRef Gas4 As String, ByRef Gas5 As String) Dim txtError As String Dim ValError As Integer Dim Estado As Byte Dim Valor As String * 10 Dim Res As Integer If (Not cfg.Abierto) Then MsgBox ("Puerto comunicaciones cerrado") Else 'Se obtiene el gas del nodo 3 txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 17, "c", 10, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow goas 3") 49 txtError = "" Gas3 = "" Else Gas3 = Valor End If 'Se obtiene el gas del nodo 4 txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 17, "c", 10, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow goas 4") txtError = "" Gas4 = "" Else Gas4 = Valor End If 'Se obtiene el gas del nodo 5 txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 17, "c", 10, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow goas 5") txtError = "" Gas5 = "" Else Gas5 = Valor End If End If End Sub Sub Obtener_Val_Gas() Dim txtError As String Dim ValError As Integer Dim Estado As Byte Dim Valor As String Dim Res As Integer 50 If (Not cfg.Abierto) Then MsgBox ("Puerto comunicaciones cerrado") Else 'Se obtiene el gas del nodo 3 txtError = modFlowbusAvanzado.ReadParameterDirect(3, 1, 16, "c", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow gas 3") txtError = "" Else MsgBox (Valor) End If 'Se obtiene el gas del nodo 4 txtError = modFlowbusAvanzado.ReadParameterDirect(4, 1, 16, "c", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow gas 4") txtError = "" Else MsgBox (Valor) End If 'Se obtiene el gas del nodo 5 txtError = modFlowbusAvanzado.ReadParameterDirect(5, 1, 16, "c", 0, 150, Valor, ValError, Estado) If (Len(txtError) <> 0) Then Res = MsgBox(txtError, , "Error MassFlow gas 5") txtError = "" Else MsgBox (Valor) End If End If End Sub Sub Acabar_Proceso(ByVal Estado As String) 51 Dim Caudal3 As Integer Dim Caudal4 As Integer Dim Caudal5 As Integer Dim i As Integer Dim Encontrado As Boolean Call Obtener_Caudal(Caudal3, Caudal4, Caudal5) Print #intArchivo_Datos, " " Print #intArchivo_Datos, "Caudal 3: " & Caudal3 & "% - Caudal 4: " & Caudal4 & "% - Caudal 5: " & Caudal5 & "%" Print #intArchivo_Datos, " " Close intArchivo_Datos Call Establecer_Setpoint(0, 0, 0) Unload frmProceso arrPlanif(ind).Estado = Estado Call Refrescar_Lista_Planificador Estado_act.Medida = "" Estado_act.Tramo = 0 Estado_act.Inicio = 0 Estado_act.Fin = 0 Set_Tiempo_Intervalo (0) Encontrado = False i = ind + 1 Do While ((i <= Num_plan) And (Not Encontrado)) If (arrPlanif(i).Estado = "Pendiente") Then ind = i Encontrado = True End If Loop End Sub Function Dif_Dias(ByVal Dia_act As Integer, ByVal Mes_act As Integer, ByVal Any_act As Integer, _ ByVal Dia_ant As Integer, ByVal Mes_ant As Integer, ByVal Any_ant As Integer) As Integer Dim i As Integer Dim Dias As Integer Dim Dias_act As Integer 52 'Función que calcula la diferencia de dias entre dos fechas del mismo año. 'Se considera que si el año es igual a o queremos los dias que llevamos del año. 'Si el año es diferente queremos los dias que faltan para acabar el año. 'Si el año es igual la diferencia entre las dos fechas. If (Any_ant = 0) Then 'Se quieren los dias que se llevan del año. For i = 1 To Mes_act - 1 Dias = Dias + (Obtener_Dias_Mes(i, Any_act)) Next i Dias = Dias + Dia_act ElseIf (Any_act <> Any_ant) Then 'Se quieren los dias del año que quedan For i = 1 To Mes_ant - 1 Dias = Dias + (Obtener_Dias_Mes(i, Any_ant)) Next i Dias = Dias + Dia_ant If (Es_Bisiesto(Any_ant)) Then Dias = 366 - Dias Else: Dias = 665 - Dias End If Else 'Se quiere la diferencia de dias entre dos fechas dentro del mismo año For i = 1 To Mes_act - 1 Dias = Dias + (Obtener_Dias_Mes(i, Any_act)) Next i Dias = Dias + Dia_act Dias_act = Dias Dias = 0 For i = 1 To Mes_ant - 1 Dias = Dias + (Obtener_Dias_Mes(i, Any_ant)) Next i Dias = Dias + Dia_ant + 1 'se suma 1 porque se quiere a partir de las 00:00:00 del 'dia siguiente. If (Dias_act >= Dias) Then Dias = Dias_act - Dias Else Dias = 0 53 MsgBox ("Error dif_dias") End If End If Dif_Dias = Dias End Function Function Es_Bisiesto(ByVal Any_act As Integer) As Boolean Dim Bisiesto As Boolean If ((Any_act Mod 4 = 0) And ((Any_act Mod 100 <> 0) Or (Any_act Mod 400 = 0))) Then Bisiesto = True Else: Bisiesto = False End If Es_Bisiesto = Bisiesto End Function Function Obtener_Dias_Mes(ByVal Mes_act As Integer, Any_act As Integer) As Integer Dim Dias As Integer Select Case (Mes_act) Case 2 If (Es_Bisiesto(Any_act)) Then Dias = 29 Else: Dias = 28 End If Case 4, 6, 9, 11 Dias = 30 Case 1, 3, 5, 7, 8, 10, 12 Dias = 31 Case Else Dias = 0 End Select Obtener_Dias_Mes = Dias 54 End Function 3.2.2. API Comunicación Mass Flow (modFlowbusAPI.bas) Option Explicit '-----------------------USER DEFINED TYPES--------------------------------------------'Type which contains information about available communication ports and cards 'prefix: udt_PortInfo_ Public Type PortInfoType bInUse As Boolean currently in use 'Tells wheter or not the port / card is sPortName As String * 25 'Name of the port / card, maximum of 25 characters End Type '-----------------------END OF USER DEFINED TYPES--------------------------------------- ' FLOWB32.DLL function description for use in Microsoft Visual Basic ' NOTE: This functions can also be called from other environments, such as C or Pascal. ' In that case only the calling syntax will be different, not the functionality ' of these routines. ' For calling syntax in BorlandC, see file FLOWBUS.H ' Following functions can be called by WINDOWS application programs ' The FLOWB32.DLL provides a mechanism to transport parameter values to a specific ' module connected to the Bronkhorst High-Tech FLOW-BUS. ' Each module has its specific list with parameters ' Each parameter is of type integer/float/long/char/string and mostly has min and max values ' Some parameters are read-only or write-only ' On FLOW-BUS modules a parameter is located on a 'process' ' Each FLOW-BUS module has its own 'node-address' in the system (systems can have up ' to 120 nodes (addresses) ' So, when locating a parameter for changing/reading its value you need to know: ' node - process - parameter number 55 ' For more convenience in addressing parameters there are virtual channel numbers linked ' to node-processes. ' This means that you can work with parameters on a certain channel. ' When communication is openened, the actual FLOW-BUS system configuration is read and ' stored in a large structure in memory. ' You can determine the amount of nodes, amount of channels and the link of a channel ' to a certain node-process with help of following functions ' Bronkhorst High-Tech also offers a WINDOWS DDE-server which makes use of all functions ' below and actually behaves as a software layer between your application and FLOW-BUS. ' For communication, just select an interface in the DDE-server and start-up. ' When the program is running you can read/write parameters on a DDEchannel ' Advantage: much easier for the user, Disadvantage: slower than communication directly ' through C or Pascal ' Globals '--------------ERROR LIST SECTION----------------------------------------------------------------'FBE_NO_ERROR 0 No error 'FBE_PROCESS_CLAIM module 1 This process cannot be operated by this 'FBE_COMMAND 2 No such command possible for this module 'FBE_PROCESS 3 No such process at this module 'FBE_PARM_NUMBER 4 No such parameter at this process 'FBE_PARM_TYPE on module 5 Type of parameter sent differs from type 'FBE_PARM_VALUE accepted 6 Wrong value for this parameter or not 'FBE_NETWORK_NOT_ACTIVE detected 7 No communication activity on FLOW-BUS 'FBE_TIME_OUT_START_CHAR failed 8 Start character serial communication 'FBE_TIME_OUT_SERIAL_LINE 9 Serial communication failed 'FBE_MODULE_HARDWARE_MEM 10 Memory on FLOW-BUS module failed 'FBE_NODE_ADDRESS 11 Wrong node number 56 'FBE_COMMUNICATION 12 General communication error 'FBE_READ_ONLY_PARM 13 This parameter value can only be read 'FBE_PC_COMMUNICATION FLOW -BUS 14 There is no communication between PC and 'FBE_RS232_CONNECTION and a RS232-module 15 HOST_ERROR, no/bad connection between PC 'FBE_PC_MEMORY 16 for communication structure DLL ERROR, not enough memory in your PC 'FBE_WRITE_ONLY_PARM 17 this parameter value can only be send 'FBE_SYS_CONFIG_UNKNOWN 18 FLOW-BUS system configuration is unknown 'FBE_NO_FREE_NODE_ADDR nodes) 19 FLOW-BUS system reached maximum size (32 'FBE_WRONG_INTERFACE_TYPE option 20 need other type of interface for this 'FBE_BUILD_DCB block serial port 21 DLL_ERROR, error building device control 'FBE_OPEN_COMM 22 DLL ERROR, open communication went wrong 'FBE_COMM_STATE 23 DLL ERROR, communication status error 'FBE_INTERFACE_BUSMASTER (alone in system) 24 interface tries to start communication 'FBE_TIMEOUT_ON_RX_ANSWER 25 time out on rx answer 'FBE_NO_START_CHAR 26 HOST ERROR, no ':' on start of message 'FBE_FIRST_DIGIT 27 HOST ERROR, error in first digit 'FBE_HOST_OVERFLOW 28 HOST ERROR, buffer overflow in host 'FBE_BUFFER_OVERFLOW 29 DLL ERROR, buffer overflow in DLL 'FBE_NO_ANSWER_FOUND 30 DLL ERROR, requested answer not found 'FBE_CLOSE_COMM 31 DLL ERROR, closing communication error 'FBE_SYNCHRON_ERROR action 32 DLL ERROR, other application performs 'FBE_SEND_ERROR 33 DLL ERROR, requested msg. not send 'FBE_PROTOCOL_ERROR 34 DLL ERROR, error in received data 'FBE_NO_EVENT realtimechannel 35 DLL ERROR, no event present on '--------------END OF ERROR LIST SECTION---------------------------------------------------------- '--------------FUNCTIONS TO OPEN / CLOSE THE DLL-------------------------------------------------'************************************************************************ **** ' ' OpenDLL ' ' Author : Bronkhorst High-Tech B.V. 57 ' Date : 16-Dec-2003 Function : Function which opens the DLL for a certain application. ' ' ' In theory it should be possible to attach different applications to the same DLL. ' In practice, however it will not work. Therefore you should call this function ' problems. ONLY ONCE in your code (at initialization), to avoid ' Parameters: ' (In) ' (Out) lHwnd: Always supply value 0 for this parameter ' Returned : 0, if the function failed, otherwise an ApplicationId. Don't throw this ' ApplicationId away, because you must use it in almost every other DLL-function.. ' Remarks : ' Public Declare Function OpenDLL Lib "Flowb32.dll" (ByVal lHwnd As Long) As Integer '************************************************************************ **** ' ' CloseDLL ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which closes the DLL for a certain application. ' ' ' In theory it should be possible to attach different applications to the same DLL. ' In practice, however it will not work. Therefore you should call this function ' ONLY ONCE in your code (when closing the application), to avoid problems. ' Parameters: ' (In) iAppId: The ApplicationId of your application (retrieved from function OpenDLL()) ' (Out) ' Returned : ' Remarks : ' Public Declare Sub CloseDLL Lib "Flowb32.dll" (ByVal iAppId As Integer) 58 '--------------END OF FUNCTIONS TO OPEN / CLOSE THE DLL------------------------------------------- '--------------FUNCTIONS TO OPEN / CLOSE THE COMMUNICATION WITH THE FLOWBUS-----------------------'************************************************************************ **** ' ' OpenCommunication ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which opens the communication with the flowbus on a specified COM-port. ' Parameters: ' (In) example) ' sPortName: Name of the port to open ("COM1" or "COM2" for (Out) ' Returned : 0 on succes, an error from the "ERROR LIST SECTION" (see beginning of this module) ' ' on failure Remarks : ' Public Declare Function OpenCommunication Lib "Flowb32.dll" (ByVal sPortName As String) As Integer '************************************************************************ **** ' ' CloseCommunication ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which closes the communication with the flowbus on a specified port. ' Parameters: ' (In) example) ' sPortName: Name of the port to close ("COM1" or "COM2" for (Out) ' Returned : 0 on succes, an error from the "ERROR LIST SECTION" (see beginning of this module) ' on failure 59 ' Remarks : ' Public Declare Function CloseCommunication Lib "Flowb32.dll" () As Integer '--------------END OF FUNCTIONS TO OPEN / CLOSE THE COMMUNICATION WITH THE FLOWBUS----------------- '--------------FUNCTIONS TO GET / SET THE BAUDRATE OF YOUR COM-PORT------------------------------'Baudrates are always positive values in the range 0 - 65535 (65535 included) 'However because of the datatypes Visual Basic supplies the baudrate has to be recalculated. ' 'In the "Remarks"-section of the following function, I assume you have a baudrate of type 'Long (lBaudRate). The "Remarks"-section contains the code to convert the baudrate (lBaudRate). '************************************************************************ **** ' ' ConfigureRS232 ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function to configure the baudrate of a certain COM-port. ' ' ' This function should be called before calling OpenCommunication(). ' The baudrate of your pc's COM-port (the one you use to communicate with ' your flowbus), must of course be the same as the baudrate of ' "RS232/Flowbus interface"-box ' Parameters: ' (In) for example) sPortName: Name of the port to configure ("COM1" or "COM2" ' iBaudRate: New baudrate for the port ' section, see below) ' (calculated from the formula in the "Remarks" (Out) ' Returned : 0 on succes, non-zero on failure ' Remarks : Converting the baudrate (lBaudRate) to iBaudrate 60 ' If lBaudRate <= 32767 Then ' iBaudRate = lBaudRate ' Else ' iBaudRate = lBaudRate - 65536 ' End If Public Declare Function ConfigureRS232 Lib "Flowb32.dll" (ByVal sPortName As String, _ ByVal iBaudRate As Integer) As Integer '************************************************************************ **** ' ' GetRS232Config ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function port. : Function to read / get the baudrate of a certain COM- ' Parameters: ' (In) ' (Out) sPortName: Name of the current communication port ("COM1" or "COM2" for example) ' iBaudRate: Baudrate of the port (needs to be converted to a long, lBaudRate) ' (See "Remarks"-section below) ' Returned : 0 on succes, non-zero on failure ' Remarks : Extracting the baudrate(lBaudRate) from iBaudRate ' Dim lBaudrate As Long ' If iBaudRate >= 0 Then ' ' ' ' lBaudrate = iBaudRate Else lBaudrate = iBaudRate + 65536 End If Public Declare Sub GetRS232Config Lib "Flowb32.dll" (ByVal sPortName As String, _ ByRef iBaudRate As Integer) '--------------END OF FUNCTIONS TO GET / SET THE BAUDRATE OF YOUR COMPORT------------------------- '--------------FUNCTIONS TO GET / SET PC(ISA)-CARD CONFIGURATION AND NETWORK SETTINGS-------------- 61 '************************************************************************ **** ' ' ConfigureTNet ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function card or : Function which configures the PC(ISA)/FLOW-BUS interface ' the FLOW-BUS network settings of your "RS232/flowbus interface"-box which is ' directly connected to your pc.. ' In case the application wants to use an ISA card it configures the specified card ' with: device name, node number, secondary node, next node and arbitration mode. ' ' Only device name and arbitrage are used internally. Parameters: ' (In) bytNode: interface"-box. Primary node adress of the "RS232/flowbus ' bytSecNode: interface"-box. Second node adress of the "RS232/flowbus ' bytNextNode: interface"-box. Next node adress of the "RS232/flowbus ' bytLastNode: interface"-box. Last node adress of the "RS232/flowbus ' bytArbiterMode: Arbiter mode of the "RS232/flowbus interface"-box. ' bytTxRetries: before an error occurs Number of attempts to write a parameter, ' bytRxRetries: before an error occurs Number of attempts to read a parameter, ' with flowbus COM-port on which to start communication ' sPort: (Out) ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function ConfigureTNet Lib "Flowb32.dll" (ByVal bytNode As Byte, _ ByVal bytSecNode As Byte, ByVal bytNextNode As Byte, ByVal bytLastNode As Byte, _ ByVal bytArbiterMode As Byte, ByVal bytTxRetries As Byte, ByVal bytRxRetries As Byte, _ 62 ByVal sPort As String) As Integer '************************************************************************ **** ' ' GetTNetConfig ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function to get the current configuration of the PC(ISA)/FLOW-BUS interface card or ' the FLOW-BUS network settings of your "RS232/flowbus interface"-box which is ' directly connected to your pc.. ' Parameters: ' (In) ' (Out) bytNode: interface"-box. Primary node adress of the "RS232/flowbus ' bytSecNode: interface"-box. Second node adress of the "RS232/flowbus ' bytNextNode: interface"-box. Next node adress of the "RS232/flowbus ' bytLastNode: interface"-box. Last node adress of the "RS232/flowbus ' bytArbiterMode: Arbiter mode of the "RS232/flowbus interface"-box. ' bytTxRetries: before an error occurs Number of attempts to write a parameter, ' bytRxRetries: before an error occurs Number of attempts to read a parameter, ' sPort: flowbus is currenly COM-port on which the communication with ' handled. ' Returned : ' Remarks : ' Public Declare Sub GetTNetConfig Lib "Flowb32.dll" (ByRef bytNode As Byte, _ ByRef bytSecNode As Byte, ByRef bytNextNode As Byte, ByRef bytLastNode As Byte, _ ByRef bytArbiterMode As Byte, ByRef bytTxRetries As Byte, ByRef bytRxRetries As Byte, _ ByVal sPort As String) 63 '--------------END OF FUNCTIONS TO GET / SET PC(ISA)-CARD CONFIGURATION AND NETWORK SETTINGS------- '--------------FUNCTIONS TO CONFIGURE CHAINING---------------------------------------------------'************************************************************************ **** ' ' ConfigureChaining ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function with which you can configure the settings for process and parameter ' chaining. Process chaining is not supported on older FlowBus modules. ' Therefore the advise is to disable process-chaining, unless you know ' that all flowbus modules in the network support process chaining (in which case ' enabling process chaining is better). ' Parameter chaining should be enabled to decrease the number of messages send over ' ' the network (decrease network traffic) Parameters: ' (In) bProcChain: Boolean which indicates if process chaining should be enabled ' bParChain: should be enabled ' Boolean which indicates if parameter chaining (Out) ' Returned : ' Remarks : ' Public Declare Sub ConfigureChaining Lib "Flowb32.dll" (ByVal bProcChain As Boolean, _ ByVal bParChain As Boolean) '--------------END FUNCTIONS TO CONFIGURE CHAINING------------------------------------------------ '--------------FUNCTIONS TO CHECK THE NETWORK FOR ERRORS-----------------------------------------'************************************************************************ **** ' 64 ' GetError ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which checks if a network error occurred and clears the possible error. ' This function can be called any time. Especially when a function returns no error, ' you can call this method after executing the function. ' Parameters: ' (In) ' (Out) ' Returned : 0 No error occured ' memory -1 Device identifier invalid, unsupported or lack of ' -2 Device is already open. ' -3 Device is NOT open. ' the queues. -4 The function cannot allocate enough memory for ' -5 Default parameters are in error. ' device). -10 The hardware is not available (locked by another ' -11 Specified byte size is invalid. ' -12 Baudrate of the device is unsupported. ' 22 Com port not opened (for PC-ISA card) ' 28 Too many messages sent to host (for PC-ISA card) ' 31 Network not opened (for PC-ISA card) ' 33 Error sending data ' 34 Error in received data ' Remarks : ' Public Declare Function GetError Lib "Flowb32.dll" () As Integer '--------------END OF FUNCTIONS TO CHECK THE NETWORK FOR ERRORS----------------------------------- '--------------FUNCTIONS TO SEND A READ-REQUEST FOR A CERTAIN PARAMETER--------------------------'************************************************************************ **** ' ' ReadChar ' 65 ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function sends a request / message to a certain node, that it wants to know the ' (1 character). value of a certain parameter. The parameter type is Byte ' messsage. The value of the parameter is send by the node in another ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your request-message. If so, you can call GetChar() to get the value of the ' ' parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' iMsgId: ' to the following: MessageId of the message. You may choose any value for it with restriction ' - No 2 messages can have the same MessageId. Only if a message is removed ' the MessageId can be used again. ' check if you received Keep the MessageId, you will need it later to ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function ReadChar Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _ As Integer 66 '************************************************************************ **** ' ' ReadInt ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function sends a request / message to a certain node, that it wants to know the ' Integer. value of a certain parameter. The parameter type is ' messsage. The value of the parameter is send by the node in another ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your request-message. If so, you can call GetInt() to get the value of the ' ' parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' iMsgId: ' to the following: MessageId of the message. You may choose any value for it with restriction ' - No 2 messages can have the same MessageId. Only if a message is removed ' the MessageId can be used again. ' check if you received Keep the MessageId, you will need it later to ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function ReadInt Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _ 67 ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _ As Integer '************************************************************************ **** ' ' ReadFloat ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function sends a request / message to a certain node, that it wants to know the ' Float. value of a certain parameter. The parameter type is ' messsage. The value of the parameter is send by the node in another ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your request-message. If so, you can call GetFloat() to get the value of the ' ' parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' iMsgId: ' to the following: MessageId of the message. You may choose any value for it with restriction ' - No 2 messages can have the same MessageId. Only if a message is removed ' the MessageId can be used again. ' check if you received Keep the MessageId, you will need it later to ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to 68 ' this (Node, Process, Parameter) combination ' Public Declare Function ReadFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _ As Integer '************************************************************************ **** ' ' ReadLong ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function sends a request / message to a certain node, that it wants to know the ' value of a certain parameter. The parameter type is Long. ' messsage. The value of the parameter is send by the node in another ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your request-message. If so, you can call GetLong() to get the value of the ' ' parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' iMsgId: ' to the following: MessageId of the message. You may choose any value for it with restriction ' - No 2 messages can have the same MessageId. Only if a message is removed ' the MessageId can be used again. ' check if you received Keep the MessageId, you will need it later to ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure 69 ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function ReadLong Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal lHwnd As Long, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByVal iMsgId As Integer) _ As Integer '************************************************************************ **** ' ' ReadString ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function sends a request / message to a certain node, that it wants to know the ' value of a certain parameter. The parameter type is String (1 or more characters). ' messsage. The value of the parameter is send by the node in another ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your request-message. If so, you can call GetString() to get the value of the ' ' parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' bytExpLen: Expected length of the string. ' expected. ' If you supply 0, a zero-terminated string is iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: 70 ' - No 2 messages can have the same MessageId. Only if a message is removed ' the MessageId can be used again. ' check if you received Keep the MessageId, you will need it later to ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function ReadString Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _ ByVal bytExpLen As Byte, ByVal iMsgId As Integer) As Integer '--------------END OF FUNCTIONS TO SEND A READ-REQUEST FOR A CERTAIN PARAMETER--------------------- '--------------FUNCTIONS TO WRITE A PARAMETER----------------------------------------------------'************************************************************************ **** ' ' WriteChar ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which gives a certain parameter a new value (writes a parameter value). ' The parameter type is Byte (1 character). ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your message. The answer-message contains a statuscode which indicates if the ' value was succesfully written, or an error occured. Call GetStatus() to, ' ' determine if the parameter was succesfully written. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling 71 ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' bytNewValue: New value for the parameter ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is ' - No 2 messages can have the same MessageId. removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function WriteChar Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _ ByVal bytNewValue As Byte, ByVal iMsgId As Integer) As Integer '************************************************************************ **** ' ' WriteInt ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which gives a certain parameter a new value (writes a parameter value). ' The parameter type is Integer. ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your message. The answer-message contains a statuscode which indicates if the 72 ' value was succesfully written, or an error occured. Call GetStatus() to, ' ' determine if the parameter was succesfully written. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' iNewValue: New value for the parameter ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is ' - No 2 messages can have the same MessageId. removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function WriteInt Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _ ByVal iNewValue As Integer, ByVal iMsgId As Integer) As Integer '************************************************************************ **** ' ' WriteFloat ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which gives a certain parameter a new value (writes a parameter value). 73 ' The parameter type is Float. ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your message. The answer-message contains a statuscode which indicates if the ' value was succesfully written, or an error occured. Call GetStatus() to, ' ' determine if the parameter was succesfully written. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' fNewValue: New value for the parameter ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is ' - No 2 messages can have the same MessageId. removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function WriteFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _ ByVal fNewValue As Single, ByVal iMsgId As Integer) As Integer '************************************************************************ **** ' ' WriteLong ' 74 ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which gives a certain parameter a new value (writes a parameter value). ' The parameter type is Long. ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your message. The answer-message contains a statuscode which indicates if the ' value was succesfully written, or an error occured. Call GetStatus() to, ' ' determine if the parameter was succesfully written. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' lNewValue: New value for the parameter ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is ' - No 2 messages can have the same MessageId. removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to ' this (Node, Process, Parameter) combination ' Public Declare Function WriteLong Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _ ByVal lNewValue As Long, ByVal iMsgId As Integer) As Integer 75 '************************************************************************ **** ' ' WriteString ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which gives a certain parameter a new value (writes a parameter value). ' The parameter type is String. ' You have to call CheckReceivedMsg() to check if you have received an answer on ' your message. The answer-message contains a statuscode which indicates if the ' value was succesfully written, or an error occured. Call GetStatus() to, ' ' determine if the parameter was succesfully written. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' bytExpLen: Expected length of the string. ' expected. If you supply 0, a zero-terminated string is ' sNewValue: New value for the parameter ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is ' - No 2 messages can have the same MessageId. removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' an answer-message on your request ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : There can be no 2 messages at the same time with the same (Node, Proces, Parameter) ' combination. Only if the message has been removed, another message can be send to 76 ' this (Node, Process, Parameter) combination ' Public Declare Function WriteString Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, _ ByVal bytExpLen As Byte, ByVal sNewValue As String, ByVal iMsgId As Integer) As Integer '--------------END OF FUNCTIONS TO WRITE A PARAMETER---------------------------------------------- '--------------FUNCTIONS TO READ A PARAMETER VALUE------------------------------------------------'************************************************************************ **** ' ' GetChar ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Byte (1 character). ' Before you can read a parameter value you have to: ' - Call ReadChar() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter bytValue: Value of the parameter iMsgId: MessageId of the message. ' (Out) ' ' Returned : 0 on succes, non-zero on failure ' Remarks : 77 ' Public Declare Function GetChar Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _ ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef bytValue As Byte, _ ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetInt ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Integer. ' Before you can read a parameter value you have to: ' - Call ReadInt() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter iValue: Value of the parameter iMsgId: MessageId of the message. ' (Out) ' ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetInt Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _ ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef iValue As Integer, _ ByRef iMsgId As Integer) As Integer 78 '************************************************************************ **** ' ' GetFloat ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Float. ' Before you can read a parameter value you have to: ' - Call ReadFloat() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter fValue: Value of the parameter iMsgId: MessageId of the message. ' (Out) ' ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _ ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef fValue As Single, _ ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetLong ' ' Author : Bronkhorst High-Tech B.V. 79 ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Long. ' Before you can read a parameter value you have to: ' - Call ReadLong() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter lValue: Value of the parameter iMsgId: MessageId of the message. ' (Out) ' ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetLong Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _ ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef lValue As Long, _ ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetString ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is String (1 or more characters). ' Before you can read a parameter value you have to: 80 ' - Call ReadString() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter iMsgId: MessageId of the message. ' sValue: Value of the parameter ' bytActLen: Actual length of the value ' (Out) ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetString Lib "Flowb32.dll" (ByVal iAppId As Integer, ByVal bytNode As Byte, _ ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef iMsgId As Integer, _ ByVal sValue As String, ByRef bytActLen As Byte) As Integer '--------------END OF FUNCTIONS TO READ A PARAMETER VALUE------------------------------------------ '--------------FUNCTIONS TO READ A PARAMETER VALUE (REALTIME)-------------------------------------'************************************************************************ **** ' ' GetRealTimeChar ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Byte (1 character). ' Before you can read a parameter value you have to: ' - Call ReadChar() to send a read-request. 81 ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter bytValue: Value of the parameter ' (Out) ' lRealTime: the value was read Timestamp which indicates at which moment ' in the instrument. Time is in milliseconds.. ' iMsgId: MessageId of the message. ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetRealTimeChar Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef bytValue As Byte, _ ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetRealTimeInt ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Integer. ' Before you can read a parameter value you have to: ' - Call ReadInt() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received 82 ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter iValue: Value of the parameter ' (Out) ' lRealTime: the value was read Timestamp which indicates at which moment ' in the instrument. Time is in milliseconds.. ' iMsgId: MessageId of the message. ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetRealTimeInt Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef iValue As Integer, _ ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetRealTimeFloat ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Float. ' Before you can read a parameter value you have to: ' - Call ReadFloat() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' ' your read-request message. - Call GetError() to check if no errors occured 83 ' GetStatus() - Check the status of the received message by calling ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter fValue: Value of the parameter ' (Out) ' lRealTime: the value was read Timestamp which indicates at which moment ' in the instrument. Time is in milliseconds.. ' iMsgId: MessageId of the message. ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetRealTimeFloat Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef fValue As Single, _ ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetRealTimeLong ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which reads the value of a certain parameter. ' ' ' The parameter type is Long. ' Before you can read a parameter value you have to: ' - Call ReadLong() to send a read-request. ' an answer on - Call CheckReceivedMsg() to check if you have received ' your read-request message. ' - Call GetError() to check if no errors occured ' GetStatus() - Check the status of the received message by calling 84 ' After you have done all this and everything was OK, you can read the value ' ' of the parameter. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter lValue: Value of the parameter ' (Out) ' lRealTime: the value was read Timestamp which indicates at which moment ' in the instrument. Time is in milliseconds.. ' iMsgId: MessageId of the message. ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetRealTimeLong Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef lValue As Long, _ ByRef lRealTime As Long, ByRef iMsgId As Integer) As Integer '--------------END OF FUNCTIONS TO READ A PARAMETER VALUE (REALTIME)------------------------------ '--------------FUNCTIONS TO CLAIM / UNCLAIM PROCESSES--------------------------------------------'************************************************************************ **** ' ' ClaimCommand ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' Function : Function which claims a certain process of a node. ' Parameters: ' ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process to claim ' iMsgId: MessageId of the message. 85 ' You may choose any value for it with restriction to the following: ' Only if a message is ' - No 2 messages can have the same MessageId. removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' (to determine if an an answer-message with the status code in it ' error occured) ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : ClaimCommand() and UnClaimCommand() should not be called until an answer-message ' because of the is received and removed (by calling RemoveMsg()). This is ' unique. (Node, Process, Parameter) combination which must be ' Public Declare Function ClaimCommand Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal iMsgId As Integer) _ As Integer '************************************************************************ **** ' ' UnClaimCommand ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' Function : Function which unclaims a certain process of a node. ' Parameters: ' ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process to unclaim ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is - No 2 messages can have the same MessageId. 86 ' removed the MessageId can be used again. ' to check if you received Keep the MessageId, you will need it later ' (to determine if an an answer-message with the status code in it ' error occured) ' ' (Out) Returned : 0 on succes, non-zero on failure ' Remarks : ClaimCommand() and UnClaimCommand() should not be called until an answer-message ' because of the is received and removed (by calling RemoveMsg()). This is ' unique. (Node, Process, Parameter) combination which must be ' Public Declare Function UnClaimCommand Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal cProc As Byte, ByVal iMsgId As Integer) _ As Integer '************************************************************************ **** ' ' GetClaimStatus ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which if a certain process of a certain node is claimed or not. ' Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process to check bytStatus: Claim status of the node (0 = not claimed) iMsgId: MessageId of the message. ' (Out) ' ' Returned : 0 on succes, non-zero on failure ' Remarks : ClaimCommand() and UnClaimCommand() should not be called until an answer-message ' because of the is received and removed (by calling RemoveMsg()). This is 87 ' unique. (Node, Process, Parameter) combination which must be ' Public Declare Function GetClaimStatus Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByRef bytStatus As Byte, ByRef iMsgId As Integer) _ As Integer '--------------END OF FUNCTIONS TO CLAIM / UNCLAIM PROCESSES-------------------------------------- '--------------FUNCTIONS TO INSTRUCT A CERTAIN PROCESS TO BROADCAST IT'S PARAMETERS---------------'************************************************************************ **** ' ' StartBroadcast ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which instructs a certain process of a certain node to broadcast it's ' parameters on the flowbus. Depending on amount of channels connected to FLOWBUS ' bytRepTime (Time between 2 broadcast messages) may have to be decreased in order to ' ' keep amount of broadcastmessages limited. Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' messages bytRepTime: Interval (in 10 msec) between 2 broadcast ' iMsgId: MessageId of the message. ' You may choose any value for it with restriction to the following: ' Only if a message is ' ' to check if you received - No 2 messages can have the same MessageId. removed the MessageId can be used again. Keep the MessageId, you will need it later 88 ' (to determine if an an answer-message with the status code in it ' error occured) ' (Out) ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function StartBroadcast Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal lHwnd As Long, ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytRepTime As Byte, _ ByVal iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetStartBroadcastStatus ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which checks the answer on the broadcast-request message (send when ' ' StartBroadcast() was called). Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' (Out) bytStatus: error, everything OK) Status of the broadcast-request (0 = no ' MessageId of the message. iMsgId: ' Returned : 0 on succes, non-zero on failure ' Remarks : ' Public Declare Function GetStartBroadcastStatus Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByRef bytStatus As Byte, ByRef iMsgId As Integer) _ As Integer '--------------END OF FUNCTIONS TO INSTRUCT A CERTAIN PROCESS TO BROADCAST IT'S PARAMETERS--------- 89 '************************************************************************ **** ' ' GetStatus ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function message. ' : Function which determines the status of a received Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' lHwnd: Supply always 0 for this parameter ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' (Out) bytStatus: Status of the received message (0 = no error, see "ERROR LIST SECTION" ' codes..) at the top of this class for other possible ' iMsgId: MessageId of the message. ' Returned : 0, on succes. See "ERROR LIST SECTION" at the top of this class for other possible codes ' Remarks : ' Public Declare Function GetStatus Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte, ByRef bytStatus As Byte, _ ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' RemoveMsg ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 Function : Function which removes a message from the message buffer. ' ' ' The message is identified by the unique combination of (Node, Process, Parameter) 90 ' After calling this function the messageId you assigned to the message with ' again. ' combination (Node, Process, Parameter) is available Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter ' (Out) ' Returned : ' Remarks : ' Public Declare Sub RemoveMsg Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByVal bytNode As Byte, ByVal bytProc As Byte, ByVal bytParm As Byte) '************************************************************************ **** ' ' CheckReceivedMsg ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function so it fills : Function which checks if a message has been received. If ' the parameters you supplied with the parameters of the received message. ' this function This function does not remove a message, so if you call ' multiple times without calling RemoveMsg() between 2 calls, you will always ' ' get the same message!!! Parameters: ' (In) OpenDLL()) iAppId: ApplicationId (which you received by calling ' bytNode: Node ' bytProc: Process ' bytParm: Parameter (Out) ' bytMsgType: read-request (1) or on a Byte which indicates if the answer is on a ' write-request (0). 91 ' bytParmType: Parameter type (0 = Byte\Char, 1=Int, 2=Float, 3=Long, 4=String) ' iMsgId: MessageId of the message ' Returned : 0 if no error occured, otherwise an error value ' Remarks : ' Public Declare Function CheckReceivedMsg Lib "Flowb32.dll" (ByVal iAppId As Integer, _ ByRef bytNode As Byte, ByRef bytProc As Byte, ByRef bytParm As Byte, ByRef bytMsgType As Byte, _ ByRef bytParmType As Byte, ByRef iMsgId As Integer) As Integer '************************************************************************ **** ' ' GetInterfaceType ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which indicates which port is currently used for communication with ' flowbus. ' Parameters: ' (In) ' (Out) sPort: Name of the port which is currently used for flowbus-communication. ' Returned : ' Remarks : ' Public Declare Sub GetInterfaceType Lib "Flowb32.dll" (ByVal sPort As String) '************************************************************************ **** ' ' GetCommunication ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which checks if the communication with flowbus is open or closed. 92 ' Parameters: ' (In) ' (Out) ' Returned : 1 if communication is open, 0 if communication is closed ' Remarks : ' Public Declare Function GetCommunication Lib "Flowb32.dll" () As Integer '************************************************************************ **** ' ' CheckPCISA ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which checks if the PC(ISA)/FLOW-BUS interface is present in then PC. ' WARNING: There have been some troubles using this function (the function returned ' a 1, while we didn't have a PCISA card installed), so do our advise is ' not to use this function. ' Parameters: ' (In) ' (Out) ' Returned present : 1 if a PCISA-card is present, 0 if no PCISA-card is ' : Remarks ' Public Declare Function CheckPCISA Lib "Flowb32.dll" () As Integer '************************************************************************ **** ' ' GetNrPorts ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which returns the number of available ports for communication. ' Parameters: 93 ' (In) ' (Out) ' Returned : Number of available ports for communication ' Remarks : ' Public Declare Function GetNrPorts Lib "Flowb32.dll" () As Byte '************************************************************************ **** ' ' GetPort ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which gets information about a certain communication port ' Parameters: ' (In) of available bytPortIndex: Index of the communication port in the array ' port has index 0. ' information. communication ports. The first available iMemSize: Amount of memory reserved to store all ' Formula to calculate this value: 2 + ExpectedLengthPortName * 2 ' in use (Out) ' bInUse: Boolean which indicates if the port is currently sPort: Name of the port ' Returned : Number of available ports for communication ' Remarks : 0, if iMemSize is sufficient to return data ' > 0, (iMemSize to small), the returnvalue indicates how much memory is needed ' -1, index out of range ' Public Declare Function GetPort Lib "Flowb32.dll" (ByVal bytPortIndex As Byte, ByVal iMemSize As Integer, _ ByRef bInUse As Boolean, ByVal sPort As String) As Integer '************************************************************************ **** ' ' GetAvailableInterfaces ' 94 ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which returns info about the physical ports ' ' ' (interfaces) in the pc. These ports can be COM-ports ' and PC-ISA cards. ' ' You should make 2 calls to this function: ' - The first time you supply iMemSize = 0 ' Furthermore declare variable udt_PortInfo_Ports as ' follows: ' Dim udt_PortInfo_Ports() As PortInfoType ' - The second time you supply iMemSize = ' return value first call ' Furthermore recalcultate the size of variable ' udt_PortInfo_Ports as follows: ' ReDim udt_PortInfo_Ports(bytNrOfElem from first call) ' Parameters: ' (In) iMemSize: Amount of memory allocated by your application ' to store info ' bytNrOfElem: Number of ports in the PC ' udt_PortInfo_Ports: Array in which the information of ' ' all ports can be stored. (Out) ' Returned : 0 if no error occured, otherwise an error value ' Remarks : ' Public Declare Function GetAvailableInterfaces Lib "Flowb32.dll" ( _ ByVal iMemSize As Integer, ByRef bytNrOfElem As Byte, _ ByRef udt_PortInfo_Ports() As PortInfoType) As Integer '************************************************************************ **** ' ' ReadSystemConfig ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which reads the flowbus configuration and builds ' ' ' the channels database. 95 ' Parameters: ' (In) ' (Out) ' Returned iNode: Last node to scan (0 means stop scan in progress) : 0, no error ' 1, communication not open ' 2, scan already in progress ' 3, busy with open/close or change communication action ' Remarks : ' Public Declare Function ReadSystemConfig Lib "Flowb32.dll" ( _ ByVal iNode As Integer) As Integer '************************************************************************ **** ' ' FindFirstFreeNode ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 ' ' Function node : Function which scans the flowbus network for the first ' address which is NOT in use (free). ' Parameters: ' (In) iStartNode: Node address of the node at which the search ' ' should start (0 means cancel previous search) (Out) ' Returned with : 0, if an error occured (communication was closed, busy ' other action, already searching node), ' ' otherwise the node address of the first free node Remarks : ' Public Declare Function FindFirstFreeNode Lib "Flowb32.dll" ( _ ByVal iStartNode As Integer) As Integer '************************************************************************ **** ' ' GetProgress ' ' Author : Bronkhorst High-Tech B.V. 96 ' Date : 15-Jan-2004 Function : Function which determines the progress after a call to ' ' ' ReadSystemConfig() or FindFirstFreeNode(). ' These function take a long time to complete. ' Parameters: ' (In) ' (Out) ' Returned : The progress of action as a percentage (0 - 100%) ' Remarks : ' Public Declare Function GetProgress Lib "Flowb32.dll" () As Byte '************************************************************************ **** ' ' GetDLLVersion ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 ' Function : Function which gets the version number of FLOWB32.DLL ' Parameters: ' (In) ' (Out) ' sDllVersion: Version of Flowb32.dll ' Returned : ' Remarks : ATTENTION ' Flowb32.dll is made in C++. ' Basic The datatypes for character strings in C++ and Visual ' are not the same. If you don't know how to get character ' strings, see function modFlowbusAvanzado.GetAnswer(). ' Search for the "case 4" statement. Here you will find ' an example of how to retrieve character strings. ' Public Declare Sub GetDLLVersion Lib "Flowb32.dll" ( _ ByVal sDllVersion As String) '************************************************************************ **** ' 97 ' GetChannel ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which returns the (virtual) channel number for a ' ' ' certain (node, process)-combination. ' Parameters: ' (In) iNode: Node number ' ' iProc: Process number (Out) ' Returned : The channel number of the (node, process)-combination ' Remarks : ' Public Declare Function GetChannel Lib "Flowb32.dll" ( _ ByVal iNode As Integer, ByVal iProc As Integer) As Integer '************************************************************************ **** ' ' GetModuleType ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which returns the type of a node / module. ' ' ' is. It tells you what kind of instrument the node / module ' ' Parameters: ' (In) ' (Out) ' Returned iNode: Node number : The type of the module ' returned The list below provides some information about the ' are numbers. This is an old list, so the newer instruments ' NOT listed. ' 0 = None - No device found with this node number ' 1 = RS232 - RS232 interface to FLOW-BUS ' 2 = PC/ISA - PC(ISA) interface to FLOW-BUS 98 ' 3 = ADDA4 - 4 Channel 0..5Vdc/0..10Vdc/0..20mA/4..20mA ' interface to FLOW-BUS ' 4 = R/C ' - Readout and control module for up to 32 channels ' and 5 = T/A ' - Totalizer and alarm module with 8 alarms 8 counters ' 6 = ADDA1 - 1 Channel 0..5Vdc/0..10Vdc/0..20mA/4..20mA ' interface to FLOW-BUS ' 7 = DMFC - Digital Mass Flow Controller ' 8 = DMFM - Digital Mass Flow Meter ' 9 = DEPC - Digital Electronic Pressure Controller ' 10 = DEPM - Digital Electronic Pressure Meter ' 11 = ACT - single actuator ' 12 = DLFC - Digital Liquid Flow Controller ' 13 = DLFM - Digital Liquid FLow Meter ' 14 = DSCM-A - Digital Single Channel Module for analog ' instruments ' 15 = DSCM-D ' - Digital Single Channel Module for digital instruments ' instrument) 16 = FRM - FLOW-BUS Rotor Meter (calibration ' instrument) 17 = FTM - FLOW-BUS Turbine Meter (calibration ' instrument) 18 = FPP - FLOW-BUS Piston Prover (calibration ' 19 = F/A - Flow/Alarm module (special T/A-module) ' 20 = DSCM-F - Single channel fuzzy controller module ' calibrators 21 = DSCM-C - Single channel operation module for ' instruments 22 = DDCM-D - Dual channel module for analog ' Remarks : ' Public Declare Function GetModuleType Lib "Flowb32.dll" ( _ ByVal iNode As Integer) As Integer '************************************************************************ **** ' ' GetModuleDevType 99 ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which gets the device type associated with a ' ' ' something certain node / module. The device type tells you ' about the functionality / capabillities of the module. ' You could see it as the group of instruments to which ' the node / module belongs. ' ' Parameters: ' (In) ' (Out) ' Returned iNode: Node number : The device type of the module. ' Possible types: ' 0 = Unknown ' 1 = TYPE_INTERFACE ' 2 = TYPE_MODULE / TYPE_ADDA ' 3 = TYPE_OPERATOR ' 4 = TYPE_SUPERVISE ' 5 = TYPE_CONTROLLER ' 6 = TYPE_METER ' 7 = TYPE_SPECIAL ' 8 = TYPE_CONVERTER ' Remarks : ' Public Declare Function GetModuleDevType Lib "Flowb32.dll" ( _ ByVal iNode As Integer) As Integer '************************************************************************ **** ' ' GetModuleNumber ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which gets the identification string of a ' ' ' module / node connected to the FLOW-BUS. ' This identification tells some information about 100 ' version and module type ' ' Parameters: ' (In) iNode: Node number ' (Out) sIdent: Identification string of the module ' Returned : ' Remarks : ATTENTION ' Flowb32.dll is made in C++. ' Basic The datatypes for character strings in C++ and Visual ' are not the same. If you don't know how to get character ' strings, see function modFlowbusAvanzado.GetAnswer(). ' Search for the "case 4" statement. Here you will find ' an example of how to retrieve character strings. ' Public Declare Sub GetModuleNumber Lib "Flowb32.dll" ( _ ByVal iNode As Integer, ByVal sIdent As String) '************************************************************************ **** ' ' GetMaxChannel ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which gets the node and process number of a ' ' ' (virtual) channel. ' Parameters: ' (In) iChannel: Channel number. You must supply an existing ' ' channel number. (Out) iNode: Node number ' ' iProc: Process number Returned : True if node and process number could be found, ' ' otherwise false Remarks : ' ' Public Declare Function GetNodeProc Lib "Flowb32.dll" ( _ ByVal iChannel As Integer, ByRef iNode As Integer, _ ByRef iProc As Integer) As Boolean 101 '************************************************************************ **** ' ' GetMaxChannel ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 ' ' Function number : Function which returns the maximum (virtual) channel ' in the flowbus network. ' Parameters: ' (In) ' (Out) ' Returned network : The maximum (virtual) channel number in the flowbus ' : Remarks ' Public Declare Function GetMaxChannel Lib "Flowb32.dll" () As Integer '************************************************************************ **** ' ' GetMaxNode ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which returns the highest address of all nodes ' ' ' connected to the FLOW-BUS ' Parameters: ' (In) ' (Out) ' Returned BUS : The highest address of all nodes connected to the FLOW- ' : Remarks ' Public Declare Function GetMaxNode Lib "Flowb32.dll" () As Integer '************************************************************************ **** 102 ' ' SetSystemLNA ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which alters the last node address of FLOW-BUS ' ' ' speed system. The LNA is a parameter used for communciation ' efficiency. Flowbus is a token ring network. ' After a node has finished his tasks, it passes the token ' token to the next node on the network. To determine when the ' should be passed to the first node again, LNA is used. ' it is! If you are not familiar with parameter LNA, leave it as ' A wrong value for this parameter could result in your ' network not finding certain nodes anymore. ' Parameters: ' (In) ' (Out) iLNA: New value for parameter LNA (Last Node Address) ' Returned : ' Remarks : ' Public Declare Sub SetSystemLNA Lib "Flowb32.dll" (ByVal iLNA As Integer) '************************************************************************ **** ' ' GetSystemLNA ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 Function : Function which returns the last node address of FLOW-BUS ' ' ' speed system. The LNA is a parameter used for communciation ' efficiency. Flowbus is a token ring network. ' After a node has finished his tasks, it passes the token ' token to the next node on the network. To determine when the ' should be passed to the first node again, LNA is used. 103 ' Parameters: ' (In) ' (Out) ' Returned : The value of parameter LNA (Last Node Address) ' Remarks : ' Public Declare Function GetSystemLNA Lib "Flowb32.dll" () As Integer '************************************************************************ **** ' ' GetNrPendingMessages ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Jan-2004 ' ' Function messages. : Function which returns the amount of outstanding ' Each read or write action consists of 2 parts: ' parameter. - Sending a request for a parameter / Writing a ' ' a This message is called a request-message. - Waiting for an answer (waiting for a message containing ' has statuscode, which tells you wheter or not the operation ' also succeeded). In case of a read request, this message ' contains the value of your parameter. ' This message is called an answer-message. ' ' follows: The term "outstanding messages" can now be defined as ' The number of request-messages of which the corresponding ' answer-message is not yet removed from the dll's message ' buffer. ' ' sent This means that request-messages which are not already ' are included (no answer-message are received on these ' messages, so the answer-message on these request-messages ' buffer) could not have been removed from the dll's message 104 ' ' This also includes request-messages on which an ' from answer-message was received which was not yet removed ' the dll's message buffer. ' Parameters: ' (In) iAppId: ApplicationId (which you received by calling ' ' OpenDLL()) (Out) ' Returned : The number of outstanding messages ' Remarks : ' Public Declare Function GetNrPendingMessages Lib "Flowb32.dll" ( _ ByVal iAppId As Integer) As Integer 3.2.3. Desarrollo de las funciones de la API (modFlowbusAvanzado.bas) Option Explicit '--------------USER DEFINED TYPES----------------------------------------------------------------'Structure / Type which holds message-information 'Prefix: "udtMessageType_" Private Type MessageType iMsgId As Integer 'MessageId of the message sValue As String 'Parameter value (answer on a read-request) iErrVal As Integer occured 'Error value which indicates what error bytStatus As Byte 'Statuscode of the received / answer message lNodeProcParm As Long number is stored 'Number in which Node, Process and parameter sErr As String occured 'Error string which indicates what error bAnswered As Boolean 'Boolean which indicates if an answer has been received on this message End Type '--------------END OF USER DEFINED TYPES---------------------------------------------------------- '--------------MODULE VARIABLES------------------------------------------------------------------Private Type ModuleVariables udtMessageType_Messages() As MessageType lMessages As Long the local message buffer 'Local message buffer 'Number of messages in 105 End Type Private m As ModuleVariables '--------------END OF MODULE VARIABLES------------------------------------------------------------ '--------------FUNCTIONS TO OPEN THE COMMUNICATION-----------------------------------------------'************************************************************************ **** ' ' StartCommunication ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function port. : This starts the communication with flowbus on a certain ' Furthermore it configures the chaining of process. ' ATTENTION: If you always call ReadParameterDirect() or WriteParameterDirect(), ' parameter chaining, you don't take any advantage of process and ' because you are sending one message at a time ' another message) (and wait for the anwer, before sending ' Parameters: ' (In) sPort: should be openend. Name of the port on which the communication ' bProcChain: Boolean which indicates if processes should be chained or not. ' CAUTION > Older flowbus modules might not support this functionality, ' option to False unless we therefore advise you to set this ' your network support this you are sure that all modules in ' functionality. ' bParmChain: Boolean which indicates if processes should be chained or not. ' be configured. lBaudRate: ' and 38400 ' (Out) occured. The desired baudrate at which the port should Supported baudrates are: 4800, 9600, 19200 iErrVal: An error-value indicating which error 106 ' Returned : "" if no error occured, otherwise an error-string ' Remarks : ' Public Function StartCommunication(ByVal sPort As String, ByVal bProcChain As Boolean, _ ByVal bParmChain As Boolean, ByRef iErrVal As Integer, ByVal lBaudRate As Long) As String Dim sRetVal As String 'Error-string Dim bytNode As Byte Dim bytSecNode As Byte Dim bytNextNode As Byte Dim bytLastNode As Byte Dim bytArbiterMode As Byte Dim bytTxRetries As Byte Dim bytRxRetries As Byte Dim sOldPort As String Dim iBaudRate As Integer Dim iAttempt As Integer Const MAXATTEMPTS As Long = 3 'Create a String containing 256 spaces, because of C++. If your String contains too few 'spaces C++ may generate a memory error. The String you supply must contain at least as 'many characters as the C++ function will write into your variable. sOldPort = Space(256) 'No errors yet sRetVal = "" 'Strip off leading and trailing spaces from the portname sPort = Trim(sPort) 'Get TNet configuration modFlowbusAPI.GetTNetConfig bytNode, bytSecNode, bytNextNode, bytLastNode, bytArbiterMode, _ bytTxRetries, bytRxRetries, sOldPort 'Set TNet configuration (only port is different) iErrVal = modFlowbusAPI.ConfigureTNet(bytNode, bytSecNode, bytNextNode, bytLastNode, _ bytArbiterMode, bytTxRetries, bytRxRetries, sPort) 107 'If no error occured.. If iErrVal = 0 Then 'Calculate baudrate Select Case lBaudRate Case 4800, 9600, 19200 iBaudRate = lBaudRate Case 38400 iBaudRate = lBaudRate - 65536 Case Else 'Baudrate not supported, set error sRetVal = "Baudrate not supported.." End Select 'Configure the port with the new baudrate iErrVal = modFlowbusAPI.ConfigureRS232(sPort, iBaudRate) 'If no error occured.. If iErrVal = 0 Then 'Configure chaining of processes and parameters modFlowbusAPI.ConfigureChaining bProcChain, bParmChain 'Try to open the communication on port sPort. 'Maximum number of attempts is MAXATTEMPTS For iAttempt = 1 To MAXATTEMPTS 'Open the communication on port sPort iErrVal = modFlowbusAPI.OpenCommunication(sPort) 'Communication opened?? If iErrVal = 0 Then 'Communication is opened cfg.Abierto = True 'Communication opened, so exit this loop Exit For End If Next 'Check if the communication is NOT open If Not cfg.Abierto Then 108 sRetVal = "Imposible abrir puerto" End If Else sRetVal = "Baudrate could not be set" End If Else sRetVal = "TNet could not be configured on the supplied port.." End If StartCommunication = sRetVal End Function '************************************************************************ **** ' ' CloseCommunication ' ' Author : Bronkhorst High-Tech B.V. ' Date : 16-Dec-2003 ' ' Function : Function which closes the communication with the flowbus on a specified port. ' If the communication could not be closed, a message box with error information ' ' will appear. Parameters: ' (In) for example) ' sPortName: Name of the port to close ("COM1" or "COM2" (Out) ' Returned : "" if no error occured, otherwise an error string ' Remarks : ' Public Function CloseCommunication() As String Dim iErrVal As Integer Dim sErrVal As String 'No error occured yet sErrVal = "" 'Is communication with flowbus opened If cfg.Abierto Then 'If so, try to close the communication 109 iErrVal = modFlowbusAPI.CloseCommunication 'Error occured while closing the communication? If iErrVal <> 0 Then sErrVal = "Error closing communication, Err number=" & iErrVal Else cfg.Abierto = False End If End If CloseCommunication = sErrVal End Function '--------------END OF FUNCTIONS TO OPEN / CLOSE THE COMMUNICATION----------------------------------------- '--------------FUNCTIONS TO WRITE A PARAMETER VALUE----------------------------------------------'************************************************************************ **** ' ' WriteParameterDirect ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function : This function directly writes a parameter to a certain instrument on the flowbus. ' This function waits for an answer before it returns. ' Parameters: ' (In) iNode: Node (instrument) ' iProc: Process ' iParm: Parameter ' sParmType: Parametertype of the parameter ' "c" is String / Byte ' "f" is Float ' "i" is Integer ' "l" is Long ' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"): ' 0 means Byte (1 character) 110 ' -2 means Zero Terminated String ' of x characters x (all other values) means Fixed String ' lTimeOut: Time (in milliseconds) before a timeout occurs, we can't wait forever.. ' sValue: The parameter value to write.. ' (Out) occured. iErrVal: An error-value indicating which error ' bytStatus: Status code of the received message ' Returned : "" if no error occured, otherwise an error-string ' Remarks : ' Public Function WriteParameterDirect(ByVal iNode As Integer, ByVal iProc As Integer, _ ByVal iParm As Integer, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _ ByVal lTimeOut As Long, ByVal sValue As String, ByRef iErrVal As Integer, _ ByRef bytStatus As Byte) As String Dim sRetVal As String 'Error-string Dim iMsgId As Integer 'MessageId of the message we sent.. 'Send a write-request (write some parameter value). 'The function will return a messageId it has assigned to the message (iMsgId), 'the error-string containing error-information (sRetVal) and 'an error-value which indicates the cause of the error (iErrVal) corresponding to sRetVal sRetVal = SendWriteRequest(iNode, iProc, iParm, sParmType, iParmTypeLength, sValue, iMsgId, _ iErrVal) 'Check to see if no error occured yet.. If Len(sRetVal) = 0 Then 'If no answer was received on the read-request If Not GetInfoDirect(iMsgId, lTimeOut, bytStatus, iErrVal, sRetVal) Then 'Set an error that no answer was received on the writerequest sRetVal = "No answer received on write-request, timeout" End If End If WriteParameterDirect = sRetVal 111 End Function '************************************************************************ **** ' ' SendWriteRequest ' ' Author : Bronkhorst High-Tech B.V. ' Date : 11-Dec-2003 ' ' Function : This function writes a parameter-value to a specific instrument on the flowbus ' Parameters: ' (In) iNode: the busaddress of the node ' iProc: the processnumber ' iParm: the parameternumber ' sParmType: parmetertype of the parameter: ' "c" is String / Byte ' "f" is Float ' "i" is Integer ' "l" is Long ' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"): ' 0 means Byte (1 character) ' -2 means Zero Terminated String ' of x characters x (all other values) means Fixed String ' sValue: the parameter value to write.. ' (Out) that was sent. iMsgId: the messageId which corresponds to the message ' we can determine This messageId is valuable because with this id, ' which message (sent by an instrument on the flowbus) contains our value. ' It goes like this: ' 1. Person x sends person y a message that he would like to know value z. ' i ' value z. ' i Person x identifies the message with messageId 2. Person y sends a message back which contains Person y identifies the message with messageId 112 ' with messageId i, 3. Person x sees that he has received a message ' contains value z. therefore person x knows that this message ' ' iErrVal: an error-value indicating which error occured. Returned ' : If no error occured "" is returned, otherwise an error-message is returned. ' Remarks : You can use iMsgId to get the value at a later time, if you don't want to read ' the value from the flowbus directly. ' Public Function SendWriteRequest(ByVal iNode As Integer, ByVal iProc As Integer, _ ByVal iParm As Byte, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _ ByVal sValue As String, ByRef iMsgId As Integer, ByRef iErrVal As Integer) As String Dim sRetVal As String sRetVal = "" 'No error occured yet.. 'If length of the parameter is less then the expected length of the parameter, 'add trailing spaces (charactercode 32) to the parameter value. If iParmTypeLength > Len(sValue) Then sValue = sValue + String$(iParmTypeLength - Len(sValue), 32) End If If sParmType = "i" Or sParmType = "f" Or sParmType = "l" Or sParmType = "c" Then 'Get a new messageId for the parameter in iMsgId. 'Is there NOT already a message with this node, process and parameter? If Not GetFreeMsgId(iNode, iProc, iParm, iMsgId) Then 'Send a proper read-request to the instrument on the flowbus Select Case sParmType '---------------------------------------------------------------------------------Case "i" 'Parameter of type Integer? iErrVal = modFlowbusAPI.WriteInt(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), CInt(sValue), iMsgId) '---------------------------------------------------------------------------------- 113 Case "f" 'Parameter of type Float? iErrVal = modFlowbusAPI.WriteFloat(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), Val(Format$(sValue, "0.00000E+0")), iMsgId) '---------------------------------------------------------------------------------Case "l" 'Parameter of type Long? iErrVal = modFlowbusAPI.WriteLong(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), CLng(sValue), iMsgId) '---------------------------------------------------------------------------------Case "c" 'Parameter of type String? 'Is the parameter of type Byte (1 character)? If iParmTypeLength = 0 Then iErrVal = modFlowbusAPI.WriteChar(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), CByte(sValue), iMsgId) Else 'Is the parameter of type Zero Terminated String? If iParmTypeLength = -2 Then iParmTypeLength = 0 End If 'Check if the parameter value is not an empty string. 'Sending an empty string will hang-up FLOWDDE !!!!! If sValue = "" Then sValue = " " End If iErrVal = modFlowbusAPI.WriteString(cfg.IdApl, 0, CByte(iNode), _ CByte(iProc), CByte(iParm), CByte(iParmTypeLength), sValue, iMsgId) End If '---------------------------------------------------------------------------------End Select 'If an error occured If iErrVal <> 0 Then 114 'Set an error indicating the cause of the error sRetVal = "An error was returned on the write-request (error calling WriteXXX())" End If Else 'Set an error indicating the combination(node, process, parameter) is already in the 'message buffer iErrVal = 2 sRetVal = "A message already exists for the combination (node, process, parameter)" End If Else 'Set an error indicating the supplied parameter type does not exist iErrVal = 1 sRetVal = "Parameter type not found" End If SendWriteRequest = sRetVal End Function '--------------END OF FUNCTIONS TO WRITE A PARAMETER VALUE---------------------------------------- '--------------FUNCTIONS TO READ A PARAMETER VALUE-----------------------------------------------'************************************************************************ **** ' ' ReadParameterDirect ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function : This function directly reads a parameter from an instrument on the flowbus ' This function waits for an answer before it returns. ' Parameters: ' (In) iNode: Node (instrument) ' iProc: Process ' iParm: Parameter ' sParmType: Parametertype of the parameter ' "c" is String / Byte 115 ' "f" is Float ' "i" is Integer ' "l" is Long ' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"): ' 0 means Byte (1 character) ' -2 means Zero Terminated String ' of x characters x (all other values) means Fixed String ' lTimeOut: Time (in milliseconds) before a timeout occurs, we can't wait forever.. ' (Out) from the node) sAnswer: Parameter-value (the value which was received ' occured. iErrVal: An error-value indicating which error ' bytStatus: Status code of the received message ' Returned : "" if no error occured, otherwise an error-string ' Remarks : ' Public Function ReadParameterDirect(ByVal iNode As Integer, ByVal iProc As Integer, _ ByVal iParm As Integer, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _ ByVal lTimeOut As Long, ByRef sAnswer As String, ByRef iErrVal As Integer, _ ByRef bytStatus As Byte) As String Dim sRetVal As String 'Error-string Dim iMsgId As Integer 'MessageId of the message we sent.. 'Send a read-request (request for some parameter value). 'The function will return a messageId it has assigned to the message (iMsgId), 'the error-string containing error-information (sRetVal) and 'an error-value which indicates the cause of the error (iErrVal) corresponding to sRetVal sRetVal = SendReadRequest(iNode, iProc, iParm, sParmType, iParmTypeLength, iMsgId, iErrVal) 'Check to see if no error occured yet.. If Len(sRetVal) = 0 Then 'If no answer was received on the read-request If Not GetInfoDirect(iMsgId, lTimeOut, bytStatus, iErrVal, sRetVal, sAnswer) Then 'Set an error that the parameter value was not found 116 sRetVal = "Parameter value not found, timeout" End If End If ReadParameterDirect = sRetVal End Function '************************************************************************ **** ' ' SendReadRequest ' ' Author : Bronkhorst High-Tech B.V. ' Date : 11-Dec-2003 Function : This function sends a Read-request to the dll. ' ' ' A Read-request is a message telling the dll that we would like to know the value ' of a specified parameter. ' Parameters: ' (In) iNode: the busaddress of the node ' iProc: the processnumber ' iParm: the parameternumber ' sParmType: parmetertype of the parameter: ' "c" is String / Byte ' "f" is Float ' "i" is Integer ' "l" is Long ' iParmTypeLength: length of parameter-value (only meaningfull if sParmType = "c"): ' 0 means Byte (1 character) ' -2 means Zero Terminated String ' of x characters x (all other values) means Fixed String ' (Out) that was sent. iMsgId: the messageId which corresponds to the message ' we can determine This messageId is valuable because with this id, ' which message (sent by an instrument on the flowbus) contains our value. ' It goes like this: ' 1. Person x sends person y a message that he would like to know value z. 117 ' i Person x identifies the message with messageId ' value z. 2. Person y sends a message back which contains ' i Person y identifies the message with messageId ' with messageId i, 3. Person x sees that he has received a message ' contains value z. therefore person x knows that this message ' ' ' iErrVal: an error-value indicating which error occured. Returned : If no error occured "" is returned, otherwise an error-message is returned. ' Remarks : You can use iMsgId to get the value at a later time, if you don't want to read ' the value from the flowbus directly. ' Private Function SendReadRequest(ByVal iNode As Integer, ByVal iProc As Integer, _ ByVal iParm As Integer, ByVal sParmType As String, ByVal iParmTypeLength As Integer, _ ByRef iMsgId As Integer, ByRef iErrVal As Integer) As String Dim sRetVal As String 'Error string which indicates the cause of the error iErrVal = 0 'No error occured yet.. If sParmType = "i" Or sParmType = "f" Or sParmType = "l" Or sParmType = "c" Then 'Get a new messageId for the parameter in iMsgId. 'Is there NOT already a message with this node, process and parameter? If Not GetFreeMsgId(iNode, iProc, iParm, iMsgId) Then 'Send a proper read-request to the instrument on the flowbus Select Case sParmType '---------------------------------------------------------------------------------Case "i" 'Parameter of type Integer? iErrVal = modFlowbusAPI.ReadInt(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), iMsgId) '---------------------------------------------------------------------------------Case "f" 'Parameter of type Float? 118 iErrVal = modFlowbusAPI.ReadFloat(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), iMsgId) '---------------------------------------------------------------------------------Case "l" 'Parameter of type Long? iErrVal = modFlowbusAPI.ReadLong(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), iMsgId) '---------------------------------------------------------------------------------Case "c" 'Parameter of type String? 'Is the parameter of type Byte? If iParmTypeLength = 0 Then iErrVal = modFlowbusAPI.ReadChar(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), iMsgId) Else 'Is the parameter is of type Zero Terminated String? If iParmTypeLength = -2 Then 'Set length of the parameter to 0, indicating zero terminated string iParmTypeLength = 0 'Else the length of the parameter remains as it was, indicating Fixed String End If iErrVal = modFlowbusAPI.ReadString(cfg.IdApl, 0, CByte(iNode), CByte(iProc), _ CByte(iParm), CByte(iParmTypeLength), iMsgId) End If End Select 'If an error occured If iErrVal <> 0 Then 'Set an error indicating the cause of the error sRetVal = "An error was returned on the read-request (error calling ReadXXX())" End If Else 'Set an error indicating the combination(node, process, parameter) is already in the 'message buffer iErrVal = 2 119 sRetVal = "A message already exists for the combination (node, process, parameter)" End If Else 'Set an error indicating the supplied parameter type does not exist iErrVal = 1 sRetVal = "Parameter type not found" End If SendReadRequest = sRetVal End Function '--------------END OF FUNCTIONS TO READ A PARAMETER VALUE----------------------------------------- '--------------FUNCTIONS TO EXTRACT INFORMATION FROM RECEIVED MESSAGES---------------------------'************************************************************************ **** ' ' GetInfoDirect ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function the received : With this function you get the information contained in ' answer-message of a read-request or a write-request. ' message. This function first checks the local queue for the ' If not found, it asks the DLL if it has other messages. This function only stops ' if a timeout occured, or if it has found the answer ' After extracting the information from the received message, the message will ' ' be removed from the local queue. Parameters: ' (In) iMsgId: The messageId of the message from which the value needs to be extraced ' lTimeOut: Number of milliseconds before a timeout occurs ' (Out) message bytStatus: Status code of the received message / answer- ' iErrVal: Error value which indicates what error occured 120 ' value sErr: Error message which corresponds to the error ' sAnswer: read-request) and Value of the parameter (only meaningfull with ' therefore this parameter is optional.. ' Returned : True if the parameter was found, False otherwise ' Remarks : ' Public Function GetInfoDirect(ByVal iMsgId As Integer, ByVal lTimeOut As Long, _ ByRef bytStatus As Byte, ByRef iErrVal As Integer, ByRef sErr As String, _ Optional ByRef sAnswer As String) As Boolean Dim bFound As Boolean indicates if the message has been found 'Boolean which Dim bRetVal As Boolean indicates if the message was answered 'Boolean which Dim sValue As String on a read-request 'Parameter value Dim oTimeOut_Timer As clsTemporizadorTimeOut the timeout timer 'Variable to hold Set oTimeOut_Timer = New clsTemporizadorTimeOut variable 'Initialize the bRetVal = False answered yet 'Message not oTimeOut_Timer.StartTimeOutTimer timer 'Start the timeout Do 'Check if a message with messageId iMsgId exists. If so, load information into the 'supplied parameters bFound = GetMsg(iMsgId, bRetVal, bytStatus, iErrVal, , sErr, sValue) 'Check if the message was found If bFound Then 'Check if an answer has been received on the message If bRetVal Then 'If parameter sAnswer is supplied, fill it.. If Not IsMissing(sAnswer) Then sAnswer = sValue End If Else 'If message was not answered yet, handle pending message to see if the message 121 'if an answer on the message is received now.. HandlePendingMsg End If 'Else (if the message was not found, it means there was no message sent, so we will not ' receive an answer for sure..) End If Loop Until (Not bFound) Or bRetVal Or oTimeOut_Timer.TimeUp(lTimeOut) 'Remove the message from the local message buffer (not from DLL, but from application) RemoveMessage iMsgId GetInfoDirect = bRetVal End Function '--------------END OF FUNCTIONS TO EXTRACT INFORMATION FROM RECEIVED MESSAGES---------------------- '--------------FUNCTIONS TO HANDLE PENDING MESSAGES----------------------------------------------'************************************************************************ **** ' ' HandlePendingMsg ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function : Function which handles pending messages (messages that are queued in the Dll) ' application. These messages will be stored in the local queue of this ' Parameters: ' (In) ' (Out) ' Returned : ' Remarks : ' Public Sub HandlePendingMsg() Dim iMsgId As Integer Dim sValue As String Dim iErrVal As Integer Dim bytStatus As Byte 122 Dim sErr As String Dim iMsgIndex As Integer 'While there are messages in the DLL-queue While GetAnswer(iMsgId, sValue, sErr, iErrVal, bytStatus) 'Find the index / position (in the local message buffer) of the message If GetMsg(iMsgId, , , , , , , iMsgIndex) Then 'Fill the message structure with message information of the received message With m.udtMessageType_Messages(iMsgIndex) .bAnswered = True .bytStatus = bytStatus .iErrVal = iErrVal .sValue = sValue .sErr = sErr End With End If Wend End Sub '--------------END OF FUNCTIONS TO HANDLE PENDING MESSAGES---------------------------------------- '--------------PRIVATE FUNCTIONS AND PROCEDURES--------------------------------------------------'************************************************************************ **** ' ' RemoveMessage ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function : Removes a message from the DLL-queue and the messageId's collection in this ' application. ' Parameters: ' (In) ' (Out) iMsgId: MessageId of the message to be removed ' Returned : ' Remarks : ' 123 Private Sub RemoveMessage(ByVal iMsgId As Integer) Dim iMsgIndex As Integer 'Check if a message with this messageId exists If GetMsg(iMsgId, , , , , , , iMsgIndex) Then 'If the message exists, move the message to the end of the array, but the array must 'stay sorted. While iMsgIndex <> (m.lMessages - 1) ExchangeMsgIds iMsgIndex, iMsgIndex + 1 iMsgIndex = iMsgIndex + 1 Wend 'Remove the message from the message buffer ReDim Preserve m.udtMessageType_Messages(m.lMessages - 1) m.lMessages = m.lMessages - 1 End If End Sub '************************************************************************ **** ' ' GetMsg ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Dec-2003 Function : Function which tries to get a new / free messageId. ' ' ' stored If no free messageId is found, the message will NOT be ' send. in the message buffer. This means the message will not be ' not possible Due to the method RemoveMsg() found in flowb32.dll it is ' same to have multiple messages in the message buffer with the ' (Node, Process, Parameter)-combintation. ' Parameters: ' (In) iMsgId: Message Id of the message you want to get information from ' (Out) bAnswered: Boolean which indicates if an answer message has been received on this 124 ' message. If not, the other parameters mentioned below are not valid!! ' bytStatus: Statuscode of the received message ' iErrVal: ' lNodeProcParm: Long-value (4 bytes) which contains Error value of the received message ' node, process and parameter values... ' (2^8) + Parameter lNodeProcParm = Node * (2^16) + Process * ' sErr: Error string which corresponds to iErrVal ' sValue: Parametervalue extracted from the received message (only filled when ' written) a parameter is read, not when a parameter is ' iMsgIndex: Index in the local message buffer, where the message is stored ' Returned : 0, if a new / messageId was found for the message ' 1, if the message buffer was full (message NOT added) ' the same 2, if the message buffer already contained a message with ' (Node, Process, Parameter)-combination ' Remarks : The message buffer is sorted on messageId. The lowest messageId comes first. ' Private Function GetMsg(ByVal iMsgId As Integer, Optional ByRef bAnswered As Boolean, _ Optional ByRef bytStatus As Byte, Optional ByRef iErrVal As Integer, _ Optional ByRef lNodeProcParm As Long, Optional ByRef sErr As String, _ Optional ByRef sValue As String, Optional ByRef iMsgIndex As Integer) As Boolean Dim iIndex As Integer Dim bRetVal As Boolean message buffer contains 'Index in the message buffer 'Boolean which indicates if the 'such a message bRetVal = False 'Message not found yet 'Check every message in the local message buffer For iIndex = 0 To m.lMessages - 1 With m.udtMessageType_Messages(iIndex) 'MessageId same as messageId of current message? If .iMsgId = iMsgId Then 'Message found bRetVal = True 125 'If parameter bAnswered is supplied, then set bAnswered If Not IsMissing(bAnswered) Then bAnswered = .bAnswered End If 'If parameter bytStatus is supplied, then set bytStatus If Not IsMissing(bytStatus) Then bytStatus = .bytStatus End If 'If parameter iErrVal is supplied, then set iErrVal If Not IsMissing(iErrVal) Then iErrVal = .iErrVal End If 'If parameter lNodeProcParm is supplied, then set lNodeProcParm If Not IsMissing(lNodeProcParm) Then lNodeProcParm = .lNodeProcParm End If 'If parameter sErr is supplied, then set sErr If Not IsMissing(sErr) Then sErr = .sErr End If 'If parameter sErr is supplied, then set sErr If Not IsMissing(sErr) Then sErr = .sErr End If 'If parameter iMsgIndex is supplied, then set iMsgIndex If Not IsMissing(iMsgIndex) Then iMsgIndex = iIndex End If 'If parameter sValue is supplied, then set sValue If Not IsMissing(sValue) Then sValue = .sValue End If 126 'If parameter iMsgIndex is supplied, then set iMsgIndex If Not IsMissing(iMsgIndex) Then iMsgIndex = iIndex End If Exit For End If End With Next GetMsg = bRetVal End Function '************************************************************************ **** ' ' GetFreeMsgId ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Dec-2003 Function : Function which tries to get a new / free messageId. ' ' ' stored If no free messageId is found, the message will NOT be ' send. in the message buffer. This means the message will not be ' not possible Due to the method RemoveMsg() found in flowb32.dll it is ' same to have multiple messages in the message buffer with the ' (Node, Process, Parameter)-combintation. ' Parameters: ' (In) iNode: Node ' iProc: Process ' iParm: Parameter ' (Out) message iMsgId: New / free messageId that was assigned to the ' Returned : 0, if a new / messageId was found for the message ' 1, if the message buffer was full (message NOT added) ' the same 2, if the message buffer already contained a message with ' (Node, Process, Parameter)-combination 127 ' Remarks : The message buffer is sorted on messageId. The lowest messageId comes first. ' Private Function GetFreeMsgId(ByVal iNode As Integer, ByVal iProc As Integer, _ ByVal iParm As Integer, ByRef iMsgId As Integer) As Integer Dim iIndex As Integer 'Index in the message buffer Dim iRetVal As Integer 'Return value Dim bFound As Boolean messageId has been found 'Boolean which indicates if a free Const MAX_MESSAGES As Long = 32767 'Maximum number of messages that can be buffered bFound = False 'No free messageId found so far iRetVal = 0 'Everything Ok, so far.. 'Does message buffer already contain such a message? If MsgBufContains(iNode, iProc, iParm) Then iRetVal = 2 'Message buffer already contained a message with iNode, iProc and iParm End If 'No errors so far? If iRetVal = 0 Then 'If the local message buffer is not full (there is still place for a message) If m.lMessages < MAX_MESSAGES Then 'Try iMsgId = 1 as the first free msgId iMsgId = 1 'Check the msgId of every message in the local buffer For iIndex = 0 To m.lMessages 'Check if the msgId of the current message is greater than iMsgId, or 'the end of the message buffer has been reached.. If iIndex = m.lMessages Then 'iMsgId is a free message id (a free message id has been found) bFound = True Else If m.udtMessageType_Messages(iIndex).iMsgId > iMsgId Then 'iMsgId is a free message id (a free message id has been found) 128 bFound = True End If End If 'If a free messageId has been found.. If bFound Then 'Increase the size of the message buffer with 1.. ReDim Preserve m.udtMessageType_Messages(m.lMessages + 1) 'Store the new message in the message buffer m.udtMessageType_Messages(m.lMessages).iMsgId = iMsgId 'Place the new message at the right position in the message buffer (so that the 'message buffer stays sorted) ExchangeMsgIds m.lMessages, iIndex 'Increase number of messages in the message buffer with 1 m.lMessages = m.lMessages + 1 'Initialize the message.. With m.udtMessageType_Messages(iIndex) .bAnswered = False .bytStatus = 0 .iErrVal = 0 .iMsgId = iMsgId .lNodeProcParm = iNode * (2 ^ 16) + iProc * (2 ^ 8) + iParm .sErr = "" .sValue = "" End With 'Exit loop, because a free msgId has been found Exit For Else 'If the msgId of the current message is equal to iMsgId '(less than is not possible), iMsgId is not a free iMsgId, so increase iMsgId iMsgId = iMsgId + 1 End If Next Else 129 iRetVal = 1 'Message buffer was full End If End If GetFreeMsgId = iRetVal End Function '************************************************************************ **** ' ' MsgBufContains ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Dec-2003 ' ' Function : Function which checks if the local message buffer already contains a message for ' the specified (node, process, parameter)-combination. No 2 messages of this ' combination can be in the message buffer at the same time. This is due to the ' function RemoveMsg() found in Flowb32.dll. ' Parameters: ' (In) bytNode: Node ' bytProc: Process ' bytParm: Parameter ' (Out) ' Returned : True if a such a message (specified by the input parameters) exists, False otherwise ' Remarks : ' Private Function MsgBufContains(ByVal bytNode As Byte, ByVal bytProc As Byte, _ ByVal bytParm As Byte) As Boolean Dim iIndex As Integer Dim bRetVal As Boolean message buffer contains 'Index in the message buffer 'Boolean which indicates if the 'such a message bRetVal = False 'Message not found yet 'Check every message in the local message buffer For iIndex = 0 To m.lMessages - 1 130 With m.udtMessageType_Messages(iIndex) 'Node, process and parameter same as values found in current message? If .lNodeProcParm = (bytNode * (2 ^ 16) + bytProc * (2 ^ 8) + bytParm) Then 'Values same, so message was found bRetVal = True Exit For End If End With Next MsgBufContains = bRetVal End Function '************************************************************************ **** ' ' ExchangeMsgIds ' ' Author : Bronkhorst High-Tech B.V. ' Date : 15-Dec-2003 ' ' Function : Function which exchanges 2 messages in the message buffer. The messages will change ' from position in the message buffer, so that the message buffer stays sorted on ' ' messageId. Parameters: ' (In) message buffer iMsgIndexA: Position / Index of messageId A in the ' message buffer iMsgIndexB: Position / Index of messageId B in the ' ' (Out) Returned : ' Remarks : The message buffer is sorted on messageId. The lowest messageId comes first. ' Preconditions: - iMsgIndexA >= 0 ' - iMsgIndexA < m.lMessages ' - iMsgIndexB >= 0 ' - iMsgIndexB < m.lMessages ' 131 Private Sub ExchangeMsgIds(ByVal iMsgIndexA As Integer, ByVal iMsgIndexB As Integer) Dim udtMessageType_Temp As MessageType 'Exchange 2 messages.. 'Temp = MessageA udtMessageType_Temp = m.udtMessageType_Messages(iMsgIndexA) 'MessageA = MessageB m.udtMessageType_Messages(iMsgIndexA) = m.udtMessageType_Messages(iMsgIndexB) 'MessageB = Temp m.udtMessageType_Messages(iMsgIndexB) = udtMessageType_Temp End Sub '************************************************************************ **** ' ' GetAnswer ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function : Function which gets a message from the DLL-queue. Only the first message ' can be popped of the queue (we can NOT start in the middle or at the back) ' Parameters: ' (In) ' (Out) iMsgId: The messageId of the message that was found ' message sAnswer: Parameter value extracted from the answer ' sErrVal: Error string which indicates if an error occured. "", if there where no ' errors (iErrVal and bytStatus are both 0). Otherwise it contains an ' error-string ' iErrVal: Error value, of the error that occured ' bytStatus: Status code of the received message ' Returned : True if a message has been received, False otherwise ' Remarks : ' 132 Private Function GetAnswer(ByRef iMsgId As Integer, ByRef sAnswer As String, _ ByRef sErrVal As String, ByRef iErrVal As Integer, ByRef bytStatus As Byte) _ As Boolean On Error GoTo ErrorHandler Dim bytNode As Byte Dim bytProc As Byte Dim bytParm As Byte Dim bytMsgType As Byte Dim bytParmType As Byte Dim bytValue As Byte Dim iValue As Integer Dim fValue As Single Dim lValue As Long Dim bytStrLen As Byte Dim bMsgFound As Boolean bMsgFound = False sErrVal = "" iErrVal = 0 'Check if ther is a message in the dll's message buffer 'If so, load our parameters with the values of the messages that was found iErrVal = modFlowbusAPI.CheckReceivedMsg(cfg.IdApl, bytNode, bytProc, bytParm, bytMsgType, _ bytParmType, iMsgId) 'Did the DLL receive a message? If iErrVal = 0 Then bMsgFound = True 'See if an internal error occured... iErrVal = modFlowbusAPI.GetError() 'No internal error occured? If iErrVal = 0 Then 'Are we writing a parameter to flowbus (0) or are we reading a parameter from 'flowbus(1)? In both cases we want to know the status of the answer-message 'to know if everything went OK. In case of reading a parameter we ar also 'interested in the parameter-value contained in the message. 133 If bytMsgType = 0 Or bytMsgType = 1 Then 'iErrVal contains an errorvalue (some internal value or a flobus-status error) 'bytStatus now contains a flowbus-status error. iErrVal = _ modFlowbusAPI.GetStatus(cfg.IdApl, bytNode, bytProc, bytParm, bytStatus, iMsgId) 'Are we reading a paramater from the flowbus? If bytMsgType = 1 Then 'According to the comments above, you might think that we could only test on 'iErrVal, because it contains both internal and flowbus-status errors. 'Because I'm not certain of this, I will just test on both variables. 'No error occured? If iErrVal = 0 And bytStatus = 0 Then 'Extract the parameter-value from the answermessage Select Case bytParmType '------------------------------------------------------------------------'Is the parameter of type Byte? Case 0 iErrVal = modFlowbusAPI.GetChar(cfg.IdApl, bytNode, bytProc, bytParm, _ bytValue, iMsgId) sAnswer = Str(bytValue) '------------------------------------------------------------------------'Is the parameter of type Integer? Case 1 iErrVal = modFlowbusAPI.GetInt(cfg.IdApl, bytNode, bytProc, bytParm, _ iValue, iMsgId) sAnswer = Str(iValue) '------------------------------------------------------------------------'Is the parameter of type Float? Case 2 iErrVal = modFlowbusAPI.GetFloat(cfg.IdApl, bytNode, bytProc, bytParm, _ fValue, iMsgId) sAnswer = Format$(fValue, "0.00000E+0") 134 '------------------------------------------------------------------------'Is the parameter of type Long? Case 3 iErrVal = modFlowbusAPI.GetLong(cfg.IdApl, bytNode, bytProc, bytParm, _ lValue, iMsgId) sAnswer = Str(lValue) '------------------------------------------------------------------------'Is the parameter of type String? Case 4 'Create a String containing 256 spaces, because of C++. 'If your String contains too few spaces C++ may generate a 'memory error. The String you supply must contain at least as 'many characters as the C++ function will write into your variable. sAnswer = Space(256) iErrVal = modFlowbusAPI.GetString(cfg.IdApl, bytNode, bytProc, _ bytParm, iMsgId, sAnswer, bytStrLen) 'Trim the answer, leading and trailing spaces are not interesting. sAnswer = Trim(sAnswer) '------------------------------------------------------------------------'Parameter type not found?? Case Else 'Set an error.. sErrVal = "Parameter type not found!!" iErrVal = 12 '------------------------------------------------------------------------End Select 'If an error occured while reading the parameter value If iErrVal <> 0 Then sErrVal = "Error while reading parameter value" End If Else 135 'The statuscode indicated an error, so set an error.. sErrVal = "Statuscode indicated an error" End If End If Else 'The messagetype was not found, so set an error.. sErrVal = "Message type not found" End If Else 'Save the error number in the return-string, so the user can use this value to 'determine the cause sErrVal = "modFlowbusAPI.GetError() detected an internal error" End If 'A message was found, remove the message from the queue modFlowbusAPI.RemoveMsg cfg.IdApl, bytNode, bytProc, bytParm End If GetAnswer = bMsgFound Exit Function ErrorHandler: MsgBox "Runtime error: " & Err.Number & " (" & Err.Description & ")" Resume Next End Function '--------------END OF PRIVATE FUNCTIONS AND PROCEDURES-------------------------------------------- '************************************************************************ **** ' ' HandleErrorMessage ' ' Author : Bronkhorst High-Tech B.V. ' Date : 11-Dec-2003 ' ' Function : Function which returns an error message, depending on the error that occured.. ' Parameters: ' (In) iErrVal: Error value of the error that occured (This error is received on a 136 ' ' iNode: Node address of the node which caused the error ' error iParm: Parameter number of the parameter which caused the ' ' (Out) Returned : ' Remarks : This Function is not used yet. It is not used because the complete list of error ' codes was not clearly documented. The errorvalue iErrVal which servers as input ' WriteXXX()) is returned from a call to (GetXXX(), ReadXXX() or ' XXX = Char | Int | Float | Long | String. ' If you get an error, from which you can not identify the cause, you can take ' a look at the contents of this function.. ' Public Function HandleErrorMessage(ByVal iErrVal As Integer, ByVal iNode As Integer, _ ByVal iParm As Integer) As String Dim sMessage As String Dim sAdvise As String 'No error yet.. sMessage = "" sAdvise = "" Select Case iErrVal Case 1: If iParm <> 189 Then sMessage = "This process cannot be operated by your PC-application" sAdvise = "Probably another device will have exclusive operation rights" End If Case 2: sMessage = "No such command possible for this module" sAdvise = "Command not supported by FLOW-BUS module" Case 3: sMessage = "No such process at this module" sAdvise = "Process not supported by FLOW-BUS module" Case 4: sMessage = "No such parameter at this process" 137 sAdvise = "Parameter not supported by FLOW-BUS module" Case 5: sMessage = "Type of parameter sent differs from type on module" sAdvise = "Check parameter type in parameter list" Case 6: sMessage = "Wrong value for this parameter or not accepted" sAdvise = "Check parameter value range in parameter list or parameter value list" Case 7: sMessage = "No communication activity on FLOW-BUS detected" sAdvise = "First connect and power-up other FLOW-BUS modules or start-up now" Case 8: sMessage = "Start character serial communication failed" sAdvise = "Communication with RS232 interface fails, check connection and port settings" Case 9: sMessage = "Serial communication failed" sAdvise = "Communication with RS232 interface fails, check connection and port settings" Case 10: sMessage = "Memory on FLOW-BUS module failed" sAdvise = "Try to restore original factory settings or contact local supplier for service" Case 11: sMessage = "Wrong FLOW-BUS node number" sAdvise = "Try to re-install this module on the FLOW-BUS" Case 12: sMessage = "General communication error with FLOW-BUS (DLL retries expired)" sAdvise = "Bad connection: check all cabling, network terminations and individual modules" Case 13: sMessage = "This parameter value can only be read" sAdvise = "Check parameter list to see what is allowed" Case 14: sMessage = "There is no communication between PC and FLOW-BUS" sAdvise = "Check settings and connections and open/start communication" Case 15: 138 sMessage = "No/bad communication between PC and RS232interface module" sAdvise = "Check settings and connections and open/start communication" Case 16: sMessage = "Not enough memory in your PC for communication structure" sAdvise = "Maybe the time has come to look around for a newer type ?" Case 17: sMessage = "This parameter value can only be send" sAdvise = "Check parameter list to see what is allowed" Case 18: sMessage = "FLOW-BUS system configuration is unknown" sAdvise = "(Re)-run 'Read system configuration'-routine" Case 19: sMessage = "FLOW-BUS system reached maximum size" sAdvise = "Check LNA-settings (last node address) of FLOW-BUS modules. When >120 is wanted make new bus-segment" Case 20: sMessage = "You need another type of interface for this option" sAdvise = "There are two types available: RS232 and PC(ISA)" Case 21: sMessage = "Error building device control block for serial port" sAdvise = "Communication with interface fails, check connection and settings" Case 22: If iParm = 27 Then sMessage = "Open communication went wrong" sAdvise = "Communication with interface fails, check connection and settings" End If Case 23: sMessage = "Communication status error" sAdvise = "Communication with module fails, check connection and settings" Case 24: sMessage = "Interface tries to start communication (alone in system)" sAdvise = "This is no error; the first module in the system has a special function" Case 25: 139 sMessage = "Time out on receiving a message" sAdvise = "Communication with module fails, check connection and settings" Case 26: sMessage = "No ':' on start of message" sAdvise = "Communication with interface fails, check connection and settings" Case 27: sMessage = "Error in first digit" sAdvise = "Communication with interface fails, check connection and settings" Case 28: sMessage = "Buffer overflow in interface module" sAdvise = "Communication with interface fails, check connection and settings" Case 29: sMessage = "Buffer overflow in FLOWBUS.DLL" sAdvise = "There are too many messages from applications to the DLL, wait until all messages are handled, then proceed" Case 30: sMessage = "Requested answer not found" sAdvise = "Communication with FLOWBUS.DLL fails, check connection and settings" Case 31: sMessage = "Closing communication error" sAdvise = "It's not possible to stop communication correctly. Maybe you have to reset PC or FLOW-BUS modules." Case 32: sMessage = "Other application performs action" sAdvise = "The FLOWBUS.DLL is still in use by another application or not correctly closed and still in memory (restart PC)" Case 33: sMessage = "Requested message has not been send" sAdvise = "Communication with FLOWBUS.DLL fails, check connection and settings" Case 34: sMessage = "Error in received data" sAdvise = "Communication with FLOWBUS.DLL fails, check connection and settings" Case 35: sMessage = "No event present in real-time channel on interface module" sAdvise = "Try reading again; check real-time initialization settings when problem remains" 140 Case 36: sMessage = "Module not available on FLOWBUS" sAdvise = "Probably module is temporarily disconnected from the bus for service purposes" Case 37: sMessage = "FLOWDDE not ready to communicate with FLOWBUS" sAdvise = "Communication with FLOW-BUS has to be started correctly first." Case 38: sMessage = "Parameter not correctly in FLOWDDE database" sAdvise = "Check variable type of parameter and if you have a correct version of FLOWDDE" Case 39: sMessage = "Requested parameter value not received" sAdvise = "Check settings, connections and module where request failed" Case 40: sMessage = "There are too many messages to be handled in the DLL" sAdvise = "Wait until all messages are handled, then proceed" Case 41: sMessage = "There are some unhandled/unremoved messages in the DLL" sAdvise = "This is a serious error, restart FLOWDDE" Case 42: sMessage = "Buffer overflow in FLOW-BUS module" sAdvise = "There are too many messages for this module to handle in the time available" Case Else: sMessage = "Unknown error occured" sAdvise = "When this happens more frequently, contact your local sales/service representative" End Select HandleErrorMessage = sMessage & Chr(10) & sAdvise End Function 3.2.4. API para Tarjeta de Adquisición de Datos (nidaq32.bas) '************************************************************************ *** '* '* NI-DAQ Windows - Function Prototypes for Visual Basic 141 '* Copyright (C) National Instruments 1995. '* '************************************************************************ ** Declare Function AI_Change_Parameter% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d&) Declare Function AI_Check% Lib "nidaq32.dll" (ByVal a%, b%, c%) Declare Function AI_Clear% Lib "nidaq32.dll" (ByVal a%) Declare Function AI_Configure% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%) Declare Function AI_Mux_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function AI_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d%) Declare Function AI_Read32% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d&) Declare Function AI_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function AI_VRead% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d#) Declare Function AI_VScale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#, ByVal f%, g#) Declare Function Align_DMA_Buffer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&, ByVal e&, f&) Declare Function AO_Calibrate% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function AO_Configure% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e#, ByVal f%) Declare Function AO_Change_Parameter% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d&) Declare Function AO_Update% Lib "nidaq32.dll" (ByVal a%) Declare Function AO_VWrite% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c#) Declare Function AO_Write% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function Calibrate_E_Series% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d#) Declare Function Calibrate_59xx% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c#) Declare Function Calibrate_DSA% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c#) Declare Function Config_Alarm_Deadband% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d#, ByVal e#, ByVal f%, ByVal g%, ByVal h%, ByVal i&) Declare Function Config_ATrig_Event_Message% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d#, ByVal e#, ByVal f%, ByVal g&, ByVal h&, ByVal i&, ByVal j%, ByVal k%, ByVal l&) 142 Declare Function Config_DAQ_Event_Message% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d%, ByVal e&, ByVal f&, ByVal g&, ByVal h&, ByVal i&, ByVal j%, ByVal k%, ByVal l&) Declare Function Configure_HW_Analog_Trigger% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&, ByVal e&, ByVal f&) Declare Function CTR_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%) Declare Function CTR_EvCount% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function CTR_EvRead% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%) Declare Function CTR_FOUT_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%) Declare Function CTR_Period% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function CTR_Pulse% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%) Declare Function CTR_Rate% Lib "nidaq32.dll" (ByVal a#, ByVal b#, c%, d%, e%) Declare Function CTR_Reset% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function CTR_Restart% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function CTR_Simul_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d%) Declare Function CTR_Square% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%) Declare Function CTR_State% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function CTR_Stop% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function DAQ_Check% Lib "nidaq32.dll" (ByVal a%, b%, c&) Declare Function DAQ_Clear% Lib "nidaq32.dll" (ByVal a%) Declare Function DAQ_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function DAQ_DB_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function DAQ_DB_HalfReady% Lib "nidaq32.dll" (ByVal a%, b%, c%) Declare Function DAQ_DB_Transfer% Lib "nidaq32.dll" (ByVal a%, b As Any, c&, d%) Declare Function DAQ_Monitor% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d&, e As Any, f&, g%) Declare Function DAQ_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f#) Declare Function DAQ_Rate% Lib "nidaq32.dll" (ByVal a#, ByVal b%, c%, d%) Declare Function DAQ_Start% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f%, ByVal g%) Declare Function DAQ_StopTrigger_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&) Declare Function DAQ_to_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d$, ByVal e&, ByVal f#, ByVal g%) 143 Declare Function DAQ_VScale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#, ByVal f&, g%, h#) Declare Function DIG_Block_Check% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&) Declare Function DIG_Block_Clear% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function DIG_Block_In% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&) Declare Function DIG_Block_Out% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&) Declare Function DIG_Block_PG_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%) Declare Function DIG_DB_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%) Declare Function DIG_DB_HalfReady% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function DIG_DB_Transfer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c As Any, ByVal d&) Declare Function DIG_Grp_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%) Declare Function DIG_Grp_Mode% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%) Declare Function DIG_Grp_Status% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function DIG_In_Grp% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function DIG_In_Line% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d%) Declare Function Query_Optimizations_GFS% Lib "nidaq32.dll" (ByVal a%) Declare Function DIG_In_Port_GFS% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function DIG_In_Port% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function DIG_Line_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function DIG_Out_Grp% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function DIG_Out_Line% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function DIG_Out_Port_GFS% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function DIG_Out_Port% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function DIG_Prt_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function DIG_Prt_Status% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function DIG_SCAN_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d%, ByVal e%) Declare Function Get_DAQ_Device_Info% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c&) 144 Declare Function Get_DAQ_Event% Lib "nidaq32.dll" (ByVal a&, b%, c%, d%, e&) Declare Function Get_NI_DAQ_Version% Lib "nidaq32.dll" (a&) Declare Function GPCTR_Config_Buffer% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&, e As Any) Declare Function GPCTR_Read_Buffer% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&, ByVal e&, ByVal f#, g&, h&) Declare Function Line_Change_Attribute% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&) Declare Function GPCTR_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&) Declare Function GPCTR_Set_Application% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&) Declare Function GPCTR_Watch% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, d&) Declare Function ICTR_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function ICTR_Reset% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function ICTR_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%) Declare Function Init_DA_Brds% Lib "nidaq32.dll" (ByVal a%, b%) Declare Function Lab_ISCAN_Check% Lib "nidaq32.dll" (ByVal a%, b%, c&, d%) Declare Function Lab_ISCAN_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f#, ByVal g#, h%) Declare Function Lab_ISCAN_Start% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d As Any, ByVal e&, ByVal f%, ByVal g%, ByVal h%) Declare Function Lab_ISCAN_to_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d$, ByVal e&, ByVal f#, ByVal g#, ByVal h%) Declare Function LPM16_Calibrate% Lib "nidaq32.dll" (ByVal a%) Declare Function MIO_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function Peek_DAQ_Event% Lib "nidaq32.dll" (ByVal a&, b%, c%, d%, e&) Declare Function REG_Level_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&) Declare Function REG_Level_Write% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d&, e&) Declare Function RTSI_Clear% Lib "nidaq32.dll" (ByVal a%) Declare Function RTSI_Clock% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function RTSI_Conn% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function RTSI_DisConn% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function SC_2040_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) 145 Declare Function SCAN_Demux% Lib "nidaq32.dll" (a%, ByVal b&, ByVal c%, ByVal d%) Declare Function SCAN_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, e As Any, ByVal f&, ByVal g#, ByVal h#) Declare Function SCAN_Sequence_Demux% Lib "nidaq32.dll" (ByVal a%, b%, ByVal c&, d%, ByVal e%, f%, g&) Declare Function SCAN_Sequence_Retrieve% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%) Declare Function SCAN_Sequence_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, e%, f%, g%) Declare Function SCAN_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%) Declare Function SCAN_Start% Lib "nidaq32.dll" (ByVal a%, b As Any, ByVal c&, ByVal d%, ByVal e%, ByVal f%, ByVal g%) Declare Function SCAN_to_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, ByVal e$, ByVal f&, ByVal g#, ByVal h#, ByVal i%) Declare Function Calibrate_1200% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%, ByVal h%, ByVal i#, ByVal j#) Declare Function SCXI_AO_Write% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f#, ByVal g%, h%) Declare Function SCXI_Cal_Constants% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g#, ByVal h%, ByVal i%, ByVal j%, ByVal k#, ByVal l#, ByVal m#, ByVal n#, ByVal o#, p#, q#) Declare Function InitChannelWizardStrainCal% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e!, ByVal f!, g#, h%, i%, ByVal j!, ByVal k%) Declare Function ChannelWizardSCXIStrainCal% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f#, ByVal g%, ByVal h$, ByVal i$, j#, k#, l#) Declare Function SCXI_1520_Transducer_Cal% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e%, ByVal f%) Declare Function SCXI_Calibrate% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f#, ByVal g#, ByVal h%, ByVal i%) Declare Function SCXI_Strain_Null% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, f!) Declare Function SCXI_Strain_Null_Ex% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, f!, ByVal g!, ByVal h&, i%, j%) Declare Function SCXI_Calibrate_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function SCXI_Change_Chan% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function SCXI_Set_Potentiometer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e$) Declare Function SCXI_Set_Excitation% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e!, f!) Declare Function SCXI_Configure_Connection% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function SCXI_Configure_Filter% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e#, ByVal f%, ByVal g%, h#) 146 Declare Function SCXI_Get_Chassis_Info% Lib "nidaq32.dll" (ByVal a%, b%, c%, d%, e%, f%) Declare Function SCXI_Get_Module_Info% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&, d%, e%) Declare Function SCXI_Get_State% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, e&) Declare Function SCXI_Get_Status% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, d&) Declare Function SCXI_Load_Config% Lib "nidaq32.dll" (ByVal a%) Declare Function SCXI_MuxCtr_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function SCXI_Reset% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function SCXI_Scale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#, ByVal f%, ByVal g%, ByVal h%, ByVal i&, j%, k#) Declare Function SCXI_SCAN_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%, e%, ByVal f%, ByVal g%) Declare Function SCXI_Set_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, g&, h%, i%) Declare Function SCXI_Set_Gain% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#) Declare Function SCXI_Set_Input_Mode% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function SCXI_Set_State% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e&) Declare Function SCXI_Single_Chan_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function SCXI_Track_Hold_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%) Declare Function SCXI_Track_Hold_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g%) Declare Function Select_Signal% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&) Declare Function Set_DAQ_Device_Info% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&) Declare Function Timeout_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b&) Declare Function WFM_Chan_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function WFM_Check% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d&, e&) Declare Function WFM_ClockRate% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e&, ByVal f%) Declare Function WFM_DB_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d%, ByVal e%, ByVal f%) Declare Function WFM_DB_HalfReady% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d%) Declare Function WFM_DB_Transfer% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d As Any, ByVal e&) 147 Declare Function WFM_from_Disk% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d$, ByVal e&, ByVal f&, ByVal g&, ByVal h#) Declare Function WFM_Group_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%) Declare Function WFM_Group_Setup% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, ByVal d%) Declare Function WFM_Load% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d As Any, ByVal e&, ByVal f&, ByVal g%) Declare Function WFM_Op% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c%, d As Any, ByVal e&, ByVal f&, ByVal g#) Declare Function WFM_Rate% Lib "nidaq32.dll" (ByVal a#, ByVal b%, c%, d&) Declare Function WFM_Scale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d#, e#, f%) Declare Function AI_Read_Scan% Lib "nidaq32.dll" (ByVal a%, b%) Declare Function AI_VRead_Scan% Lib "nidaq32.dll" (ByVal a%, b#) Declare Function SCXI_ModuleID_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&) Declare Function AO_VScale% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c#, d%) Declare Function GPCTR_Change_Parameter% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&) Declare Function USE_MIO% Lib "nidaq32.dll" () Declare Function USE_LPM% Lib "nidaq32.dll" () Declare Function USE_LAB% Lib "nidaq32.dll" () Declare Function USE_DIO_96% Lib "nidaq32.dll" () Declare Function USE_DIO_32F% Lib "nidaq32.dll" () Declare Function USE_DIO_24% Lib "nidaq32.dll" () Declare Function USE_AO_610% Lib "nidaq32.dll" () Declare Function USE_AO_2DC% Lib "nidaq32.dll" () Declare Function DIG_Trigger_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d%, ByVal e%, ByVal f%, ByVal g&, ByVal h&, ByVal i&) Declare Function SCXI_Set_Threshold% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c%, ByVal d#, ByVal e#) Declare Function WFM_Set_Clock% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&, ByVal d#, ByVal e&, f#) Declare Function DAQ_Set_Clock% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c#, ByVal d&, e#) Declare Function Tio_Select_Signal% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d&) Declare Function Tio_Combine_Signals% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&) Declare Function DIG_In_Prt% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&) Declare Function DIG_Out_Prt% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c&) Declare Function AI_Get_Overloaded_Channels% Lib "nidaq32.dll" (ByVal a%, b%, c%) 148 Declare Function Calibrate_TIO% Lib "nidaq32.dll" (ByVal a%, ByVal b&, ByVal c&, ByVal d#) Declare Function DIG_Change_Message_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d$, ByVal e%, ByVal f%, ByVal g&) Declare Function DIG_Change_Message_Control% Lib "nidaq32.dll" (ByVal a%, ByVal b%) Declare Function DIG_Filter_Config% Lib "nidaq32.dll" (ByVal a%, ByVal b%, ByVal c$, ByVal d#) Declare Function SCXI_TerminalBlockID_Read% Lib "nidaq32.dll" (ByVal a%, ByVal b%, c&) Declare Function ni62xx_CalStart% Lib "nidaq32.dll" (ByVal a%, ByVal b$) Declare Function ni62xx_CalAdjust% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c#, ByVal d%) Declare Function ni62xx_CalEnd% Lib "nidaq32.dll" (ByVal a%, ByVal b&) Declare Function ni62xx_SelfCalibrate% Lib "nidaq32.dll" (ByVal a%) Declare Function CalFetchInternalReference% Lib "nidaq32.dll" (ByVal a%, b#) Declare Function CalChangePassword% Lib "nidaq32.dll" (ByVal a%, ByVal b$, ByVal c$) Declare Function CalFetchCount% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c&) Declare Function CalFetchDate% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c&, d&, e&) Declare Function CalFetchTemperature% Lib "nidaq32.dll" (ByVal a%, ByVal b&, c#) Declare Function CalFetchMiscInfo% Lib "nidaq32.dll" (ByVal a%, ByVal b$) Declare Function CalStoreMiscInfo% Lib "nidaq32.dll" (ByVal a%, ByVal b$) 3.2.5. Funciones Sobre la API (nidex32.bas) '************************************************************************ '* TITLE: NIDEx32.bas '* Header for supporting code module for NI-DAQ Examples '* (32-bit Visual Basic version) '* '* DESCR: This header file is to be used with any NI-DAQ example '* program. '* '* Copyright (c) 1997, National Instruments Corp. All rights reserved. '************************************************************************ / ' NOTE: must also use nidaq32.bas ' and nidaqcns.bas 149 '* '* Constants '* '* for 'lType' Global Const WFM_DATA_U8 = 0 Global Const WFM_DATA_I16 = 2 Global Const WFM_DATA_F64 = 4 Global Const WFM_DATA_U32 = 7 '* internal constants - change if needed... Global Const WFM_PERIODS = 10 Global Const WFM_MIN_PTS_IN_PERIOD = 2 Global Const WFM_U8_MODULO = 256 Global Const WFM_I16_AMPL = 2047 Global Const WFM_F64_AMPL = 4.99 '* error return codes for NIDAQPlotWaveform and NIDAQMakeBuffer '* these error codes are consistent with CVI error codes Global Const NIDAQEX_INVALID_BUFFER = -12 Global Const NIDAQEX_INVALID_NUMPTS = -14 Global Const NIDAQEX_INVALID_TYPE = -53 '* '* Function prototypes '* Declare Function NIDAQPlotWaveform Lib "nidex32.dll" (pvBuffer As Any, ByVal lNumPts&, ByVal lType&) As Integer Declare Function NIDAQMakeBuffer Lib "nidex32.dll" (pvBuffer As Any, ByVal lNumPts&, ByVal lType&) As Integer Declare Function NIDAQErrorHandler Lib "nidex32.dll" (ByVal iStatus%, ByVal strFuncName$, ByVal iIgnoreWarning%) As Integer Declare Function NIDAQDelay Lib "nidex32.dll" (ByVal dSec#) As Integer Declare Function NIDAQYield Lib "nidex32.dll" (ByVal iYieldMode%) As Integer Declare Function NIDAQMean Lib "nidex32.dll" (pvBuffer As Any, ByVal lNumPts&, ByVal lType&, dMean#) As Integer Declare Function NIDAQWaitForKey Lib "nidex32.dll" (ByVal dTimeLimit#) As Integer 150 3.2.6. Módulo de constantes para la API de la Adq. de datos(nidaqcns.inc) '*********************************************************************' '* *' '* This file contains definitions for constants required for some *' '* of the NI-DAQ functions. *' '* *' '* You should use symbols defined here in your programs; do not *' '* use the numerical values. *' '* *' '* See your NI-DAQ Function Reference Manual for details concerning *' '* use of constants defined here. *' '* *' '*********************************************************************' Global Const ND_ABOVE_HIGH_LEVEL& = 11020 Global Const ND_ABOVE_LEVEL_A& = 11021 Global Const ND_ABOVE_LEVEL_A_HYSTERESIS& = 11022 Global Const ND_AC& = 11025 Global Const ND_ACK_REQ_EXCHANGE_GR1& = 11030 Global Const ND_ACK_REQ_EXCHANGE_GR2& = 11035 Global Const ND_ACTIVE& = 11037 Global Const ND_ADC_RESOLUTION& = 11040 Global Const ND_AI_CALDAC_COUNT& = 11050 Global Const ND_AI_CHANNEL_COUNT& = 11060 Global Const ND_AI_COUPLING& = 11055 Global Const ND_AI_FIFO_INTERRUPTS& = 11600 Global Const ND_ANALOG_FILTER& = 11065 Global Const ND_AO48XDC_SET_POWERUP_STATE& = 42100 Global Const ND_AO_CALDAC_COUNT& = 11070 Global Const ND_AO_CHANNEL_COUNT& = 11080 Global Const ND_AO_EXT_REF_CAPABLE& = 11090 Global Const ND_AO_UNIPOLAR_CAPABLE& = 11095 Global Const ND_ARM& = 11100 Global Const ND_ARMED& = 11200 Global Const ND_ATC_OUT& = 11250 Global Const ND_ATTENUATION& = 11260 Global Const ND_AUTOINCREMENT_COUNT& = 11300 Global Const ND_AUTOMATIC& = 11400 Global Const ND_AVAILABLE_POINTS& = 11500 Global Const ND_BASE_ADDRESS& = 12100 151 Global Const ND_BELOW_LEVEL_A& = 12110 Global Const ND_BELOW_LEVEL_A_HYSTERESIS& = 12115 Global Const ND_BELOW_LOW_LEVEL& = 12130 Global Const ND_BETWEEN_LEVEL_A_LEVEL_B& = 12135 Global Const ND_BOARD_CLOCK& = 12170 Global Const ND_BUFFERED_EVENT_CNT& = 12200 Global Const ND_BUFFERED_PERIOD_MSR& = 12300 Global Const ND_BUFFERED_PULSE_WIDTH_MSR& = 12400 Global Const ND_BUFFERED_SEMI_PERIOD_MSR& = 12500 Global Const ND_BURST& = 12600 Global Const ND_BURST_INTERVAL& = 12700 Global Const ND_CAL_CONST_AUTO_LOAD& = 13050 Global Const ND_CALIBRATION_ENABLE& = 13055 Global Const ND_CALIBRATION_FRAME_SIZE& = 13060 Global Const ND_CALIBRATION_FRAME_PTR& = 13065 Global Const ND_CJ_TEMP% = &H8000 Global Const ND_CALGND% = &H8001 Global Const ND_P_POS_0% = &H4000 Global Const ND_P_POS_1% = &H4001 Global Const ND_P_POS_2% = &H4002 Global Const ND_P_POS_3% = &H4003 Global Const ND_P_POS_4% = &H4004 Global Const ND_P_POS_5% = &H4005 Global Const ND_P_POS_6% = &H4006 Global Const ND_P_POS_7% = &H4007 Global Const ND_P_NEG_0% = &H2000 Global Const ND_P_NEG_1% = &H2001 Global Const ND_P_NEG_2% = &H2002 Global Const ND_P_NEG_3% = &H2003 Global Const ND_P_NEG_4% = &H2004 Global Const ND_P_NEG_5% = &H2005 Global Const ND_P_NEG_6% = &H2006 Global Const ND_P_NEG_7% = &H2007 Global Const ND_CLEAN_UP& = 13100 Global Const ND_CLOCK_REVERSE_MODE_GR1& = 13120 Global Const ND_CLOCK_REVERSE_MODE_GR2& = 13130 Global Const ND_CONFIG_MEMORY_SIZE& = 13150 Global Const ND_CONTINUOUS& = 13160 Global Const ND_COUNT& = 13200 152 Global Const ND_COUNTER_0& = 13300 Global Const ND_COUNTER_1& = 13400 Global Const ND_COUNTER_2& = 13310 Global Const ND_COUNTER_3& = 13320 Global Const ND_COUNTER_4& = 13330 Global Const ND_COUNTER_5& = 13340 Global Const ND_COUNTER_6& = 13350 Global Const ND_COUNTER_7& = 13360 Global Const ND_COUNTER_1_SOURCE& = 13430 Global Const ND_COUNT_AVAILABLE& = 13450 Global Const ND_COUNT_DOWN& = 13465 Global Const ND_COUNT_UP& = 13485 Global Const ND_COUNT_1& = 13500 Global Const ND_COUNT_2& = 13600 Global Const ND_COUNT_3& = 13700 Global Const ND_COUNT_4& = 13800 Global Const ND_CURRENT_OUTPUT& = 40200 Global Const ND_DAC_RESOLUTION& = 13950 Global Const ND_DATA_TRANSFER_CONDITION& = 13960 Global Const ND_DATA_XFER_MODE_AI& = 14000 Global Const ND_DATA_XFER_MODE_AO_GR1& = 14100 Global Const ND_DATA_XFER_MODE_AO_GR2& = 14200 Global Const ND_DATA_XFER_MODE_DIO_GR1& = 14300 Global Const ND_DATA_XFER_MODE_DIO_GR2& = 14400 Global Const ND_DATA_XFER_MODE_DIO_GR3& = 14500 Global Const ND_DATA_XFER_MODE_DIO_GR4& = 14600 Global Const ND_DATA_XFER_MODE_DIO_GR5& = 14700 Global Const ND_DATA_XFER_MODE_DIO_GR6& = 14800 Global Const ND_DATA_XFER_MODE_DIO_GR7& = 14900 Global Const ND_DATA_XFER_MODE_DIO_GR8& = 15000 Global Const ND_DATA_XFER_MODE_GPCTR0& = 15100 Global Const ND_DATA_XFER_MODE_GPCTR1& = 15200 Global Const ND_DATA_XFER_MODE_GPCTR2& = 15110 Global Const ND_DATA_XFER_MODE_GPCTR3& = 15120 Global Const ND_DATA_XFER_MODE_GPCTR4& = 15130 Global Const ND_DATA_XFER_MODE_GPCTR5& = 15140 153 Global Const ND_DATA_XFER_MODE_GPCTR6& = 15150 Global Const ND_DATA_XFER_MODE_GPCTR7& = 15160 Global Const ND_DATA_XFER_MODE_GPCTR8& = 15165 Global Const ND_DATA_XFER_MODE_GPCTR9& = 15170 Global Const ND_DATA_XFER_MODE_GPCTR10& = 15175 Global Const ND_DATA_XFER_MODE_GPCTR11& = 15180 Global Const ND_DC& = 15250 Global Const ND_DDS_BUFFER_SIZE& = 15255 Global Const ND_DEVICE_NAME& = 15260 Global Const ND_DEVICE_POWER& = 15270 Global Const ND_DEVICE_SERIAL_NUMBER& = 15280 Global Const ND_DEVICE_STATE_DURING_SUSPEND_MODE& = 15290 Global Const ND_DEVICE_TYPE_CODE& = 15300 Global Const ND_DIGITAL_FILTER& = 15350 Global Const ND_DIGITAL_RESTART& = 15375 Global Const ND_DIO128_GET_PORT_THRESHOLD& = 41200 Global Const ND_DIO128_SELECT_INPUT_PORT& = 41100 Global Const ND_DIO128_SET_PORT_THRESHOLD& = 41300 Global Const ND_DISABLED& = 15400 Global Const ND_DISARM& = 15450 Global Const ND_DIVIDE_DOWN_SAMPLING_SUPPORTED& = 15475 Global Const ND_DMA_A_LEVEL& = 15500 Global Const ND_DMA_B_LEVEL& = 15600 Global Const ND_DMA_C_LEVEL& = 15700 Global Const ND_DONE& = 15800 Global Const ND_DONT_CARE& = 15900 Global Const ND_DONT_KNOW& = 15950 Global Const ND_EDGE_SENSITIVE& = 16000 Global Const ND_ENABLED& = 16050 Global Const ND_END& = 16055 Global Const ND_EXTERNAL& = 16060 Global Const ND_EXTERNAL_CALIBRATE& = 16100 Global Const ND_FACTORY_CALIBRATION_EQUIP& = 16210 Global Const ND_FACTORY_EEPROM_AREA& = 16220 Global Const ND_FIFO_EMPTY& = 16230 Global Const ND_FIFO_HALF_FULL_OR_LESS& = 16240 Global Const ND_FIFO_HALF_FULL_OR_LESS_UNTIL_FULL& = 16245 154 Global Const ND_FIFO_NOT_FULL& = 16250 Global Const ND_FIFO_TRANSFER_COUNT& = 16260 Global Const ND_FILTER_CORRECTION_FREQ& = 16300 Global Const ND_FOREGROUND& = 16350 Global Const ND_FREQ_OUT& = 16400 Global Const ND_FSK& = 16500 Global Const ND_EDGE_BASED_FSK& = 16500 Global Const ND_GATE& = 17100 Global Const ND_GATE_POLARITY& = 17200 Global Const ND_GPCTR0_GATE& = 17300 Global Const ND_GPCTR0_OUTPUT& = 17400 Global Const ND_GPCTR0_SOURCE& = 17500 Global Const ND_GPCTR1_GATE& = 17600 Global Const ND_GPCTR1_OUTPUT& = 17700 Global Const ND_GPCTR1_SOURCE& = 17800 Global Const ND_GPCTR2_GATE& = 17320 Global Const ND_GPCTR2_OUTPUT& = 17420 Global Const ND_GPCTR2_SOURCE& = 17520 Global Const ND_GPCTR3_GATE& = 17330 Global Const ND_GPCTR3_OUTPUT& = 17430 Global Const ND_GPCTR3_SOURCE& = 17530 Global Const ND_GPCTR4_GATE& = 17340 Global Const ND_GPCTR4_OUTPUT& = 17440 Global Const ND_GPCTR4_SOURCE& = 17540 Global Const ND_GPCTR5_GATE& = 17350 Global Const ND_GPCTR5_OUTPUT& = 17450 Global Const ND_GPCTR5_SOURCE& = 17550 Global Const ND_GPCTR6_GATE& = 17360 Global Const ND_GPCTR6_OUTPUT& = 17460 Global Const ND_GPCTR6_SOURCE& = 17660 Global Const ND_GPCTR7_GATE& = 17370 155 Global Const ND_GPCTR7_OUTPUT& = 17470 Global Const ND_GPCTR7_SOURCE& = 17570 Global Const ND_GROUND_DAC_REFERENCE& = 17900 Global Const ND_HARDWARE& = 18000 Global Const ND_HI_RES_SAMPLING& = 18020 Global Const ND_HIGH& = 18050 Global Const ND_HIGH_HYSTERESIS& = 18080 Global Const ND_HIGH_TO_LOW& = 18100 Global Const ND_HW_ANALOG_TRIGGER& = 18900 Global Const ND_IMPEDANCE& = 19000 Global Const ND_INACTIVE& = 19010 Global Const ND_INITIAL_COUNT& = 19100 Global Const ND_INIT_PLUGPLAY_DEVICES& = 19110 Global Const ND_INSIDE_REGION& = 19150 Global Const ND_INTERNAL& = 19160 Global Const ND_INTERNAL_100_KHZ& = 19200 Global Const ND_INTERNAL_10_MHZ& = 19300 Global Const ND_INTERNAL_1250_KHZ& = 19320 Global Const ND_INTERNAL_20_MHZ& = 19400 Global Const ND_INTERNAL_25_MHZ& = 19410 Global Const ND_INTERNAL_2500_KHZ& = 19420 Global Const ND_INTERNAL_5_MHZ& = 19450 Global Const ND_INTERNAL_7160_KHZ& = 19460 Global Const ND_INTERNAL_TIMER& = 19500 Global Const ND_INTERRUPTS& = 19600 Global Const ND_INTERRUPT_A_LEVEL& = 19700 Global Const ND_INTERRUPT_B_LEVEL& = 19800 Global Const ND_INTERRUPT_TRIGGER_MODE& = 19850 Global Const ND_IN_CHANNEL_CLOCK_TIMEBASE& = 19900 Global Const ND_IN_CHANNEL_CLOCK_TB_POL& = 20000 Global Const ND_IN_CONVERT& = 20100 Global Const ND_IN_CONVERT_POL& = 20200 Global Const ND_IN_DATA_FIFO_SIZE& = 20250 156 Global Const ND_IN_EXTERNAL_GATE& = 20300 Global Const ND_IN_EXTERNAL_GATE_POL& = 20400 Global Const ND_IN_SCAN_CLOCK_TIMEBASE& = 20500 Global Const ND_IN_SCAN_CLOCK_TB_POL& = 20600 Global Const ND_IN_SCAN_IN_PROG& = 20650 Global Const ND_IN_SCAN_START& = 20700 Global Const ND_IN_SCAN_START_POL& = 20800 Global Const ND_IN_START_TRIGGER& = 20900 Global Const ND_IN_START_TRIGGER_POL& = 21000 Global Const ND_IN_STOP_TRIGGER& = 21100 Global Const ND_IN_STOP_TRIGGER_POL& = 21200 Global Const ND_INT_AI_GND& = 21210 Global Const ND_INT_AO_CH_0& = 21230 Global Const ND_INT_AO_CH_0_VS_REF_5V& = 21235 Global Const ND_INT_AO_CH_1& = 21240 Global Const ND_INT_AO_CH_1_VS_AO_CH_0& = 21245 Global Const ND_INT_AO_CH_1_VS_REF_5V& = 21250 Global Const ND_INT_AO_CH_2& = 21220 Global Const ND_INT_AO_CH_3& = 21221 Global Const ND_INT_AO_CH_4& = 21222 Global Const ND_INT_AO_CH_5& = 21223 Global Const ND_INT_AO_CH_6& = 21224 Global Const ND_INT_AO_CH_7& = 21225 Global Const ND_INT_AO_GND& = 21260 Global Const ND_INT_AO_GND_VS_AI_GND& = 21265 Global Const ND_INT_CM_REF_5V& = 21270 Global Const ND_INT_DEV_TEMP& = 21280 Global Const ND_INT_REF_5V& = 21290 Global Const ND_INT_REF_EXTERN& = 21296 Global Const ND_INT_CAL_BUS& = 21295 Global Const ND_INT_MUX_BUS& = 21305 Global Const ND_INT_AI_GND_AMP_0& = 21211 Global Const ND_INT_AI_GND_AMP_1& = 21212 Global Const ND_INT_AI_GND_AMP_2& = 21213 Global Const ND_INT_AI_GND_AMP_3& = 21214 Global Const ND_INT_AI_GND_AMP_4& = 21215 Global Const ND_INT_AI_GND_AMP_5& = 21216 Global Const ND_INT_AI_GND_AMP_6& = 21217 Global Const ND_INT_AI_GND_AMP_7& = 21218 157 Global Const ND_INT_AO_CH_0_AMP_0& = 21231 Global Const ND_INT_AO_CH_0_AMP_1& = 21232 Global Const ND_INT_AO_CH_0_AMP_2& = 21233 Global Const ND_INT_AO_CH_0_AMP_3& = 21234 Global Const ND_INT_AO_CH_1_AMP_0& = 21241 Global Const ND_INT_AO_CH_1_AMP_1& = 21242 Global Const ND_INT_AO_CH_1_AMP_2& = 21243 Global Const ND_INT_AO_CH_1_AMP_3& = 21244 Global Const ND_INT_AO_CH_0_VS_REF_AMP_0& = 21236 Global Const ND_INT_AO_CH_0_VS_REF_AMP_1& = 21237 Global Const ND_INT_AO_CH_0_VS_REF_AMP_2& = 21238 Global Const ND_INT_AO_CH_0_VS_REF_AMP_3& = 21239 Global Const ND_INT_AO_CH_1_VS_REF_AMP_0& = 21251 Global Const ND_INT_AO_CH_1_VS_REF_AMP_1& = 21252 Global Const ND_INT_AO_CH_1_VS_REF_AMP_2& = 21253 Global Const ND_INT_AO_CH_1_VS_REF_AMP_3& = 21254 Global Const ND_INT_AO_GND_VS_AI_GND_AMP_0& = 21266 Global Const ND_INT_AO_GND_VS_AI_GND_AMP_1& = 21267 Global Const ND_INT_AO_GND_VS_AI_GND_AMP_2& = 21268 Global Const ND_INT_AO_GND_VS_AI_GND_AMP_3& = 21269 Global Const ND_INT_CM_REF_AMP_0& = 21271 Global Const ND_INT_CM_REF_AMP_1& = 21272 Global Const ND_INT_CM_REF_AMP_2& = 21273 Global Const ND_INT_CM_REF_AMP_3& = 21274 Global Const ND_INT_REF_AMP_0& = 21291 Global Const ND_INT_REF_AMP_1& = 21292 Global Const ND_INT_REF_AMP_2& = 21293 Global Const ND_INT_REF_AMP_3& = 21294 Global Const ND_INT_REF_AMP_4& = 21301 Global Const ND_INT_REF_AMP_5& = 21302 Global Const ND_INT_REF_AMP_6& = 21303 Global Const ND_INT_REF_AMP_7& = 21304 Global Const ND_ROUTE_INT_REFERENCE& = 21299 Global Const ND_INTERRUPT_EVERY_SAMPLE& = 11700 Global Const ND_INTERRUPT_HALF_FIFO& = 11800 Global Const ND_IO_CONNECTOR& = 21300 Global Const ND_LEVEL_A& = 21410 158 Global Const ND_LEVEL_B& = 21420 Global Const ND_LEVEL_SENSITIVE& = 24000 Global Const ND_LINK_COMPLETE_INTERRUPTS& = 24010 Global Const ND_LOW& = 24050 Global Const ND_LOW_HYSTERESIS& = 24080 Global Const ND_LOW_TO_HIGH& = 24100 Global Const ND_LPT_DEVICE_MODE& = 24200 Global Const ND_MARKER& = 24500 Global Const ND_MARKER_QUANTUM& = 24550 Global Const ND_MAX_ARB_SEQUENCE_LENGTH& = 24600 Global Const ND_MAX_FUNC_SEQUENCE_LENGTH& = 24610 Global Const ND_MAX_LOOP_COUNT& = 24620 Global Const ND_MAX_NUM_WAVEFORMS& = 24630 Global Const ND_MAX_SAMPLE_RATE& = 24640 Global Const ND_MAX_WFM_SIZE& = 24650 Global Const ND_MEMORY_TRANSFER_WIDTH& = 24700 Global Const ND_MIN_SAMPLE_RATE& = 24800 Global Const ND_MIN_WFM_SIZE& = 24810 Global Const ND_NEGATIVE& = 26100 Global Const ND_NEW& = 26190 Global Const ND_NI_DAQ_SW_AREA& = 26195 Global Const ND_NO& = 26200 Global Const ND_NO_STRAIN_GAUGE& = 26225 Global Const ND_NO_TRACK_AND_HOLD& = 26250 Global Const ND_NONE& = 26300 Global Const ND_NOT_APPLICABLE& = 26400 Global Const ND_NUMBER_DIG_PORTS& = 26500 Global Const ND_OFF& = 27010 Global Const ND_OFFSET& = 27020 Global Const ND_ON& = 27050 Global Const ND_OTHER& = 27060 Global Const ND_OTHER_GPCTR_OUTPUT& = 27300 Global Const ND_OTHER_GPCTR_TC& = 27400 Global Const ND_OUTSIDE_LEVEL_A_LEVEL_B& = 27065 Global Const ND_OUT_DATA_FIFO_SIZE& = 27070 Global Const ND_OUT_EXTERNAL_GATE& = 27080 Global Const ND_OUT_EXTERNAL_GATE_POL& = 27082 159 Global Const ND_OUT_START_TRIGGER& = 27100 Global Const ND_OUT_START_TRIGGER_POL& = 27102 Global Const ND_OUT_UPDATE& = 27200 Global Const ND_OUT_UPDATE_POL& = 27202 Global Const ND_OUT_UPDATE_CLOCK_TIMEBASE& = 27210 Global Const ND_OUT_UPDATE_CLOCK_TB_POL& = 27212 Global Const ND_OUTPUT_ENABLE& = 27220 Global Const ND_OUTPUT_MODE& = 27230 Global Const ND_OUTPUT_POLARITY& = 27240 Global Const ND_OUTPUT_STATE& = 27250 Global Const ND_OUTPUT_TYPE& = 40000 Global Const ND_DIGITAL_PATTERN_GENERATION& = 28030 Global Const ND_PAUSE& = 28040 Global Const ND_PAUSE_ON_HIGH& = 28045 Global Const ND_PAUSE_ON_LOW& = 28050 Global Const ND_PFI_0& = 28100 Global Const ND_PFI_1& = 28200 Global Const ND_PFI_2& = 28300 Global Const ND_PFI_3& = 28400 Global Const ND_PFI_4& = 28500 Global Const ND_PFI_5& = 28600 Global Const ND_PFI_6& = 28700 Global Const ND_PFI_7& = 28800 Global Const ND_PFI_8& = 28900 Global Const ND_PFI_9& = 29000 Global Const ND_PFI_10& = 50280 Global Const ND_PFI_11& = 50290 Global Const ND_PFI_12& = 50300 Global Const ND_PFI_13& = 50310 Global Const ND_PFI_14& = 50320 Global Const ND_PFI_15& = 50330 Global Const ND_PFI_16& = 50340 Global Const ND_PFI_17& = 50350 Global Const ND_PFI_18& = 50360 Global Const ND_PFI_19& = 50370 Global Const ND_PFI_20& = 50380 Global Const ND_PFI_21& = 50390 Global Const ND_PFI_22& = 50400 Global Const ND_PFI_23& = 50410 160 Global Const ND_PFI_24& = 50420 Global Const ND_PFI_25& = 50430 Global Const ND_PFI_26& = 50440 Global Const ND_PFI_27& = 50450 Global Const ND_PFI_28& = 50460 Global Const ND_PFI_29& = 50470 Global Const ND_PFI_30& = 50480 Global Const ND_PFI_31& = 50490 Global Const ND_PFI_32& = 50500 Global Const ND_PFI_33& = 50510 Global Const ND_PFI_34& = 50520 Global Const ND_PFI_35& = 50530 Global Const ND_PFI_36& = 50540 Global Const ND_PFI_37& = 50550 Global Const ND_PFI_38& = 50560 Global Const ND_PFI_39& = 50570 Global Const ND_PLL_REF_FREQ& = 29010 Global Const ND_PLL_REF_SOURCE& = 29020 Global Const ND_PRE_ARM& = 29050 Global Const ND_POSITIVE& = 29100 Global Const ND_PREPARE& = 29200 Global Const ND_PROGRAM& = 29300 Global Const ND_PULSE& = 29350 Global Const ND_PULSE_SOURCE& = 29500 Global Const ND_PULSE_TRAIN_GNR& = 29600 Global Const ND_PXI_BACKPLANE_CLOCK& = 29900 Global Const ND_REGLITCH& = 31000 Global Const ND_RESERVED& = 31100 Global Const ND_RESET& = 31200 Global Const ND_RESUME& = 31250 Global Const ND_RETRIG_PULSE_GNR& = 31300 Global Const ND_REVISION& = 31350 Global Const ND_RTSI_0& = 31400 Global Const ND_RTSI_1& = 31500 Global Const ND_RTSI_2& = 31600 Global Const ND_RTSI_3& = 31700 Global Const ND_RTSI_4& = 31800 Global Const ND_RTSI_5& = 31900 161 Global Const ND_RTSI_6& = 32000 Global Const ND_RTSI_CLOCK& = 32100 Global Const ND_PXI_STAR& = 32200 Global Const ND_PXI_STAR_3& = 32210 Global Const ND_PXI_STAR_4& = 32220 Global Const ND_PXI_STAR_5& = 32230 Global Const ND_PXI_STAR_6& = 32240 Global Const ND_PXI_STAR_7& = 32250 Global Const ND_PXI_STAR_8& = 32260 Global Const ND_PXI_STAR_9& = 32270 Global Const ND_PXI_STAR_10& = 32280 Global Const ND_PXI_STAR_11& = 32290 Global Const ND_PXI_STAR_12& = 32300 Global Const ND_PXI_STAR_13& = 32310 Global Const ND_PXI_STAR_14& = 32320 Global Const ND_PXI_STAR_15& = 32330 Global Const ND_SCANCLK& = 32400 Global Const ND_SCANCLK_LINE& = 32420 Global Const ND_SC_2040_MODE& = 32500 Global Const ND_SC_2043_MODE& = 32600 Global Const ND_SELF_CALIBRATE& = 32700 Global Const ND_SET_DEFAULT_LOAD_AREA& = 32800 Global Const ND_RESTORE_FACTORY_CALIBRATION& = 32810 Global Const ND_SET_POWERUP_STATE& = 42100 Global Const ND_SIGNAL_CONDITIONING_SPEC& = 32900 Global Const ND_SIMPLE_EVENT_CNT& = 33100 Global Const ND_SINGLE& = 33150 Global Const ND_SINGLE_PERIOD_MSR& = 33200 Global Const ND_SINGLE_PULSE_GNR& = 33300 Global Const ND_SINGLE_PULSE_WIDTH_MSR& = 33400 Global Const ND_SINGLE_TRIG_PULSE_GNR& = 33500 Global Const ND_SOURCE& = 33700 Global Const ND_SOURCE_POLARITY& = 33800 Global Const ND_STABLE_10_MHZ& = 33810 Global Const ND_STEPPED& = 33825 Global Const ND_STRAIN_GAUGE& = 33850 Global Const ND_STRAIN_GAUGE_EX0& = 33875 Global Const ND_SUB_REVISION& = 33900 Global Const ND_SYNC_DUTY_CYCLE_HIGH& = 33930 162 Global Const ND_SYNC_OUT& = 33970 Global Const ND_TC_REACHED& = 34100 Global Const ND_THE_AI_CHANNEL& = 34400 Global Const ND_TOGGLE& = 34700 Global Const ND_TOGGLE_GATE& = 34800 Global Const ND_TRACK_AND_HOLD& = 34850 Global Const ND_TRIG_PULSE_WIDTH_MSR& = 34900 Global Const ND_TRIGGER_SOURCE& = 34930 Global Const ND_TRIGGER_MODE& = 34970 Global Const ND_UI2_TC& = 35100 Global Const ND_UP_DOWN& = 35150 Global Const ND_UP_TO_1_DMA_CHANNEL& = 35200 Global Const ND_UP_TO_2_DMA_CHANNELS& = 35300 Global Const ND_USE_CAL_CHAN& = 36000 Global Const ND_USE_AUX_CHAN& = 36100 Global Const ND_USER_EEPROM_AREA& = 37000 Global Const ND_USER_EEPROM_AREA_2& = 37010 Global Const ND_USER_EEPROM_AREA_3& = 37020 Global Const ND_USER_EEPROM_AREA_4& = 37030 Global Const ND_USER_EEPROM_AREA_5& = 37040 Global Const ND_DSA_RTSI_CLOCK_AD& = 44000 Global Const ND_DSA_RTSI_CLOCK_DA& = 44010 Global Const ND_DSA_OUTPUT_TRIGGER& = 44020 Global Const ND_DSA_INPUT_TRIGGER& = 44030 Global Const ND_DSA_SHARC_TRIGGER& = 44040 Global Const ND_DSA_ANALOG_TRIGGER& = 44050 Global Const ND_DSA_HOST_TRIGGER& = 44060 Global Const ND_DSA_EXTERNAL_DIGITAL_TRIGGER& = 44070 Global Const ND_DSA_EXCITATION& = 44080 Global Const ND_VOLTAGE_OUTPUT& = 40100 Global Const ND_VOLTAGE_REFERENCE& = 38000 Global Const ND_VXI_SC% = &H2000 Global Const ND_PXI_SC% = &H2010 Global Const ND_WALRUS_SCXI_HV_BACKPLANE% = &H2011 Global Const ND_WALRUS_SCXI_LV_BACKPLANE% = &H2012 163 Global Const ND_VXIMIO_SET_ALLOCATE_MODE& = 43100 Global Const ND_VXIMIO_USE_ONBOARD_MEMORY_AI& = 43500 Global Const ND_VXIMIO_USE_ONBOARD_MEMORY_AO& = 43600 Global Const ND_VXIMIO_USE_ONBOARD_MEMORY_GPCTR& = 43700 Global Const ND_VXIMIO_USE_PC_MEMORY_AI& = 43200 Global Const ND_VXIMIO_USE_PC_MEMORY_AO& = 43300 Global Const ND_VXIMIO_USE_PC_MEMORY_GPCTR& = 43400 Global Const ND_WFM_QUANTUM& = 45000 Global Const ND_YES& = 39100 Global Const ND_3V_LEVEL& = 43450 Global Const ND_WRITE_MARK& = 50000 Global Const ND_READ_MARK& = 50010 Global Const ND_BUFFER_START& = 50020 Global Const ND_TRIGGER_POINT& = 50025 Global Const ND_BUFFER_MODE& = 50030 Global Const ND_DOUBLE& = 50050 Global Const ND_QUADRATURE_ENCODER_X1& = 50070 Global Const ND_QUADRATURE_ENCODER_X2& = 50080 Global Const ND_QUADRATURE_ENCODER_X4& = 50090 Global Const ND_TWO_PULSE_COUNTING& = 50100 Global Const ND_LINE_FILTER& = 50110 Global Const ND_SYNCHRONIZATION& = 50120 Global Const ND_5_MICROSECONDS& = 50130 Global Const ND_1_MICROSECOND& = 50140 Global Const ND_500_NANOSECONDS& = 50150 Global Const ND_100_NANOSECONDS& = 50160 Global Const ND_1_MILLISECOND& = 50170 Global Const ND_10_MILLISECONDS& = 50180 Global Const ND_100_MILLISECONDS& = 50190 Global Const ND_OTHER_GPCTR_SOURCE& = 50580 Global Const ND_OTHER_GPCTR_GATE& = 50590 Global Const ND_AUX_LINE& = 50600 Global Const ND_AUX_LINE_POLARITY& = 50610 Global Const ND_TWO_SIGNAL_EDGE_SEPARATION_MSR& = 50630 Global Const ND_BUFFERED_TWO_SIGNAL_EDGE_SEPARATION_MSR& = 50640 164 Global Const ND_SWITCH_CYCLE& = 50650 Global Const ND_INTERNAL_MAX_TIMEBASE& = 50660 Global Const ND_PRESCALE_VALUE& = 50670 Global Const ND_MAX_PRESCALE& = 50690 Global Const ND_INTERNAL_LINE_0& = 50710 Global Const ND_INTERNAL_LINE_1& = 50720 Global Const ND_INTERNAL_LINE_2& = 50730 Global Const ND_INTERNAL_LINE_3& = 50740 Global Const ND_INTERNAL_LINE_4& = 50750 Global Const ND_INTERNAL_LINE_5& = 50760 Global Const ND_INTERNAL_LINE_6& = 50770 Global Const ND_INTERNAL_LINE_7& = 50780 Global Const ND_INTERNAL_LINE_8& = 50790 Global Const ND_INTERNAL_LINE_9& = 50800 Global Const ND_INTERNAL_LINE_10& = 50810 Global Const ND_INTERNAL_LINE_11& = 50820 Global Const ND_INTERNAL_LINE_12& = 50830 Global Const ND_INTERNAL_LINE_13& = 50840 Global Const ND_INTERNAL_LINE_14& = 50850 Global Const ND_INTERNAL_LINE_15& = 50860 Global Const ND_INTERNAL_LINE_16& = 50862 Global Const ND_INTERNAL_LINE_17& = 50864 Global Const ND_INTERNAL_LINE_18& = 50866 Global Const ND_INTERNAL_LINE_19& = 50868 Global Const ND_INTERNAL_LINE_20& = 50870 Global Const ND_INTERNAL_LINE_21& = 50872 Global Const ND_INTERNAL_LINE_22& = 50874 Global Const ND_INTERNAL_LINE_23& = 50876 Global Const ND_START_TRIGGER& = 51150 Global Const ND_START_TRIGGER_POLARITY& = 51151 Global Const ND_COUNTING_SYNCHRONOUS& = 51200 Global Const ND_SYNCHRONOUS& = 51210 165 Global Const ND_ASYNCHRONOUS& = 51220 Global Const ND_CONFIGURABLE_FILTER& = 51230 Global Const ND_ENCODER_TYPE& = 51240 Global Const ND_Z_INDEX_ACTIVE& = 51250 Global Const ND_Z_INDEX_VALUE& = 51260 Global Const ND_SNAPSHOT& = 51270 Global Const ND_POSITION_MSR& = 51280 Global Const ND_BUFFERED_POSITION_MSR& = 51290 Global Const ND_SAVED_COUNT& = 51300 Global Const ND_READ_MARK_H_SNAPSHOT& = 51310 Global Const ND_READ_MARK_L_SNAPSHOT& = 51320 Global Const ND_WRITE_MARK_H_SNAPSHOT& = 51330 Global Const ND_WRITE_MARK_L_SNAPSHOT& = 51340 Global Const ND_BACKLOG_H_SNAPSHOT& = 51350 Global Const ND_BACKLOG_L_SNAPSHOT& = 51360 Global Const ND_ARMED_SNAPSHOT& = 51370 Global Const ND_EDGE_GATED_FSK& = 51371 Global Const ND_SIMPLE_GATED_EVENT_CNT& = 51372 Global Const ND_VIDEO_TYPE& = 51380 Global Const ND_PAL_B& = 51390 Global Const ND_PAL_G& = 51400 Global Const ND_PAL_H& = 51410 Global Const ND_PAL_I& = 51420 Global Const ND_PAL_D& = 51430 Global Const ND_PAL_N& = 51440 Global Const ND_PAL_M& = 51450 Global Const ND_NTSC_M& = 51460 Global Const ND_COUNTER_TYPE& = 51470 Global Const ND_NI_TIO& = 51480 Global Const ND_AM9513& = 51490 Global Const ND_STC& = 51500 Global Const ND_8253& = 51510 Global Const ND_A_HIGH_B_HIGH& = 51520 Global Const ND_A_HIGH_B_LOW& = 51530 Global Const ND_A_LOW_B_HIGH& = 51540 Global Const ND_A_LOW_B_LOW& = 51550 Global Const ND_Z_INDEX_RELOAD_PHASE& = 51560 Global Const ND_UPDOWN_LINE& = 51570 Global Const ND_DEFAULT& = 51575 166 Global Const ND_DEFAULT_PFI_LINE& = 51580 Global Const ND_BUFFER_SIZE& = 51590 Global Const ND_ELEMENT_SIZE& = 51600 Global Const ND_NUMBER_GP_COUNTERS& = 51610 Global Const ND_BUFFERED_TIME_STAMPING& = 51620 Global Const ND_TIME_0_DATA_32& = 51630 Global Const ND_TIME_8_DATA_24& = 51640 Global Const ND_TIME_16_DATA_16& = 51650 Global Const ND_TIME_24_DATA_8& = 51660 Global Const ND_TIME_32_DATA_32& = 51670 Global Const ND_TIME_48_DATA_16& = 51680 Global Const ND_ABSOLUTE& = 51690 Global Const ND_RELATIVE& = 51700 Global Const ND_TIME_DATA_SIZE& = 51710 Global Const ND_TIME_FORMAT& = 51720 Global Const ND_HALT_ON_OVERFLOW& = 51730 Global Const ND_OVERLAY_RTSI_ON_PFI_LINES& = 51740 Global Const ND_STOP_TRIGGER& = 51750 Global Const ND_TS_INPUT_MODE& = 51760 Global Const ND_BOTH_EDGES& = 51770 Global Const ND_CLOCK_0& = 51780 Global Const ND_CLOCK_1& = 51790 Global Const ND_CLOCK_2& = 51800 Global Const ND_CLOCK_3& = 51810 Global Const ND_SYNCHRONIZATION_LINE& = 51820 Global Const ND_TRANSFER_METHOD& = 51830 Global Const ND_SECONDS& = 51840 Global Const ND_PRECISION& = 51850 Global Const ND_NANO_SECONDS& = 51860 Global Const ND_SYNCHRONIZATION_METHOD& = 51870 Global Const ND_PULSE_PER_SECOND& = 51880 Global Const ND_IRIG_B& = 51890 Global Const ND_SIMPLE_TIME_MSR& = 51900 Global Const ND_SINGLE_TIME_MSR& = 51910 Global Const ND_BUFFERED_TIME_MSR& = 51920 Global Const ND_DMA& = 51930 Global Const ND_INTERNAL_SYNCHRONIZATION& = 51940 Global Const ND_INITIAL_SECONDS& = 51950 Global Const ND_INITIAL_SECONDS_ENABLE& = 51951 167 Global Const ND_EXTERNAL_CALIBRATION& = 51990 Global Const ND_INTERNAL_CALIBRATION& = 51200 Global Const ND_ABORT_CALIBRATION& = 51210 Global Const ND_STORE_CALIBRATION& = 51220 Global Const ND_MEASUREMENT_MODE& = 51230 Global Const ND_CURRENT& = 51240 Global Const ND_FREQUENCY& = 52250 Global Const ND_VOLTAGE& = 52260 Global Const ND_OHMS& = 52270 Global Const ND_EXCITATION_CURRENT& = 52280 Global Const ND_FREQ_STARTING_EDGE& = 52290 Global Const ND_FREQ_TRIG_LOW& = 52300 Global Const ND_FREQ_TRIG_HIGH& = 52310 Global Const ND_FREQ_NUM_OF_CYCLES& = 52320 Global Const ND_FREQ_TIME_BASE& = 52330 Global Const ND_FREQ_LOW_LIMIT& = 52340 Global Const ND_AVERAGING_NUM_OF_SAMPLES& = 52350 Global Const ND_AVERAGING_FREQUENCY& = 52360 Global Const ND_OFFSET_COMP_MODE& = 52370 Global Const ND_DIGITAL_LINE& = 52380 Global Const ND_DIGITAL_PORT& = 52390 Global Const ND_GPCTR0_UP_DOWN& = 52400 Global Const ND_GPCTR1_UP_DOWN& = 52410 Global Const ND_DIGITAL_LINE_0& = 52420 Global Const ND_DIGITAL_LINE_1& = 52430 Global Const ND_DIGITAL_LINE_2& = 52440 Global Const ND_DIGITAL_LINE_3& = 52450 Global Const ND_DIGITAL_LINE_4& = 52460 Global Const ND_DIGITAL_LINE_5& = 52470 Global Const ND_DIGITAL_LINE_6& = 52480 Global Const ND_DIGITAL_LINE_7& = 52490 Global Const ND_SCARAB_A_MEMORY_SIZE& = 52510 Global Const ND_SCARAB_B_MEMORY_SIZE& = 52520 Global Const ND_PATTERN_GENERATION_LOOP_ENABLE& = 52530 Global Const ND_MEASUREMENT_TYPE& = 52540 Global Const ND_DIFFERENTIAL& = 52550 168 Global Const ND_NRSE& = 52560 Global Const ND_4WIRE& = 52570 Global Const ND_READ_MARK_H_SNAPSHOT_GR1& = 52580 Global Const ND_READ_MARK_L_SNAPSHOT_GR1& = 52590 Global Const ND_READ_MARK_H_SNAPSHOT_GR2& = 52600 Global Const ND_READ_MARK_L_SNAPSHOT_GR2& = 52610 Global Const ND_WRITE_MARK_H_SNAPSHOT_GR1& = 52620 Global Const ND_WRITE_MARK_L_SNAPSHOT_GR1& = 52630 Global Const ND_WRITE_MARK_H_SNAPSHOT_GR2& = 52640 Global Const ND_WRITE_MARK_L_SNAPSHOT_GR2& = 52650 Global Const ND_PARAM_SCXI_SETTLING_TIME& = 52710 Global Const ND_PARAM_USER_DEFINED_SETTLING_TIME& = 52720 Global Const ND_PARAM_SCXI_SCAN_INFO& = 52730 Global Const ND_PARAM_SCXI_MODULE_CODE& = 52740 Global Const ND_PARAM_SCXI_DUMMY& = 52750 Global Const ND_PARAM_CHANNEL_NAME& = 52760 Global Const ND_PARAM_TASKID& = 52770 Global Const ND_PARAM_CJC& = 52780 Global Const ND_PARAM_CHANNEL_CLOCK_TIMEBASE& = 52790 Global Const ND_PARAM_CHANNEL_CLOCK_INTERVAL& = 52800 Global Const ND_PARAM_CHANNEL_CLOCK_FREQUENCY& = 52810 Global Const ND_PARAM_CHANNEL_CLOCK_SOURCE& = 52820 Global Const ND_PARAM_CHANNEL_CLOCK_DEFAULT& = 52830 Global Const ND_PARAM_SCAN_CLOCK_TIMEBASE& = 52840 Global Const ND_PARAM_SCAN_CLOCK_INTERVAL& = 52850 Global Const ND_PARAM_SCAN_CLOCK_FREQUENCY& = 52860 Global Const ND_PARAM_SCAN_CLOCK_SOURCE& = 52870 Global Const ND_PARAM_SCAN_CLOCK_DEFAULT& = 52880 Global Const ND_PARAM_NUM_CHANNELS& = 52890 3.2.7. Módulo de errores de la API de Adquisición de Datos (nidaqerr.inc) '*********************************************************************' '* nidaqerr.inc *' '* *' header file for platform-independent ni-daq errors/warnings '* *' '* NOTE: *' '* You should use symbols defined here in your programs; '* use the numerical values. do not *' *' '* *' 169 '* Warnings are returned as positive numbers. For example *' '* overWriteError may be returned as a warning and its value *' '* would be -(overWriteError). *' '* *' '* THIS FILE IS AUTOMATICALLY GENERATED FROM A DATABASE: DO NOT EDIT *' '* *' '*********************************************************************' Global Const noError = 0 Global Const syntaxError = -10001 ' An error was detected in the input string; the arrangement or ordering ... Global Const semanticsError = -10002 ' An error was detected in the input string; the syntax of the string is ... Global Const invalidValueError = -10003 numeric parameter is invalid. ' The value of a Global Const valueConflictError = -10004 ' The value of a numeric parameter is inconsistent with another one, and ... Global Const badDeviceError = -10005 invalid. ' The device is Global Const badLineError = -10006 invalid. ' The line is Global Const badChanError = -10007 ' A channel, port, or counter is out of range for the device type or device ... Global Const badGroupError = -10008 invalid. ' The group is Global Const badCounterError = -10009 invalid. ' The counter is Global Const badCountError = -10010 ' The count is too small or too large for the specified counter, or the ... Global Const badIntervalError = -10011 ' The analog input scan rate is too fast for the number of channels and ... Global Const badRangeError = -10012 ' The analog input or analog output voltage or current range is invalid ... Global Const badErrorCodeError = -10013 returned an unrecognized or unlisted error code. ' The driver Global Const groupTooLargeError = -10014 is too large for the board. ' The group size Global Const badTimeLimitError = -10015 is invalid. ' The time limit Global Const badReadCountError = -10016 is invalid. ' The read count Global Const badReadModeError = -10017 invalid. ' The read mode is Global Const badReadOffsetError = -10018 unreachable. ' The offset is 170 Global Const badClkFrequencyError = -10019 invalid. ' The frequency is Global Const badTimebaseError = -10020 invalid. ' The timebase is Global Const badLimitsError = -10021 beyond the range of the board. ' The limits are Global Const badWriteCountError = -10022 ' Your data array contains an incomplete update, or you are trying to write ... Global Const badWriteModeError = -10023 is out of range or is disallowed. ' The write mode Global Const badWriteOffsetError = -10024 ' Adding the write offset to the write mark places the write mark outside ... Global Const limitsOutOfRangeError = -10025 ' The requested input limits exceed the board's capability or configuration. ... Global Const badBufferSpecificationError = -10026 ' The requested number of buffers or the buffer size is not allowed. For ... Global Const badDAQEventError = -10027 ' For DAQEvents 0 and 1 general value A must be greater than 0 and less ... Global Const badFilterCutoffError = -10028 frequency specified is not valid for this device. ' The cutoff Global Const obsoleteFunctionError = -10029 ' The function you are calling is no longer supported in this version of ... Global Const badBaudRateError = -10030 ' The specified baud rate for communicating with the serial port is not ... Global Const badChassisIDError = -10031 ' The specified baud rate for communicating with the serial port is not ... Global Const badModuleSlotError = -10032 ' The SCXI module slot that was specified is invalid or corresponds to an ... Global Const invalidWinHandleError = -10033 handle passed to the function is invalid. ' The window Global Const noSuchMessageError = -10034 message matches the one you tried to delete. ' No configured Global Const irrelevantAttributeError = -10035 attribute is not relevant. ' The specified Global Const badYearError = -10036 year is invalid. ' The specified Global Const badMonthError = -10037 month is invalid. ' The specified Global Const badDayError = -10038 day is invalid. ' The specified Global Const stringTooLongError = -10039 ' The specified input string is too long. For instance, DAQScope 5102 devices ... Global Const badGroupSizeError = -10040 is invalid. ' The group size Global Const badTaskIDError = -10041 ' The specified task ID is invalid. For instance, you may have connected ... Global Const inappropriateControlCodeError = -10042 ' The specified control code is inappropriate for the current configuration ... 171 Global Const badDivisorError = -10043 divisor is invalid. ' The specified Global Const badPolarityError = -10044 polarity is invalid. ' The specified Global Const badInputModeError = -10045 input mode is invalid. ' The specified Global Const badExcitationError = -10046 value specified is not valid for this device. ' The excitation Global Const badConnectionTypeError = -10047 value specified is not valid for this device. ' The excitation Global Const badExcitationTypeError = -10048 type specified is not valid for this device. ' The excitation Global Const badChanListError = -10050 ' There is more than one channel name in the channel list that corresponds ... Global Const badTrigSkipCountError = -10079 count is invalid. ' The trigger skip Global Const badGainError = -10080 adjust is invalid. ' The gain or gain Global Const badPretrigCountError = -10081 sample count is invalid. ' The pretrigger Global Const badPosttrigCountError = -10082 sample count is invalid. ' The posttrigger Global Const badTrigModeError = -10083 is invalid. ' The trigger mode Global Const badTrigCountError = -10084 count is invalid. ' The trigger Global Const badTrigRangeError = -10085 range or trigger hysteresis window is invalid. ' The trigger Global Const badExtRefError = -10086 reference is invalid. ' The external Global Const badTrigTypeError = -10087 is invalid. ' The trigger type Global Const badTrigLevelError = -10088 level is invalid. ' The trigger Global Const badTotalCountError = -10089 ' The total count is inconsistent with the buffer size and pretrigger scan ... Global Const badRPGError = -10090 ' The individual range, polarity, and gain settings are valid but the combination ... Global Const badIterationsError = -10091 ' You have attempted to use an invalid setting for the iterations parameter. ... Global Const lowScanIntervalError = -10092 ' Some devices require a time gap between the last sample in a scan and ... Global Const fifoModeError = -10093 ' FIFO mode waveform generation cannot be used because at least one condition ... Global Const badCalDACconstError = -10094 constant passed to the function is invalid. ' The calDAC Global Const badCalStimulusError = -10095 stimulus passed to the function is invalid. ' The calibration 172 Global Const badCalibrationConstantError = -10096 calibration constant is invalid. ' The specified Global Const badCalOpError = -10097 calibration operation is invalid. ' The specified Global Const badCalConstAreaError = -10098 ' The specified calibration constant area is invalid. For instance, the ... Global Const badPortWidthError = -10100 ' The requested digital port width is not a multiple of the hardware port ... Global Const gpctrBadApplicationError = -10120 application used. ' Invalid Global Const gpctrBadCtrNumberError = -10121 counterNumber used. ' Invalid Global Const gpctrBadParamValueError = -10122 paramValue used. ' Invalid Global Const gpctrBadParamIDError = -10123 used. ' Invalid paramID Global Const gpctrBadEntityIDError = -10124 used. ' Invalid entityID Global Const gpctrBadActionError = -10125 used. ' Invalid action Global Const gpctrSourceSelectError = -10126 selected. ' Invalid source Global Const badCountDirError = -10127 ' The specified counter does not support the specified count direction. Global Const badGateOptionError = -10128 gating option is invalid. ' The specified Global Const badGateModeError = -10129 gate mode is invalid. ' The specified Global Const badGateSourceError = -10130 gate source is invalid. ' The specified Global Const badGateSignalError = -10131 gate signal is invalid. ' The specified Global Const badSourceEdgeError = -10132 source edge is invalid. ' The specified Global Const badOutputTypeError = -10133 output type is invalid. ' The specified Global Const badOutputPolarityError = -10134 output polarity is invalid. ' The specified Global Const badPulseModeError = -10135 pulse mode is invalid. ' The specified Global Const badDutyCycleError = -10136 duty cycle is invalid. ' The specified Global Const badPulsePeriodError = -10137 pulse period is invalid. ' The specified Global Const badPulseDelayError = -10138 pulse delay is invalid. ' The specified Global Const badPulseWidthError = -10139 pulse width is invalid. ' The specified 173 Global Const badFOUTportError = -10140 frequency output (FOUT or FREQ_OUT) port is invalid. ' The specified Global Const badAutoIncrementModeError = -10141 autoincrement mode is invalid. ' The specified Global Const CfgInvalidatedSysCalError = -10150 ' Hardware configuration has changed since last system calibration Global Const sysCalOutofDateError = -10151 calibration is out of date ' system Global Const badNotchFilterError = -10180 notch filter is invalid. ' The specified Global Const badMeasModeError = -10181 measurement mode is invalid. ' The specified Global Const EEPROMreadError = -10200 data from EEPROM. ' Unable to read Global Const EEPROMwriteError = -10201 data to EEPROM. ' Unable to write Global Const EEPROMwriteProtectionError = -10202 ' You cannot write into this location or area of your EEPROM because it ... Global Const EEPROMinvalidLocationError = -10203 EEPROM location is invalid. ' The specified Global Const EEPROMinvalidPasswordError = -10204 accessing the EEPROM is incorrect. ' The password for Global Const noDriverError = -10240 interface could not locate or open the driver.. ' The driver Global Const oldDriverError = -10241 ' One of the driver files or the configuration utility is out of date, or ... Global Const functionNotFoundError = -10242 function is not located in the driver. ' The specified Global Const configFileError = -10243 ' The driver could not locate or open the configuration file, or the format ... Global Const deviceInitError = -10244 ' The driver encountered a hardware-initialization error while attempting ... Global Const osInitError = -10245 ' The driver encountered an operating-system error while attempting to perform ... Global Const communicationsError = -10246 ' The driver encountered an operating-system error while attempting to perform ... Global Const cmosConfigError = -10247 ' The CMOS configuration-memory for the device is empty or invalid, or the ... Global Const dupAddressError = -10248 ' The base addresses for two or more devices are the same; consequently, ... Global Const intConfigError = -10249 ' The interrupt configuration is incorrect given the capabilities of the ... Global Const dupIntError = -10250 levels for two or more devices are the same. ' The interrupt Global Const dmaConfigError = -10251 ' The DMA configuration is incorrect given the capabilities of the computer/DMA ... Global Const dupDMAError = -10252 for two or more devices are the same. ' The DMA channels 174 Global Const jumperlessBoardError = -10253 ' Unable to find one or more jumperless boards you have configured using ... Global Const DAQCardConfError = -10254 ' Cannot configure the DAQCard because 1) the correct version of the card ... Global Const remoteChassisDriverInitError = -10255 error in initializing the driver for Remote SCXI. ' There was an Global Const comPortOpenError = -10256 error in opening the specified COM port. ' There was an Global Const baseAddressError = -10257 specified in Measurement & Automation Explorer. ' Bad base address Global Const dmaChannel1Error = -10258 ' Bad DMA channel 1 specified in Measurement & Automation Explorer or by ... Global Const dmaChannel2Error = -10259 ' Bad DMA channel 2 specified in Measurement & Automation Explorer or by ... Global Const dmaChannel3Error = -10260 ' Bad DMA channel 3 specified in Measurement & Automation Explorer or by ... Global Const userModeToKernelModeCallError = -10261 code failed when calling the kernel mode code. ' The user mode Global Const noConnectError = -10340 ' No RTSI or PFI signal/line is connected, or the specified signal and the ... Global Const badConnectError = -10341 signal/line cannot be connected as specified. ' The RTSI or PFI Global Const multConnectError = -10342 ' The specified RTSI signal is already being driven by a RTSI line, or the ... Global Const SCXIConfigError = -10343 ' The specified SCXI configuration parameters are invalid, or the function ... Global Const chassisSynchedError = -10344 ' The Remote SCXI unit is not synchronized with the host. Reset the chassis ... Global Const chassisMemAllocError = -10345 ' The required amount of memory cannot be allocated on the Remote SCXI unit ... Global Const badPacketError = -10346 received by the Remote SCXI unit is invalid. ' The packet Check your serial ... Global Const chassisCommunicationError = -10347 error in sending a packet to the remote chassis. ' There was an Check your ... Global Const waitingForReprogError = -10348 ' The Remote SCXI unit is in reprogramming mode and is waiting for reprogramming ... Global Const SCXIModuleTypeConflictError = -10349 ' The module ID read from the SCXI module conflicts with the configured ... Global Const CannotDetermineEntryModuleError = -10350 ' Neither an SCXI entry module (i.e.: the SCXI module cabled to the measurement ... Global Const DSPInitError = -10360 ' The DSP driver was unable to load the kernel for its operating system. Global Const badScanListError = -10370 ' The scan list is invalid; for example, you are mixing AMUX-64T channels ... Global Const invalidSignalSrcError = -10380 ' The specified signal source is invalid for the selected signal name. Global Const invalidSignalNameError = -10381 signal name is invalid. 175 ' The specified Global Const invalidSrcSpecError = -10382 ' The specified source specification is invalid for the signal source or ... Global Const invalidSignalDestError = -10383 signal destination is invalid. ' The specified Global Const routingError = -10390 ' The routing manager was unable to complete the request due to a lack of ... Global Const pfiBadLineError = -10391 ' The routing manager was unable to complete the request due to an invalid ... Global Const pfiGPCTRNotRoutedError = -10392 ' The specified General Purpose Counter Output and/or Up/Down signal(s) ... Global Const pfiDefaultLineUndefinedError = -10393 ' A default PFI line does not exist for the given signal. You must specify ... Global Const pfiDoubleRoutingError = -10394 ' Given PFI line is already reserved for a different signal, or given signal ... Global Const userOwnedRsrcError = -10400 ' The specified resource is owned by the user and cannot be accessed or ... Global Const unknownDeviceError = -10401 ' The specified device is not a National Instruments product, the driver ... Global Const deviceNotFoundError = -10402 ' The specified device is not a National Instruments product, the driver ... Global Const deviceSupportError = -10403 ' The specified device does not support the requested action (the driver ... Global Const noLineAvailError = -10404 available. ' No line is Global Const noChanAvailError = -10405 available. ' No channel is Global Const noGroupAvailError = -10406 available. ' No group is Global Const lineBusyError = -10407 line is in use. ' The specified Global Const chanBusyError = -10408 channel is in use. ' The specified Global Const groupBusyError = -10409 group is in use. ' The specified Global Const relatedLCGBusyError = -10410 ' A related line, channel, or group is in use; if the driver configures ... Global Const counterBusyError = -10411 counter is in use. ' The specified Global Const noGroupAssignError = -10412 ' No group is assigned, or the specified line or channel cannot be assigned ... Global Const groupAssignError = -10413 ' A group is already assigned, or the specified line or channel is already ... Global Const reservedPinError = -10414 ' The selected signal requires a pin that is reserved and configured only ... Global Const externalMuxSupportError = -10415 ' This function does not support your DAQ device when an external multiplexer ... Global Const sysOwnedRsrcError = -10440 ' The specified resource is owned by the driver and cannot be accessed or ... 176 Global Const memConfigError = -10441 ' No memory is configured to support the current data-transfer mode, or ... Global Const memDisabledError = -10442 ' The specified memory is disabled or is unavailable given the current addressing ... Global Const memAlignmentError = -10443 ' The transfer buffer is not aligned properly for the current data-transfer ... Global Const memFullError = -10444 ' No more system memory is available on the heap, or no more memory is available ... Global Const memLockError = -10445 ' The transfer buffer cannot be locked into physical memory. On PC AT machines, ... Global Const memPageError = -10446 ' The transfer buffer contains a page break; system resources may require ... Global Const memPageLockError = -10447 environment is unable to grant a page lock. ' The operating Global Const stackMemError = -10448 environment is unable to grant a page lock. ' The operating Global Const cacheMemError = -10449 ' A cache-related error occurred, or caching is not supported in the current ... Global Const physicalMemError = -10450 ' A hardware error occurred in physical memory, or no memory is located ... Global Const virtualMemError = -10451 ' The driver is unable to make the transfer buffer contiguous in virtual ... Global Const noIntAvailError = -10452 level is available for use. ' No interrupt Global Const intInUseError = -10453 interrupt level is already in use by another device. ' The specified Global Const noDMACError = -10454 controller is available in the system. ' No DMA Global Const noDMAAvailError = -10455 is available for use. ' No DMA channel Global Const DMAInUseError = -10456 DMA channel is already in use by another device. ' The specified Global Const badDMAGroupError = -10457 ' DMA cannot be configured for the specified group because it is too small, ... Global Const diskFullError = -10458 you specified is full. ' The storage disk Global Const DLLInterfaceError = -10459 could not be called due to an interface error. ' The NI-DAQ DLL Global Const interfaceInteractionError = -10460 ' You have mixed VIs from the DAQ library and the _DAQ compatibility library ... Global Const resourceReservedError = -10461 ' The specified resource is unavailable because it has already been reserved ... Global Const resourceNotReservedError = -10462 ' The specified resource is unavailable because it has already been reserved ... Global Const mdResourceAlreadyReservedError = -10463 has already reserved the requested resource. ' Another entity Global Const mdResourceReservedError = -10464 has already reserved the requested resource. ' Another entity 177 Global Const mdResourceNotReservedError = -10465 ' Attempting to lift a reservation off a resouce that previously had no ... Global Const mdResourceAccessKeyError = -10466 ' The requested operation cannot be performed because the key supplied is ... Global Const mdResourceNotRegisteredError = -10467 requested is not registered with the minidriver. ' The resource Global Const muxMemFullError = -10480 requested is not registered with the minidriver. ' The resource Global Const bufferNotInterleavedError = -10481 ' You must provide a single buffer of interleaved data, and the channels ... Global Const waveformBufferSizeError = -10482 ' You have specified channels with different waveform lengths. To fix the ... Global Const SCXIModuleNotSupportedError = -10540 ' You have specified channels with different waveform lengths. To fix the ... Global Const TRIG1ResourceConflict = -10541 COUTB1, however CTRB1 will also drive TRIG1. ' CTRB1 will drive This may ... Global Const matrixTerminalBlockError = -10542 ' This function requires that no Matrix terminal block is configured with ... Global Const noMatrixTerminalBlockError = -10543 ' This function requires that some matrix terminal block is configured with ... Global Const invalidMatrixTerminalBlockError = -10544 ' The type of matrix terminal block configured will not allow proper operation ... Global Const invalidDSPHandleError = -10560 input is not valid . ' The DSP handle Global Const DSPDataPathBusyError = -10561 ' Either DAQ or WFM can use a PC memory buffer, but not both at the same ... Global Const noSetupError = -10600 ' No setup operation has been performed for the specified resources. Or, ... Global Const multSetupError = -10601 ' No setup operation has been performed for the specified resources. Or, ... Global Const noWriteError = -10602 has been written into the transfer buffer. ' No output data Global Const groupWriteError = -10603 ' The output data associated with a group must be for a single channel or ... Global Const activeWriteError = -10604 ' Once data generation has started, only the transfer buffers originally ... Global Const endWriteError = -10605 ' No data was written to the transfer buffer because the final data block ... Global Const notArmedError = -10606 resource is not armed. ' The specified Global Const armedError = -10607 resource is already armed. ' The specified Global Const noTransferInProgError = -10608 in progress for the specified resource. ' No transfer is Global Const transferInProgError = -10609 ' A transfer is already in progress for the specified resource, or the operation ... Global Const transferPauseError = -10610 ' A single output channel in a group may not be paused if the output data ... 178 Global Const badDirOnSomeLinesError = -10611 ' Some of the lines in the specified channel are not configured for the ... Global Const badLineDirError = -10612 ' The specified line does not support the specified transfer direction. Global Const badChanDirError = -10613 ' The specified channel does not support the specified transfer direction, ... Global Const badGroupDirError = -10614 ' The specified group does not support the specified transfer direction. Global Const masterClkError = -10615 configuration for the clock master is invalid. ' The clock Global Const slaveClkError = -10616 configuration for the clock slave is invalid. ' The clock Global Const noClkSrcError = -10617 has been assigned to the clock resource. ' No source signal Global Const badClkSrcError = -10618 ' The specified source signal cannot be assigned to the clock resource. Global Const multClkSrcError = -10619 has already been assigned to the clock resource. ' A source signal Global Const noTrigError = -10620 signal has been assigned to the trigger resource. ' No trigger Global Const badTrigError = -10621 signal has been assigned to the trigger resource. ' No trigger Global Const preTrigError = -10622 ' The pretrigger mode is not supported or is not available in the current ... Global Const postTrigError = -10623 source has been assigned. ' No posttrigger Global Const delayTrigError = -10624 ' The delayed trigger mode is not supported or is not available in the current ... Global Const masterTrigError = -10625 configuration for the trigger master is invalid. ' The trigger Global Const slaveTrigError = -10626 configuration for the trigger slave is invalid. ' The trigger Global Const noTrigDrvError = -10627 been assigned to the trigger resource. ' No signal has Global Const multTrigDrvError = -10628 already been assigned to the trigger resource. ' A signal has Global Const invalidOpModeError = -10629 ' The specified operating mode is invalid, or the resources have not been ... Global Const invalidReadError = -10630 ' The parameters specified to read data were invalid in the context of the ... Global Const noInfiniteModeError = -10631 ' Continuous input or output transfers are not allowed in the current operating ... Global Const someInputsIgnoredError = -10632 ' Certain inputs were ignored because they are not relevant in the current ... Global Const invalidRegenModeError = -10633 ' The specified analog output regeneration mode is not allowed for this ... Global Const noContTransferInProgressError = -10634 ' No continuous (double buffered) transfer is in progress for the specified ... 179 Global Const invalidSCXIOpModeError = -10635 ' Either the SCXI operating mode specified in a configuration call is invalid, ... Global Const noContWithSynchError = -10636 ' You cannot start a continuous (double-buffered) operation with a synchronous ... Global Const bufferAlreadyConfigError = -10637 ' Attempted to configure a buffer after the buffer had already been configured. ... Global Const badClkDestError = -10638 be assigned to the specified destination. ' The clock cannot Global Const rangeBadForMeasModeError = -10670 is invalid for the configured measurement mode. ' The input range Global Const autozeroModeConflictError = -10671 be enabled for the configured measurement mode. ' Autozero cannot Global Const badChanGainError = -10680 this board must have the same gain. ' All channels of Global Const badChanRangeError = -10681 this board must have the same range. ' All channels of Global Const badChanPolarityError = -10682 this board must be the same polarity. ' All channels of Global Const badChanCouplingError = -10683 this board must have the same coupling. ' All channels of Global Const badChanInputModeError = -10684 this board must have the same input mode. ' All channels of Global Const clkExceedsBrdsMaxConvRateError = -10685 exceeds the board's recommended maximum rate. ' The clock rate Global Const scanListInvalidError = -10686 change has invalidated the scan list. ' A configuration Global Const bufferInvalidError = -10687 ' A configuration change has invalidated the acquisition buffer, or an acquisition ... Global Const noTrigEnabledError = -10688 ' The number of total scans and pretrigger scans implies that a triggered ... Global Const digitalTrigBError = -10689 ' Digital trigger B is illegal for the number of total scans and pretrigger ... Global Const digitalTrigAandBError = -10690 ' This board does not allow digital triggers A and B to be enabled at the ... Global Const extConvRestrictionError = -10691 ' This board does not allow an external sample clock with an external scan ... Global Const chanClockDisabledError = -10692 ' This board does not allow an external sample clock with an external scan ... Global Const extScanClockError = -10693 ' You cannot use an external scan clock when doing a single scan of a single ... Global Const unsafeSamplingFreqError = -10694 ' The scan rate is above the maximum or below the minimum for the hardware, ... Global Const DMAnotAllowedError = -10695 an operation that requires the use of interrupts. ' You have set up DMA ... Global Const multiRateModeError = -10696 ' Multi-rate scanning cannot be used with the AMUX-64, SCXI, or pretriggered ... Global Const rateNotSupportedError = -10697 ' Unable to convert your timebase/interval pair to match the actual hardware ... 180 Global Const timebaseConflictError = -10698 ' You cannot use this combination of scan and sample clock timebases for ... Global Const polarityConflictError = -10699 ' You cannot use this combination of scan and sample clock source polarities ... Global Const signalConflictError = -10700 ' You cannot use this combination of scan and convert clock signal sources ... Global Const noLaterUpdateError = -10701 ' The call had no effect because the specified channel had not been set ... Global Const prePostTriggerError = -10702 ' Pretriggering and posttriggering cannot be used simultaneously on the ... Global Const noHandshakeModeError = -10710 port has not been configured for handshaking. ' The specified Global Const noEventCtrError = -10720 ' The specified counter is not configured for event-counting operation. Global Const SCXITrackHoldError = -10740 ' A signal has already been assigned to the SCXI track-and-hold trigger ... Global Const sc2040InputModeError = -10780 ' When you have an SC2040 attached to your device, all analog input channels ... Global Const outputTypeMustBeVoltageError = -10781 ' When you have an SC2040 attached to your device, all analog input channels ... Global Const sc2040HoldModeError = -10782 ' The specified operation cannot be performed with the SC-2040 configured ... Global Const calConstPolarityConflictError = -10783 ' Calibration constants in the load area have a different polarity from ... Global Const masterDeviceNotInPXISlot2 = -10784 ' Your master device must be PXI slot number 2 in order to route clocks ... Global Const timeOutError = -10800 could not complete within the time limit. Global Const calibrationError = -10801 occurred during the calibration process. Global Const dataNotAvailError = -10802 amount of data has not yet been acquired. ' The operation ' An error Possible reasons for ... ' The requested Global Const transferStoppedError = -10803 ' The on-going transfer has been stopped. This is to prevent regeneration ... Global Const earlyStopError = -10804 ' The transfer stopped prior to reaching the end of the transfer buffer. Global Const overRunError = -10805 is faster than the hardware can support. Global Const noTrigFoundError = -10806 was found in the input transfer buffer. ' The clock rate An attempt to ... ' No trigger value Global Const earlyTrigError = -10807 ' The trigger occurred before sufficient pretrigger data was acquired. Global Const LPTcommunicationError = -10808 ' The trigger occurred before sufficient pretrigger data was acquired. Global Const gateSignalError = -10809 ' Attempted to start a pulse width measurement with the pulse in the phase ... Global Const internalDriverError = -10810 ' An unexpected error occurred inside the driver when performing this given ... 181 Global Const frequencyMeasurementError = -10811 ' The input signal's frequency could not be measured. The input signal's ... Global Const softwareError = -10840 ' The contents or the location of the driver file was changed between accesses ... Global Const firmwareError = -10841 ' The firmware does not support the specified operation, or the firmware ... Global Const hardwareError = -10842 ' The hardware is not responding to the specified operation, or the response ... Global Const underFlowError = -10843 ' Because of system and/or bus-bandwidth limitations, the driver could not ... Global Const underWriteError = -10844 ' Your application was unable to deliver data to the background generation ... Global Const overFlowError = -10845 ' Because of system and/or bus-bandwidth limitations, the driver could not ... Global Const overWriteError = -10846 ' Your application was unable to retrieve data from the background acquisition ... Global Const dmaChainingError = -10847 ' New buffer information was not available at the time of the DMA chaining ... Global Const noDMACountAvailError = -10848 ' The driver could not obtain a valid reading from the transfer-count register ... Global Const OpenFileError = -10849 ' The configuration file or DSP kernel file could not be opened. Global Const closeFileError = -10850 a file. ' Unable to close Global Const fileSeekError = -10851 within a file. ' Unable to seek Global Const readFileError = -10852 from a file. ' Unable to read Global Const writeFileError = -10853 to a file. ' Unable to write Global Const miscFileError = -10854 occurred accessing a file. ' An error Global Const osUnsupportedError = -10855 ' NI-DAQ does not support the current operation on this particular version ... Global Const osError = -10856 ' An unexpected error occurred from the operating system while performing ... Global Const internalKernelError = -10857 ' An unexpected error occurred inside the kernel of the device while performing ... Global Const hardwareConfigChangedError = -10858 ' The system has reconfigured the device and has invalidated the existing ... Global Const updateRateChangeError = -10880 ' A change to the update rate is not possible at this time because 1) when ... Global Const partialTransferCompleteError = -10881 another transfer after a successful partial transfer. ' You cannot do Global Const daqPollDataLossError = -10882 ' The data collected on the Remote SCXI unit was overwritten before it could ... Global Const wfmPollDataLossError = -10883 ' New data could not be transferred to the waveform buffer of the Remote ... 182 Global Const pretrigReorderError = -10884 ' Could not rearrange data after a pretrigger acquisition completed. Global Const overLoadError = -10885 exceeded the input range of the ADC. ' The input signal Global Const gpctrDataLossError = -10920 ' One or more data points may have been lost during buffered GPCTR operations ... Global Const chassisResponseTimeoutError = -10940 ' No response was received from the Remote SCXI unit within the specified ... Global Const reprogrammingFailedError = -10941 ' Reprogramming the Remote SCXI unit was unsuccessful. Please try again. Global Const invalidResetSignatureError = -10942 ' Reprogramming the Remote SCXI unit was unsuccessful. Please try again. Global Const chassisLockupError = -10943 ' The interrupt service routine on the remote SCXI unit is taking longer ... '*********************************************************************' '* '* Mapping of old errors and warnings to new '* '* Warnings '* '* dupIOaddrRange -(dupAddressError) '* dupIntLevels -(dupIntError) '* dupDMALevels -(dupDMAError) '* readOutputPort -(badChanDirError) '* calibrationErr -(calibrationError) '* noPreTrigUnwrap -(memFullError) '* relatedPortBusy -(relatedLCGBusyError) '* readOutputLine -(badDirOnSomeLinesError) '* outOnSomeInLines -(badDirOnSomeLinesError) '* inOnSomeOutLines -(badDirOnSomeLinesError) '* simulOpAcrossChips -(invalidOpModeError) '* overWriteBeforeCopy -(overWriteError) '* pageBreakinWFbuf -(memPageError) '* wrongNumConfigBytes -(noSetupError) '* DMAReprogramming -(memPageError) '* SCXImoduleTypeConflict -(SCXIModuleTypeConflictError) '* notEnoughExtMem -(memFullError) '* inputModeConflict -(invalidOpModeError) '* SCXIConfigWarning -(SCXIConfigError) '* messageIntervalTooLong -(badDAQEventError) '* logicalDeviceWarning -(badDeviceError) '* calConstPolarityConflict -(calConstPolarityConflictError) 183 '* irqConflict -(dupIntError) '* dmaConflict -(dupDMAError) '* jumperlessBoardWarning -(jumperlessBoardError) '* gpctrDataLossWarning -(gpctrDataLossError) '* '* '* Errors '* '* notOurBrdErr unknownDeviceError '* badBrdNumErr badDeviceError '* badGainErr badGainError '* badChanErr badChanError '* noSupportErr deviceSupportError '* badPortErr badChanError '* badOutPortErr badChanDirError '* noLatchModeErr noHandshakeModeError '* noGroupAssign noGroupAssignError '* badInputValErr invalidValueError '* timeOutErr timeOutError '* outOfRangeErr badRangeError '* daqInProgErr transferInProgError '* counterInUseErr counterBusyError '* noDAQErr noTransferInProgError '* overFlowErr overFlowError '* overRunErr overRunError '* badCntErr badCountError '* brdTypeErr deviceSupportError '* noCountOpErr noEventCtrError '* ctrReservedErr sysOwnedRsrcError '* portAssignToGrp groupAssignError '* noPortAssignErr noGroupAssignError '* badGrpDirErr badGroupDirError '* noGrpBlockInProg noTransferInProgError '* grpBlockInProg transferInProgError '* setLatchWGrpCall invalidValueError '* laterIntUpdateNotSet noLaterUpdateError '* wfInProgErr transferInProgError '* noWfLoadErr noWriteError '* noWfInProgErr noTransferInProgError '* badPreTrigCntErr badPretrigCountError 184 '* buffNotFullErr earlyTrigError '* prePostTrigErr prePostTriggerError '* extConvErr extConvRestrictionError '* badSigDirErr badLineDirError '* noDbDaqErr noContTransferInProgError '* overWriteErr overWriteError '* memErr memFullError '* noConfigFile configFileError '* badGrpSize badGroupError '* intLevelInUse intInUseError '* DMAChanInUse DMAInUseError '* multSourceInputErr multConnectError '* lowScanIntervalErr lowScanIntervalError '* noConnectionErr noConnectError '* noPGInProg noTransferInProgError '* PGInProg transferInProgError '* grpRateErr counterBusyError '* extGateErr invalidOpModeError '* openFileErr openFileError '* writeFileErr writeFileError '* noDbWvfmErr noTransferInProgError '* oldDataErr transferStoppedError '* dataNotAvailErr dataNotAvailError '* DMATransferCntNotAvail noDMACountAvailError '* noLabScanErr noTransferInProgError '* dbOpErr noContWithSynchError '* DMADisabledErr noDMAAvailError '* invalidConfigErr cmosConfigError '* brdIsArmedErr armedError '* clockSourceErr multClkSrcError '* noSetupErr noSetupError '* extConvDrvErr multClkSrcError '* triggerSourceErr badTrigError '* noArmErr notArmedError '* intDisabledErr noIntAvailError '* keyNotFoundErr configFileError '* noTrigEnabledErr preTrigError '* digPortReserved sysOwnedRsrcError '* RTSIlineInUseErr sysOwnedRsrcError '* dacUpdateRTSIinUseErr sysOwnedRsrcError 185 '* noRTSIlineAvailErr noLineAvailError '* preTrigScansErr badPretrigCountError '* postTrigScansErr badPosttrigCountError '* scanRateErr badIntervalError '* invalidGetErr invalidReadError '* calInputOutOfRange badExtRefError '* EEPROMaddrErr EEPROMreadError '* EEPROMresponseErr EEPROMreadError '* EEPROMreadErr EEPROMreadError '* EEPROMwriteErr EEPROMwriteError '* calResponseErr calibrationError '* calConvergeErr calibrationError '* calDACerr calibrationError '* externalCalRefErr badExtRefError '* internalCalRefErr hardwareError '* badOutLineErr badLineDirError '* relatedPortAssignToGrpBusy relatedLCGBusyError '* dacUpdateErr underFlowError '* muxMemFullErr muxMemFullError '* interlvdDataAlignErr memAlignmentError '* cannotAlignBufErr memAlignmentError '* cannotLockBufErr memLockError '* cannotPageLockErr memPageLockError '* invalidChassisIDErr badChassisIDError '* invalidModuleSlotErr badModuleSlotError '* configFileErr configFileError '* outdatedVDMADErr oldDriverError '* ctrRTSINotAvailErr lineBusyError '* dacUpdateRTSINotAvailErr lineBusyError '* SCXIConfigErr SCXIConfigError '* noDbDigErr noTransferInProgError '* DbDigPartialComplete transferStoppedError '* SCXITrackHoldErr SCXITrackHoldError '* wvfmGrpAssignErr groupAssignError '* chanNotAssignedGrpErr noGroupAssignError '* grpLoadErr groupWriteError '* loadAfterStartErr activeWriteError '* noUpdateRateErr noClkSrcError '* chanPauseErr transferPauseError '* DSPInitFailure DSPInitError 186 '* DSPDataPathInUse DSPDataPathBusyError '* DSPDAQErr internalKernelError '* DSPreserved3 badErrorCodeError '* DSPreserved4 badErrorCodeError '* DSPreserved5 badErrorCodeError '* SCXICommErr communicationsError '* invalidOpModeErr invalidSCXIOpModeError '* moduleNotSupported SCXIModuleNotSupportedError '* DAQboardNotSupported deviceSupportError '* noNIDAQLibErr noDriverError '* noNIDAQFuncErr functionNotFoundError '* incompatibleVISRDErr oldDriverError '* port1InLatchedModeErr relatedLCGBusyError '* invalidMemRegionErr memLockError '* fifoModeErr fifoModeError '* cannotFreeMemErr memConfigError '* memNotLockedErr memConfigError '* invalidWinHandleErr invalidWinHandleError '* trigEventNotAvailErr DMANotAllowedError '* memTypeNotSupportedErr memConfigError '* badChanStrErr syntaxError '* parseErr syntaxError '* noSuchMessageErr noSuchMessageError '* badChanTypeErr badChanError '* badTrigValErr badDAQEventError '* notOurDSPHandleErr invalidDSPHandleError '* NIDAQInternalErr internalDriverError '* preTrigReorderErr pretrigReorderError '* badCtrErr badCounterError '* invalidCtrErr badCounterError '* timedMsgInUseErr counterBusyError '* invDAQModeTimedMsgErr DMANotAllowedError '* lptCommunicationErr LPTcommunicationError '* multiRateAMUXErr multiRateModeError '* multiRatePreTrigErr multiRateModeError '* functionNotLinkedErr internalDriverError '* scanIntervalTooLongErr badIntervalError '* sampleIntervalTooLongErr badIntervalError '* updateIntervalTooLongErr badIntervalError '* gpctrBadApplicationErr gpctrBadApplicationError 187 '* gpctrBadCounterNumberErr gpctrBadCounterNumberError '* gpctrBadParamValueErr gpctrBadParamValueError '* gpctrBadParamIdErr gpctrBadParamIdError '* gpctrBadEntityIdErr gpctrBadEntityIdError '* gpctrBadActionErr gpctrBadActionError '* gpctrBadGateSignalErr gateSignalError '* gpctrNotArmedErr noSetupError '* gpctrNotResetErr counterBusyError '* gpctrNotProgrammedErr noSetupError '* gpctrApplicationNotSetErr noSetupError '* gpctrBufferNotConfiguredErr bufferInvalidError '* gpctrCantChangeParameterErr counterBusyError '* lptProtocolNotSupported LPTcommunicationError '* rateNotSupportedErr rateNotSupportedError '* timebaseConflictErr timebaseConflictError '* polarityConflictErr polarityConflictError '* signalConflictErr signalConflictError '* baseAddressErr baseAddressError '* interruptLevel1Err badErrorCodeError '* interruptLevel2Err badErrorCodeError '* dmaChannel1Err dmaChannel1Error '* dmaChannel2Err dmaChannel2Error '* openSCManagerErr badErrorCodeError '* openNIDAQServiceErr badErrorCodeError '* startNIDAQServiceErr badErrorCodeError '* criticalResourceConflictErr badErrorCodeError '* jumperlessBoardErr jumperlessBoardError '* reservedPinErr reservedPinError '* bufferNotInterleavedErr bufferNotInterleavedError '* gpctrInUseErr counterBusyError '* gpctrDataLossErr gpctrDataLossError '* updateRateChangeErr updateRateChangeError '* gpctrBufferConfiguredErr bufferAlreadyConfigError '* gpctrBufOprnNotInProgErr noTransferInProgError '* badFilterFreqErr badFilterCutoffError '* sc2040HoldModeErr sc2040HoldModeError '* sc2040InputModeErr sc2040InputModeError '* noSC2040ConfigErr noSetupError '* DAQCardConfigErr DAQCardConfigError '* partialTransferCompleteErr partialTransferCompleteError 188 '* DMABufferAlignmentErr memAlignmentError '* outputTypeMustBeVoltageErr outputTypeMustBeVoltageError '* osUnsupportedErr osUnsupportedError '* osErr osError '*********************************************************************' 3.2.8. Formulario de conexión (frmConexion.frm) Option Explicit Private Sub cmdAceptar_Click() Dim Res As String Dim iRes As Integer Dim Puerto As String Dim i As Integer frmConexion.Enabled = False cmdAceptar.Enabled = False cmdCancelar.Enabled = False cmdConfig.Enabled = False barConexion.Visible = True barConexion.Enabled = True tmrPBAR.Enabled = True Puerto = Format(cmbPuerto.Text, ">") 'Se establece la comunicación Res = modFlowbusAvanzado.StartCommunication(Puerto, False, True, iRes, cmbBaudios.Text) If (Res = "") Then 'Se guardan los parámetros de conexión y configuración cfg.Puerto = cmbPuerto.Text cfg.Baudios = cmbBaudios.Text For i = 1 To 16 If (chkCanal(i).Value = 1) Then cfg.Canal(i) = True Else cfg.Canal(i) = False End If 189 Next Unload frmConexion Else MsgBox (Res) tmrPBAR.Enabled = False barConexion.Enabled = False barConexion.Visible = False frmConexion.Enabled = True cmdAceptar.Enabled = True cmdCancelar.Enabled = True Call Habilitar_Form End If End Sub Private Sub cmdCancelar_Click() Unload frmConexion End Sub Private Sub ProgressBar1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) End Sub Private Sub cmdConf_Click() Call Habilitar_Form End Sub Private Sub cmdConfig_Click() Call Habilitar_Form End Sub Private Sub Form_Load() Call Deshabilitar_Form 190 tmrPBAR.Enabled = False barConexion.Enabled = False barConexion.Visible = False Call Cargar_Puertos Call Cargar_Baudios Call Cargar_cfg End Sub Private Sub tmrPBAR_Timer() If barConexion.Value >= barConexion.Max - 1 Then barConexion.Value = barConexion.Min Else barConexion.Value = barConexion.Value + 1 End If End Sub Sub Cargar_Puertos() Dim Num_Puertos As Byte Dim Ind_Puerto As Long Dim Long_Memoria As Integer Dim Error_val As Integer Dim EnUso As Boolean Dim Puerto As String Dim Indice As Integer Dim fmtPuerto As String 'Se vacía el cmbPuerto del puerto cmbPuerto.Clear 'Se obtiene el número de puertos disponibles Num_Puertos = modFlowbusAPI.GetNrPorts 'Se añaden los puerto encontrados al cmbPuerto For Ind_Puerto = 0 To Num_Puertos - 1 191 Puerto = Space(256) 'Se inicializa la variable Long_Memoria = modFlowbusAPI.GetPort(Ind_Puerto, 0, EnUso, Puerto) If Long_Memoria > 0 Then Puerto = Space(256) 'Se innicializa Error_val = modFlowbusAPI.GetPort(CByte(Ind_Puerto), Long_Memoria, EnUso, Puerto) 'Se obtiene el puerto Puerto = Trim(Puerto) 'Se eliminan los blancos If Error_val = 0 Then Indice = InStr(1, Puerto, Chr(9)) 'Se lecoliza el COM If Indice <> 0 Then Puerto = Mid(Puerto, Indice + 1, Len(Puerto) - Indice) End If fmtPuerto = "C" & Mid(Format(Puerto, "<"), 2, Len(Puerto) - 1) cmbPuerto.AddItem fmtPuerto End If End If Next 'Se selecciona el primer puerto de la lista If cmbPuerto.ListCount > 0 Then cmbPuerto.ListIndex = 0 End If End Sub Sub Cargar_Baudios() cmbBaudios.Clear cmbBaudios.AddItem (4800) cmbBaudios.AddItem (9600) cmbBaudios.AddItem (19200) cmbBaudios.AddItem (38400) cmbBaudios.Text = 38400 End Sub Sub Deshabilitar_Form() 192 Dim i As Integer frmConexion.cmbPuerto.Enabled = False frmConexion.cmbBaudios.Enabled = False For i = 1 To 16 frmConexion.chkCanal(i).Enabled = False Next End Sub Sub Habilitar_Form() Dim i As Integer frmConexion.cmbPuerto.Enabled = True frmConexion.cmbBaudios.Enabled = True For i = 1 To 16 frmConexion.chkCanal(i).Enabled = True Next End Sub Sub Cargar_cfg() Dim i As Integer For i = 0 To (cmbPuerto.ListCount - 1) If (cmbPuerto.List(i) = cfg.Puerto) Then cmbPuerto.ListIndex = i End If Next i For i = 0 To (cmbBaudios.ListCount - 1) If (cmbBaudios.List(i) = cfg.Baudios) Then cmbBaudios.ListIndex = i End If Next i For i = 1 To 16 If (cfg.Canal(i)) Then 193 chkCanal(i).Value = 1 Else chkCanal(i).Value = 0 End If Next i End Sub 3.2.9. Formulario del Planificador (frmPlanificador.frm) Option Explicit Dim X As ListItem Private Sub cmdDesplanificar_Click() Dim Index As Integer 'Si hay un item seleccionado... If Not lstPlanif.SelectedItem Is Nothing Then 'Pregunta si lo quiere eliminar If MsgBox("¿Seguro que desea desplanificar " & lstPlanif.SelectedItem.Text & "?", vbYesNo, "Confirmación") = vbYes Then Index = lstPlanif.SelectedItem.Index MsgBox (Index) Call Eliminar_planificacion(Index) MsgBox (Index) MsgBox (lstPlanif.ListItems.Count) If (Index <= lstPlanif.ListItems.Count) Then lstPlanif.ListItems.Item(Index).Selected = True ElseIf ((Index - 1) > 0) Then lstPlanif.ListItems.Item(Index - 1).Selected = True ElseIf (lstPlanif.ListItems.Count > 0) Then lstPlanif.ListItems.Item(1).Selected = True End If End If End If 'Se puede eliminar la selección si se inhibe. End Sub 194 Private Sub cmdEditar_Click() frmMedidas.Show vbModeless, Me End Sub Private Sub cmdEliminarCompletados_Click() Dim Num, Res As Integer Num = Eliminar_Completados MsgBox ("Se han eliminado " & Num & " elementos.") End Sub Private Sub cmdPlanificar_Click() frmPlanificar.Show vbModeless, Me End Sub Private Sub cmdSalir_Click() Unload frmPlanificador Salir_PGM = True End Sub Private Sub Form_Load() Call Refrescar_Lista_Planificador frmPlanificador.tmrFlow.Enabled = True End Sub Private Sub tmrFlow_Timer() If (Estado_act.Medida <> "") Then frmProceso.Actualizar_Tiempo End If 195 Call Validar_Planificacion End Sub Private Sub tmrIntervalo_Timer() If (Get_Tiempo_Intervalo) Then Call Tomar_Medidas End If End Sub 3.2.10. Formulario para Planificar una Nueva Medida (frmPlanificar.frm) Option Explicit Dim X As ListItem Private Sub cmbMedida_Click() Call Calcular_Fechas End Sub Private Sub cmdAceptar_Click() Dim Fecha_new, Fecha_act As Date Dim i, Res, Planif As Integer Fecha_new = 0 'Se validan los campos If (cmbMedida.Text = "") Then Res = MsgBox("Informar campo Medida", , "Error!") End If If (txtArchivo.Text = "") Then Res = MsgBox("Informar campo Archivo", , "Error!") End If 'Se valida que las fechas sean correctas respecto al formulario If (Res = 0) Then Fecha_new = Fecha_Seleccionada 196 If (Fecha_new < Obtener_FechaFin(Now, 5)) Then 'Mínimo mayor que 5 minutos Res = MsgBox("El inicio de la próxima planificación debe ser mayor a 5 minutos de la hora actual.", , "Error") End If End If 'Se valida que el fichero que se pide no esté informado de antes If (Res = 0) Then Planif = Existe_Path(txtArchivo.Text) If (Planif <> 0) Then Res = MsgBox("Debe eliminar la planificación " & Planif & " o cambiar el nombre del archivo.", , "Error") End If End If If (Res = 0) Then 'Se verifica que se pueda crear y se crea el archivo necesario. Res = Crear_Archivo(txtArchivo, cmbMedida.Text, Fecha_new) If (Res <> 0) Then Res = MsgBox("Ruta de fichero inexistente", , "Error") End If End If 'Se incluye la planificación If (Res = 0) Then If (Añadir_Planificacion(cmbMedida.Text, Fecha_new, txtArchivo.Text)) Then Unload frmPlanificar Else: Res = MsgBox("La planificación se solapa con alguna de las medidas ya planificadas", , "Error") End If End If End Sub Private Sub cmdArchivo_Click() Dim Direc_ini As String dlgArchivo.InitDir = Obtener_Direc_Medidas dlgArchivo.ShowSave 197 txtArchivo.Text = dlgArchivo.FileName End Sub Private Sub cmdCancelar_Click() Unload frmPlanificar End Sub Private Sub Form_Load() Dim i, num_elems As Integer frmPlanificador.Enabled = False 'Informar fecha y hora timFecha.Value = Now timHora.Value = timFecha.Value 'Cargar medidas Call Cargar_cmbMedida_Planificar End Sub Sub Calcular_Fechas() Dim Fecha_new, Fecha_fin As Date Dim TmpTot As Double Fecha_new = Fecha_Seleccionada TmpTot = Obtener_Tiempo_Total(cmbMedida.Text) Fecha_fin = Obtener_FechaFin(Fecha_new, TmpTot) If (cmbMedida.Text <> "") Then lblFechaFin.Caption = Format(Fecha_fin, "dd/mm/yyyy - HH:mm") End If End Sub Private Sub Form_Unload(Cancel As Integer) 198 frmPlanificador.Enabled = True End Sub Private Sub timFecha_Change() Call Calcular_Fechas End Sub Private Sub timFecha_Click() Call Calcular_Fechas End Sub Private Sub timHora_Change() Call Calcular_Fechas End Sub Private Sub timHora_Click() Call Calcular_Fechas End Sub Private Sub timHora_LostFocus() Call Calcular_Fechas End Sub Function Fecha_Seleccionada() As String Dim Fecha_fmt, Fecha_ini, Hora_ini As String Fecha_fmt = Format(timFecha.Value, "dd/mm/yyyy HH:mm") Fecha_ini = Mid(Fecha_fmt, 1, 10) 199 Fecha_fmt = Format(timHora.Value, "dd/mm/yyyy HH:mm") Hora_ini = Mid(Fecha_fmt, 12, 5) Fecha_Seleccionada = Fecha_ini & " " & Hora_ini End Function Function Crear_Archivo(ByVal strArchivo As String, ByVal Medida As String, ByVal Fecha As Date) As Integer On Error GoTo Error Dim intArchivo As Integer intArchivo = FreeFile Open strArchivo For Output As intArchivo Print #intArchivo, "El archivo se llenará con los datos obtenidos de la Medida: " & Medida; ". Con fecha y hora: " & Fecha Close intArchivo Crear_Archivo = 0 Exit Function Error: Crear_Archivo = 1 End Function 3.2.11. Formulario para Listar las Medidas Existentes (frmMedidas.frm) Private Sub cmbCopia_Click() txtNueva.SetFocus End Sub Private Sub cmdAceptar_Click() Dim i, Res As Integer 200 Res = 0 If ((Not optCopia.Value) And (Not optNueva.Value)) Then Res = MsgBox("Debe seleccionar una opción crear/copiar", , "Error") ElseIf (optCopia.Value) Then If ((cmbCopia.Text = "") Or (txtNueva.Text = "")) Then Res = MsgBox("Debe seleccionar una medida e informar un nombre nuevo", , "Error") Else: For i = 0 To frmMedidas.cmbMedida.ListCount If (StrComp(frmMedidas.cmbMedida.List(i), txtNueva.Text, vbTextCompare) = 0) Then Res = MsgBox("El nombre ya existe", , "Error") End If Next i End If Else If (txtNueva.Text = "") Then Res = MsgBox("Debe informar el nombre") Else: For i = 0 To frmMedidas.cmbMedida.ListCount If (StrComp(frmMedidas.cmbMedida.List(i), txtNueva.Text, vbTextCompare) = 0) Then Res = MsgBox("El nombre ya existe", , "Error") Accion = False End If Next i End If End If If (Res = 0) Then If (optCopia.Value) Then Call Copiar_Medida(cmbCopia.Text, txtNueva.Text) End If frmMedidas.cmbMedida.AddItem (txtNueva.Text) 'Se presenta el nuevo elemento For i = 0 To frmMedidas.cmbMedida.ListCount If (StrComp(frmMedidas.cmbMedida.List(i), txtNueva.Text, vbTextCompare) = 0) Then frmMedidas.cmbMedida.ListIndex = i End If Next i Unload frmNewMedida End If 201 End Sub Private Sub cmdCancelar_Click() Unload frmNewMedida End Sub Private Sub Form_Load() frmMedidas.Enabled = False Call Cargar_cmbCopia optNueva.Value = False txtNueva.Enabled = False txtNueva.BackColor = &H8000000F txtNueva.Text = "" optCopia.Value = False cmbCopia.Enabled = False cmbCopia.BackColor = &H8000000F cmbCopia.ListIndex = -1 End Sub Private Sub Form_Unload(Cancel As Integer) frmMedidas.Enabled = True End Sub Private Sub optCopia_Click() If (optCopia.Value = True) Then cmbCopia.Enabled = True cmbCopia.BackColor = &H80000005 cmbCopia.ListIndex = -1 txtNueva.Enabled = True txtNueva.BackColor = &H80000005 202 txtNueva.Text = "" cmbCopia.SetFocus End If End Sub Private Sub optNueva_Click() If (optNueva.Value = True) Then cmbCopia.Enabled = False cmbCopia.ListIndex = -1 cmbCopia.BackColor = &H8000000F txtNueva.Enabled = True txtNueva.Text = "" txtNueva.BackColor = &H80000005 txtNueva.SetFocus End If End Sub 3.2.12. Formulario para Crear/Copiar una Medida Nueva (frmNewMedida.frm) Option Explicit Private Sub cmbMedida_Click() Call Refrescar_Lista_Medidas(cmbMedida.Text, False) End Sub Private Sub cmdBajar_Click() Dim Index, Res As Integer If (frmMedidas.lstMedidas.ListItems.Count > 0) Then Index = Mover_Tramo(frmMedidas.cmbMedida, frmMedidas.lstMedidas.SelectedItem.Index, False) frmMedidas.lstMedidas.ListItems.Item(Index).Selected = True Else: Res = MsgBox("No existen elementos en la lista", , "Aviso") End If 203 End Sub Private Sub cmdCrear_Click() frmNewMedida.Show vbModeless, Me End Sub Private Sub cmdEliminar_Click() Dim Res As Integer Dim Permiso As Integer Dim Index As Integer Res = 0 Permiso = 0 If (cmbMedida.Text = "") Then Res = MsgBox("Debe seleccionar una medida", , "Error") ElseIf (lstMedidas.ListItems.Count = 0) Then Res = MsgBox("La lista está vacia", , "Aviso") ElseIf (lstMedidas.SelectedItem.Checked) Then Else: Res = MsgBox("Debe seleccionar un tramo", , "Error") End If If (Res = 0) Then Index = lstMedidas.SelectedItem.Index Permiso = MsgBox("Seguro que quiere eliminar el tramo " & Index, vbOKCancel, "Aviso") End If If (Permiso = 1) Then Call Eliminar_Tramo(cmbMedida.Text, lstMedidas.SelectedItem.Index) If (Index <= lstMedidas.ListItems.Count) Then lstMedidas.ListItems.Item(Index).Selected = True ElseIf ((Index - 1) > 0) Then lstMedidas.ListItems.Item(Index - 1).Selected = True ElseIf (lstMedidas.ListItems.Count > 0) Then lstMedidas.ListItems.Item(1).Selected = True End If End If 204 End Sub Private Sub cmdElimMedida_Click() Dim Res, Permiso, Index As Integer Res = 0 Permiso = 0 If (cmbMedida.Text = "") Then Res = MsgBox("Debe seleccionar una medida", , "Error") End If If (Res = 0) Then Index = cmbMedida.ListIndex Permiso = MsgBox("Seguro que quiere eliminar todos medida", vbOKCancel, "Aviso") los tramos y la End If If (Permiso = 1) Then Call Eliminar_Medida(cmbMedida.Text) cmbMedida.RemoveItem (Index) End If End Sub Private Sub cmdInsertar_Click() Dim Res As Integer If (cmbMedida.Text = "") Then Res = MsgBox("Debe elegir una medida primero", , "Error") Else: frmTramo.Show vbModeless, Me End If End Sub Private Sub cmdOk_Click() Unload frmMedidas End Sub 205 Private Sub cmdSubir_Click() Dim Index, Res As Integer If (frmMedidas.lstMedidas.ListItems.Count > 0) Then Index = Mover_Tramo(frmMedidas.cmbMedida, frmMedidas.lstMedidas.SelectedItem.Index, True) frmMedidas.lstMedidas.ListItems.Item(Index).Selected = True Else: Res = MsgBox("No existen elementos en la lista", , "Aviso") End If End Sub Private Sub Command1_Click() End Sub Private Sub Form_Load() frmPlanificador.Enabled = False Call Cargar_cmbMedida_Medidas End Sub Private Sub Form_Unload(Cancel As Integer) frmPlanificador.Enabled = True End Sub 3.2.13. Formulario para Crear un Nuevo Tramo (frmTramo.frm) Option Explicit Private Sub cmdAceptar_Click() Dim Opcion As Boolean Dim New_Tramo As typMedidas Dim TmpNodos, TmpIntervalo As Double Dim Res As Integer 206 'Se valida el tiempo If (Validar_txtBoxes(txtTmpNodos.Text)) Then TmpNodos = txtTmpNodos.Text End If If ((Res = 0) And (TmpNodos = 0)) Then Res = MsgBox("Debe asignar un tiempo mayor que 0 a los Nodos", , "Error") txtTmpNodos.SetFocus End If If ((Res = 0) And (TmpNodos > 525600)) Then Res = MsgBox("Tiempo máximo Nodos es de 525600 mins (1 año)", , "Error") txtTmpNodos.SetFocus End If 'Se valida la opcion If (Res = 0) Then If ((OptSiNo(0).Value = False) And (OptSiNo(1).Value = False)) Then Res = MsgBox("Debe seleccionar una opción de si quiere o no medidas", , "Error") ElseIf (OptSiNo(0).Value = True) Then Opcion = True Else Opcion = False End If End If 'Se valida el intervalo If ((Res = 0) And (OptSiNo(0) = True) And (Validar_txtBoxes(txtIntervalo.Text))) Then TmpIntervalo = txtIntervalo.Text End If If ((Res = 0) And (OptSiNo(0) = True) And (TmpIntervalo = 0)) Then Res = MsgBox("Debe asignar un tiempo mayor que 0 al Intervalo", , "Error") txtIntervalo.SetFocus End If If ((Res = 0) And (TmpIntervalo > 86400)) Then 207 Res = MsgBox("Tiempo máximo del intervalo es de 86400segs (1 día)", , "Error") txtIntervalo.SetFocus End If If (Res = 0) Then New_Tramo.Nombre = frmMedidas.cmbMedida.Text New_Tramo.Numero = 0 New_Tramo.Nodo3 = sldNodo3.Value New_Tramo.Nodo4 = sldNodo4.Value New_Tramo.Nodo5 = sldNodo5.Value New_Tramo.Medidas = Opcion New_Tramo.Intervalo = TmpIntervalo New_Tramo.Tramo = 0 New_Tramo.Tiempo = TmpNodos New_Tramo.TmpTot = 0 Call Programa.Agregar_Tramo(New_Tramo) Unload frmTramo End If End Sub Private Sub cmdCancelar_Click() Unload frmTramo End Sub Private Sub Option1_Click(Index As Integer) End Sub Private Sub Opt_Click(Index As Integer) End Sub Private Sub Form_Load() frmMedidas.Enabled = False 'Se inicia el formulario 208 txtIntervalo.Text = "" txtIntervalo.BackColor = &H8000000F txtIntervalo.Enabled = False End Sub Private Sub Form_Unload(Cancel As Integer) frmMedidas.Enabled = True End Sub Private Sub OptSiNo_Click(Index As Integer) If (OptSiNo(0).Value = True) Then txtIntervalo.Text = "0" txtIntervalo.BackColor = &H80000005 txtIntervalo.Enabled = True txtIntervalo.SetFocus Else: txtIntervalo.Text = "" txtIntervalo.BackColor = &H8000000F txtIntervalo.Enabled = False End If End Sub Private Sub sldNodo3_Change() txtNodo3.Text = sldNodo3.Value End Sub Private Sub sldNodo4_Change() txtNodo4.Text = sldNodo4.Value End Sub Private Sub sldNodo5_Change() 209 txtNodo5.Text = sldNodo5.Value End Sub Private Sub txtNodo3_Change() If (Validar_txtBoxes(txtNodo3.Text)) Then sldNodo3.Value = txtNodo3.Text End If End Sub Private Sub txtNodo3_LostFocus() If (Not Validar_txtBoxes(txtNodo3.Text)) Then sldNodo3.Value = 0 txtNodo3.Text = 0 End If End Sub Private Sub txtNodo4_Change() If (Validar_txtBoxes(txtNodo4.Text)) Then sldNodo4.Value = txtNodo4.Text End If End Sub Private Sub txtNodo4_LostFocus() If (Not Validar_txtBoxes(txtNodo4.Text)) Then sldNodo4.Value = 0 txtNodo4.Text = 0 End If End Sub Private Sub txtNodo5_Change() If (Validar_txtBoxes(txtNodo5.Text)) Then sldNodo5.Value = txtNodo5.Text 210 End If End Sub Private Sub txtNodo5_LostFocus() If (Not Validar_txtBoxes(txtNodo5.Text)) Then sldNodo5.Value = 0 txtNodo5.Text = 0 End If End Sub Private Function Validar_txtBoxes(Cadena As String) As Boolean Dim i As Integer Validar_txtBoxes = True For i = 1 To Len(Cadena) Select Case (Mid(Cadena, i, 1)) Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" Case " " If (Mid(Cadena, i) = " ") Then Else: Validar_txtBoxes = False End If Case Else Validar_txtBoxes = False End Select Next i If ((Cadena = "") Or (Cadena = " ")) Then Validar_txtBoxes = False End If End Function 3.2.14. Formulario para Monitorizar la Ejecución del Proceso (frmProceso.frm) Option Explicit Dim X0 As Integer Dim Y0 As Integer 211 Dim Inc_T As Integer Dim Ejes As ColorConstants Dim Cur_X(17) As Integer Dim Cur_Y(17) As Integer Dim Max As Integer Dim a As Double Dim b As Double Dim Fecha_ant As String Private Sub cmdTerminar_Click() Call Acabar_Proceso("No Ejecutado") End Sub Private Sub Form_Load() Fecha_ant = Format(Now, "dd/mm/yyyy HH:mm:ss") Fecha_ant = Mid(Fecha_ant, 1, 17) & "00" lblTiempo.Caption = Format(Tiempo_Horas(Obtener_Tiempo_Total(Estado_act.Medida)), "hh:mm:ss") frmProceso.Caption = " Proceso en ejecución: " & Estado_act.Medida Call Obtener_Val_Gas Call Establecer_Colores Call Actualizar_Caudales Call Actualizar_Setpoints Call Actualizar_Gases Call dibujar_ejes tmrProceso.Enabled = True End Sub Private Sub dibujar_ejes() Dim LongX As Integer Dim LongY As Integer Dim Sep As Integer Dim Bord As Integer 212 Dim Tension As Integer Dim i As Integer Tension = 10 Ejes = vbBlack LongY = pctProceso.Height Bord = 40 LongX = pctProceso.Width Sep = 10 X0 = Bord Y0 = pctProceso.Height - Bord pctProceso.Line (Sep, LongY - Bord)-(LongX - Sep, LongY - Bord), Ejes pctProceso.Line (Bord, LongY - Sep)-(Bord, Sep), Ejes pctProceso.CurrentX = X0 pctProceso.CurrentY = Y0 For i = 1 To 16 Cur_X(i) = X0 Cur_Y(i) = Y0 Next i Max = pctProceso.Width - Sep a = (Bord - Y0) / Tension b = Y0 Inc_T = (pctProceso.Width - Bord - Sep) / 3600 End Sub Private Sub Timer1_Timer() End Sub Private Sub tmrDatos_Timer() 213 Call Actualizar_Caudales Call Actualizar_Setpoints Call Actualizar_Gases End Sub Private Sub tmrProceso_Timer() Dim Tiempo As Integer Dim i As Integer Dim Estado As Integer Dim Valor As Double Tiempo = pctProceso.CurrentX + 1 For i = 1 To 16 If (cfg.Canal(i)) Then Estado = AI_VRead(1, i, 1, Valor) Call Dibujar_Valor_Canal(Tiempo, Obtener_Tension(i), i) End If Next i End Sub Private Sub Dibujar_Valor_Canal(ByVal X1 As Integer, ByVal Y1 As Integer, ByVal Canal) pctProceso.CurrentX = Cur_X(Canal) pctProceso.CurrentY = Cur_Y(Canal) pctProceso.Line -(X1, (a * Y1 + b)), Linea(Canal).BorderColor Cur_X(Canal) = pctProceso.CurrentX Cur_Y(Canal) = pctProceso.CurrentY End Sub Function Obtener_Tension(ByVal nodo As Integer) If (nodo = 1) Then Obtener_Tension = Rnd() + 4 End If If (nodo = 2) Then 214 Obtener_Tension = Rnd() + 2 End If If (nodo = 3) Then Obtener_Tension = Rnd() End If End Function Sub Actualizar_Caudales() Dim Caudal3 As Integer Dim Caudal4 As Integer Dim Caudal5 As Integer Call Obtener_Caudal(Caudal3, Caudal4, Caudal5) lblCdl(3).Caption = Caudal3 & " %" lblCdl(4).Caption = Caudal4 & " %" lblCdl(5).Caption = Caudal5 & " %" End Sub Sub Actualizar_Setpoints() Dim Setpoint3 As Integer Dim Setpoint4 As Integer Dim Setpoint5 As Integer Call Obtener_Setpoint(Setpoint3, Setpoint4, Setpoint5) lblSet(3).Caption = Setpoint3 & " %" lblSet(4).Caption = Setpoint4 & " %" lblSet(5).Caption = Setpoint5 & " %" End Sub Sub Actualizar_Gases() Dim Gas3 As String Dim Gas4 As String Dim Gas5 As String Call Obtener_Gas(Gas3, Gas4, Gas5) 215 lblGas(3).Caption = Gas3 lblGas(4).Caption = Gas4 lblGas(5).Caption = Gas5 End Sub Sub Actualizar_Tiempo() Dim Horas As Integer Dim Mins As Integer Dim Segs As Integer 'Dim Fecha_ant As String ya defindo Dim Dia_ant As Double Dim Mes_ant As Double Dim Any_ant As Double Dim Hora_ant As Double Dim Min_ant As Double Dim Seg_ant As Double Dim Fecha_act As String Dim Dia_act As Double Dim Mes_act As Double Dim Any_act As Double Dim Hora_act As Double Dim Min_act As Double Dim Seg_act As Double Dim i As Double Dim Dias_tot As Double Dim Num_Segs As Double Dim Num_act As Double Dim Num_ant As Double 'Se obtiene del contador la hora que esta mostrando actualmente. Horas = Mid(Format(lblTiempo.Caption, "HH:mm:ss"), 1, 2) Mins = Mid(Format(lblTiempo.Caption, "HH:mm:ss"), 4, 2) Segs = Mid(Format(lblTiempo.Caption, "HH:mm:ss"), 7, 2) 'Se quiere contabilizar el numero de segundos que han transcurrido desde la última vez que se llamó 216 'a la función, para actualizar el contador. 'Se calcula en función de los dias, meses, años, horas, minutos y segundos transcurridos. 'Separamos datos de la última fecha guardada. Dia_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 1, 2) Mes_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 4, 2) Any_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 7, 4) Hora_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 12, 2) Min_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 15, 2) Seg_ant = Mid(Format(Fecha_ant, "dd/mm/yyyy HH:mm:ss"), 18, 2) 'Se separa al igual la fecha actual Fecha_act = Format(Now, "dd/mm/yyyy HH:mm:ss") Dia_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 1, 2) Mes_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 4, 2) Any_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 7, 4) Hora_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 12, 2) Min_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 15, 2) Seg_act = Mid(Format(Fecha_act, "dd/mm/yyyy HH:mm:ss"), 18, 2) 'Comprobamos que no haya cabiado el dia, el mes o el año. Dias_tot = 0 If (Any_act <> Any_ant) Then For i = Any_ant To (Any_act - 1) If (Es_Bisiesto(i)) Then Dias_tot = Dias_tot + 366 Else: Dias_tot = Dias_tot + 365 End If Next i Dias_tot = Dias_tot + Dif_Dias(Dia_act, Mes_act, Any_act, 0, 0, 0) + Dia_act - 1 'Se resta 1 por que del día actual solo han pasado unas horas Dias_tot = Dias_tot + Dif_Dias(1, 1, Any_ant + 1, Dia_ant, Mes_ant, Any_ant) 'Como se trata de numeros muy grandes hay que hacerlo por partes 'Num_Segs = Dias_tot * 86400 + Hora_act * 3600 + Min_act * 60 + Seg_act + _ (86400 - ((Hora_ant * 3600) + (Min_ant * 60) + (Seg_ant))) 217 ElseIf ((Mes_act <> Mes_ant) Or (Dia_act <> Dia_ant)) Then Dias_tot = Dif_Dias(Dia_act, Mes_act, Any_act, Dia_ant, Mes_ant, Any_ant) Num_Segs = Dias_tot * 86400 + Hora_act * 3600 + Min_act * 60 + Seg_act + _ (86400 - ((Hora_ant * 3600) + (Min_ant * 60) + (Seg_ant))) Else Num_Segs = ((Hora_act * 3600) + (Min_act * 60) + (Seg_act)) - _ ((Hora_ant * 3600) + (Min_ant * 60) + (Seg_ant)) End If 'Se actualiza el contador For i = 1 To Num_Segs If (Segs > 0) Then Segs = Segs - 1 Else If (Mins > 0) Then Segs = 59 Mins = Mins - 1 Else If (Horas > 0) Then Horas = Horas - 1 Else: Segs = 0 Mins = 0 Horas = 0 End If End If End If Next i Fecha_ant = Fecha_act lblTiempo.Caption = Format(Horas & ":" & Mins & ":" & Segs, "hh:mm:ss") End Sub Sub Establecer_Colores() Linea(1).BorderColor = vbRed Linea(2).BorderColor = vbBlue Linea(3).BorderColor = vbGreen 218 Linea(4).BorderColor = vbBlack Linea(5).BorderColor = vbCyan Linea(6).BorderColor = vbMagenta Linea(7).BorderColor = vbWhite Linea(8).BorderColor = vbYellow Linea(9).BorderColor = &HC0FFFF Linea(10).BorderColor = &HFF8080 Linea(11).BorderColor = &H40C0& Linea(12).BorderColor = &H4000& Linea(13).BorderColor = &H400000 Linea(14).BorderColor = &H80& Linea(15).BorderColor = &H808000 Linea(16).BorderColor = &HFFC0FF End Sub ÑÑÑ 3.2.15. Temporizador de TimeOut (clsTemporizadorTimeOut.cls) Option Explicit 'Prefix: "oTimeOut_" Private Const mcsModuleName = "clsTemporizadorTimeOut" '---------------USER DEFINED TYPES---------------------------------------------------------------'Structure / type in which the current windows system time is stored 'prefix: "systime_" Private Type SystemTimeType iYear As Integer 'Current year iMonth As Integer 12=December) 'Current month (1=January ... iDayOfWeek As Integer 6=Saturday) 'Current day of week (0=Sunday ... iDay As Integer 'Current day of month iHour As Integer 'Current time in hours iMinute As Integer 'Current time in minutes iSecond As Integer 'Current time in seconds iMilliseconds As Integer 'Current time in milliseconds End Type 219 '---------------END OF USER DEFINED TYPES--------------------------------------------------------- '---------------MODULE VARIABLES-----------------------------------------------------------------Private Type ModuleVariables systime_Start As SystemTimeType 'Current time at the moment the timer was started End Type Private m As ModuleVariables '---------------END OF MODULE VARIABLES----------------------------------------------------------- '---------------IMPORT LIBRARIES-----------------------------------------------------------------'************************************************************************ **** ' ' GetSystemTime ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' Function : Function which gets the windows system time. ' Parameters: ' (In) ' (Out) ' ' Returned : ' Remarks : ' Private Declare Sub GetSystemTime Lib "KERNEL32" (ByRef systime_Time As SystemTimeType) '---------------END OF IMPORT LIBRARIES----------------------------------------------------------- '---------------PUBLIC FUNCTIONS AND PROCEDURES--------------------------------------------------'************************************************************************ **** ' ' StartTimeOutTimer ' ' Author : Bronkhorst High-Tech B.V. 220 ' Date : 12-Dec-2003 ' Function : Function which starts the timer. ' Parameters: ' (In) ' (Out) ' ' Returned : ' Remarks : ' Public Sub StartTimeOutTimer() GetSystemTime m.systime_Start End Sub '************************************************************************ **** ' ' TimeUp ' ' Author : Bronkhorst High-Tech B.V. ' Date : 12-Dec-2003 ' ' Function occured). : Function which checks if time has expired (if a timeout ' It measures the time from the moment you started the timer until now and ' then checks if time has expired. ' Parameters: ' (In) ' (Out) lTimeOut: Time in milliseconds before a timeout occurs. ' Returned left. : True if a timeout occured, False if there is still time ' : Remarks ' Public Function TimeUp(ByVal lTimeOut As Long) As Boolean Dim systime_Now As SystemTimeType Dim lStart As Long moment the timer was started 'Current windows system time 'Time in milliseconds at the '(only hours, minutes, seconds and milliseconds processed) Dim lNow As Long 'Current time in milliseconds '(only hours, minutes, seconds and milliseconds processed) 221 GetSystemTime systime_Now 'Get the current system time 'Get the time in milliseconds at the moment the timer was started With m.systime_Start lStart = .iMilliseconds + 1000 * (.iSecond + 60 * (.iMinute + 60 * CLng(.iHour))) End With 'Get the current time in milliseconds With systime_Now lNow = .iMilliseconds + 1000 * (.iSecond + 60 * (.iMinute + 60 * CLng(.iHour))) End With 'If starting time greater then the current time, a day has passed, so add the milliseconds 'of 1 day to the current time If lStart > lNow Then lNow = lNow + 1000 * 60 * 60 * 24 End If 'Check if timeout occured TimeUp = ((lNow - lStart) >= lTimeOut) End Function '---------------END OF PUBLIC FUNCTIONS AND PROCEDURES-------------------------------------------- 4. Conclusiones Una vez creado el programa y probado para ir ajustándolo al máximo a las necesidades del usuario final y para eliminar cualquier posible error de codificación, de implementación o comunicación entre el programa y la máquina, hemos podido llegar a las siguientes conclusiones: - El programa nos permite tener un control total sobre el experimento que se pretende realizar, tiempos de mezcla, intervalo de adquisición de datos, concentración de gases en la mezcla, etc. - El programa es una buena herramienta para visualizar en todo momento la evolución del experimento así como para el almacenaje de los datos relativos, para más tarde poder tratarlos o procesarlos consecuentemente. 222 - Se han tenido que utilizar formularios no modales y permitir la ejecución de eventos en determinados momentos interrumpiendo el transcurso normal del programa, para permitir realizar algunas acciones mientras se estaban realizando otras. Hemos conseguido así un efecto multi-tarea. Sería interesante estudiar la problemática utilizando una versión posterior de Visual Basic u otro lenguaje que permita la ejecución de threads. - Entendiendo que es un programa de utilización eminentemente práctico y pensando que con el tiempo y la experiencia (como sucede a demás en todos los programas) se querrán ampliar las funcionalidades del programa, a parte de intentar programar utilizando una estructura fácilmente ampliable, se han dejado más funciones de las estrictamente necesarias comentadas y declaradas para abordar en el futuro la ampliación de dichas funcionalidades. Es decir, ante la necesidad de nuevas opciones es suficiente con abrir el programa inspeccionar el código y abordar las ampliaciones sin necesidad de añadir ningún componente ni ninguna función de comunicación nueva. 5. Anexos Ver volumen II 223 Automatización de la Generación y Medida de Mezclas Gaseosas Mediante MassFlow (ANEXOS) TITULACIÓ: Enginyeria Tècnica en Electrònica Industrial AUTOR: Raphaël Verlaat DIRECTOR: Jesús Brezmes LLecha DATA: Juny / 2.007. IDDFLD32_D.doc - P1D rev. date: 1999-12-21 1 Interface Design Document Flow-Bus DLL FOR WIN32 Interface Design Document Author: G. Binnenmars Project: Title: Approved: Revision: Date: Filename: BHT934.2 Interface Design Document FlowBus DLL FOR WIN 32 P1D 1999-03-04 IDDFLD32.DOC IDDFLD32_D.doc - P1D rev. date: 1999-12-21 1 1 2 SCOPE 1.1 Identification 2 1.2 System Overview 2 1.3 Document overview 2 1.4 Document history 2 2 APPLICABLE DOCUMENTS 3 3 APPLICATION INTERFACE DESIGN 4 3.1 Introduction 4 3.2 Reference 3.2.1 Data-structures 3.2.2 API - functions 3.2.3 Error values 4 4 4 12 3.3 Procedures 3.3.1 Using the DLL 3.3.2 Open and Closing communication 3.3.3 Configuring communication 3.3.4 Sending / Receiving data 3.3.5 Database functions 14 14 14 14 15 16 PHYSICAL INTERFACE DESIGN 17 A. EXAMPLE APPLICATION PROGRAM 18 4 IDDFLD32_D.doc - P1D rev. date: 1999-12-21 2 1 SCOPE 1.1 IDENTIFICATION This document describes the design of the interface between the Flow-Bus communication DLL and applications using this DLL. 1.2 SYSTEM OVERVIEW The systems E6000 and E7000 of Bronkhorst allow the control and the security of different flow-systems. A communication network (3T-NET) connects the modules in these systems. The systems can be controlled from the PC. There are several levels at which the control can occur. At a low level there is a RS232 interface to the system. Above it is a Windows DLL that allows different applications to communicate with the system. At the top is a Windows DDE which also allows different application to communicate with the system, but then less knowledge about the internals of the system (the PROPAR modal) is required. The overview of the Flow-Bus DDE and the various parts is given in the next figure. network application 3T-Net Flowbus application DLL DDE R S232 application Figure 1 System overview 1.3 DOCUMENT OVERVIEW This document contains the following parts: • chapter 2 gives a reference of applicable documents • chapter 3 gives the interface design • chapter 4 gives the interface to the lower layers • appendix A shows a programming example 1.4 DOCUMENT HISTORY Revision P1A P1B P1C Author G. Binnenmars G.,Binnenmars G. Binnenmars Description Initial version Update after implementation Final release Host IDDFLD32_D.doc - P1D rev. date: 1999-12-21 3 2 APPLICABLE DOCUMENTS [1] Title: [2] Author: Doc.no: Revision: Title: [3] Author: Doc.no: Revision: Title: [4] Author: Doc.no: Revision: Title: Author: Doc. No: Revision: Software Design Document PROPAR DLL (in Dutch) G. Binnenmars RAP\121BHT.R10 P1A Interface Design Document RS232 Protocol between PC and FlowBus host and DPM protocol between PC and PC ISA card. W. Klaren IDDFBRS.DOC P1B Instruction Manual Digital Readout and Control System E6000 serie. Preliminary version 28-11-1991 Software Design Document Flow-Bus DLL FOR WIN32 G. Binnenmars SDDFLD32_B.DOC P1B IDDFLD32_D.doc - P1D rev. date: 1999-12-21 4 3 Application interface design 3.1 INTRODUCTION The interface from the PC to the DLL is based on several “C-functions” exported by the DLL. The data exchanged between application and DLL consists of minimal PROPAR information and on application identification. See [3] for a definition of the PROPAR protocol. 3.2 REFERENCE 3.2.1 Data-structures Several data-types used by the DLL and available for the applications are given below. The following conversion is used: • char, 1 byte • int, 2 bytes • float, 4 bytes • long, 4 bytes Type HWND typedef int APPL_ID typedef struct { int NrPorts, int PortNameLen, bool bInUse, char *szPortName ….. } PORT_INFO Description Windows typedef used for handle of a window Unique application identification number Gives an overview of the number of ports in the PC, and for each port, the length of the port name, an in use indication and the port name. Remarks size is long size is int Size is varying 3.2.2 API - functions The following functions are exported by the DLL. Function int OpenDLL( HWND hWnd) Description Makes the application known to the DLL. Parameters hWnd - window handle of main window application void CloseDLL (APPL_ID id) PORT_INFO *GetAvailableInterfaces() Tells the DLL that the application closes Returns info about the physical ports in the PC Tries to open the specified network. id int OpenCommunication (char *pszName) - application identification none pszName - name of device port to be opened Return 0, on error >0, APPL_ID which should be used in almost every function none pointer to a varying size structure with port info (always valid) return values: 0, on success > 0 in case of error (one of the FBE_ errors ) IDDFLD32_D.doc - P1D rev. date: 1999-12-21 5 Function int CloseCommunication (APPL_ID id) Description Tries to close the opened network. Parameters id - application identification int ConfigureRS232 ( char *pszName, unsigned int iBaud) Configures the RS232 baudrate and reopens the port if RS232 already open. Configures the FlowBus settings and reopens the port with the new settings. Used for both configuring the PC_ISA parameters on a PC_ISA Host and for the PC_ISA parameters of the RS232 Host pszName - name of com port iBaud - preferred baudrate cNode - node number card cSecNode- secondary node number cNextNode - next node number cLastNode - last node number cArbiter - arbitration mode cRxBuf - number of receive buffers cTxBuf - number of transmit buffer pszName - name of ISA device port piBaud - storage for baudrate pszName - name of com port pcNode - storage for node number pcSecNode- storage for secondary node number pcNextNode - storage for next node number pcLastNode – storage for last node number in network pcArbiter - storage for arbitration mode pcRxBuf -storage for number of receive buffers pcTxBuf - storage for number of transmit buffer pszName - name of ISA port bProc enable process chaining bParm enable parameter chaining pszVersion Version of the DLL, if less than 5.0 the interface is not valid. int ConfigureT_NET ( char cNode, char cSecNode, char cNextNode, char cLastNode, char cArbiter, char cTxBuf, char cRxBuf, char *pszName) void GetRS232Config ( char *pszName, unsigned int *piBaud) Determines current Com port settings void GetTNetConfig (char *pcNode, char *pcSecNode, char *pcNextNode, char *pcLastNode, char *pcArbiter, char *pcTxBuf, char *pcRxBuf, char *pszName) Determines the current FlowBus settings. void ConfigureChaining ( bool bProc, bool bParm) Sets usage of chaining. Parameters are used immediately void GetDLLVersion (char *pszVersion) Determines the version of the DLL Return return values: 0, on success > 0 in case of error (one of the FBE_ errors) return values: 0, on success > 0, on error (port is closed) return values: 0, on success > 0, on error none none none none IDDFLD32_D.doc - P1D rev. date: 1999-12-21 Function int ReadChar (APPL_ID HWND char char char int id, hWnd, cNode, cProcNr, cParmNr, iMsgId) int GetChar (APPL_ID char char char char int id, cNode, cProcNr, cParmNr, *pcDest, *piMsgId) 6 Description Adds a parameter read request of type char to the interface buffer of the DLL Retrieves the parameter that is received by the DLL. Parameters id - application identification hWnd - notify window handle (NULL indicates polling) cNode - destination node number cProcNr - process number cParmNr parameter number iMsgId - message identification used and filled in by application id - application identification cNode - destination node number cProcNr - process number cParmNr - parameter number pcDest - pointer to char buffer where data can be stored piMsgId - pointer to message id. int ReadInt() int GetInt() equal as read_char() equal as get_char() piDest - pointer to int buffer where data can be stored int ReadFloat() int GetFloat() equal as read_char() equal as get_char() pfDest - pointer to float buffer where data can be stored int ReadLong() int GetLong() equal as read_char() equal as get_char() plDest - pointer to long buffer where data can be stored Return return values: 0, on success >0, on error return values: 0, on success >0, on error IDDFLD32_D.doc - P1D rev. date: 1999-12-21 Function int ReadString( (APPL_ID HWND char char char char int id, hWnd, cNode, cProcNr, cParmNr, cExpLen, iMsgId) int GetString (APPL_ID char char char int char char id, cNode, cProcNr, cParmNr, *piMsgId, *pszDest, *pcLen) 7 Description Equal as read_char(), if cExpLen is 0 an ASCII response string is expected Retrieves the string parameter that is received by the DLL. int GetRealTimeChar (APPL_ID id, char cNode, char cProcNr, char cParmNr, char *pcDest, long *plTime, int *piMsgId) Retrieves the parameter that is received by the DLL. int GetRealTimeInt() equal as GetRealTimeChar() equal as GetRealTimeChar() equal as GetRealTimeChar() int GetRealTimeLong() int GetRealTimeFloat() Parameters id - application identification hWnd - notify window handle (NULL indicates polling) cNode - destination node number cProcNr - process number cParmNr parameter number cExpLen- expected string length or 0 iMsgId - message identification used and filled in by application id - application identification cNode - destination node number cProcNr - process number cParmNr - parameter number piMsgId - pointer to message id. pszDest - pointer to char buffer for data storage pcLen - char pointer for storage of string length (in case of ASCII string trailing zero included) id - application identification cNode - destination node number cProcNr - process number cParmNr - parameter number pcDest - pointer to char buffer where data can be stored plTime - timestamp piMsgId - pointer to message id. Return return values: 0, on success >0, on error return values: 0, on success >0, on error return values: FBE_NO_ERROR, on success FBE_NO_ANSWER_FOUND, on error FBE_NO_EVENT, when no event present on realtime channel IDDFLD32_D.doc - P1D rev. date: 1999-12-21 Function int WriteChar (APPL_ID HWND char char char unsigned char int id, hWnd, cNode, cProcNr, cParmNr, ucPar, iMsgId) int WriteInt() int WriteFloat() int WriteLong() int WriteString (APPL_ID HWND char char char char char int id, hWnd, cNode, cProcNr, cParmNr, cLen, *pszBuf, iMsgId) int GetStatus (APPL_ID char char char char int id, cNode, cProcNr, cParmNr, *pcStatus, *piMsgId) 8 Description Adds a parameter send request of type char to the interface buffer of the DLL equal as write_char() equal as write_char(0 equal as write_char() Adds a parameter send request of type string to the interface buffer of the DLL Retrieves the status that the DLL received on one of the write_xxx commands. Parameters id - application identification hWnd - notify window handle (NULL indicates polling) cNode - destination node number cProcNr - process number cParmNr - parameter number ucPar - parameter value IMsgId - message identification used and filled in by application uiPar - parameter value fPar - parameter value lPar - parameter value id - application identification hWnd - notify window handle (NULL indicates polling) cNode - destination node number cProcNr - process number cParmNr parameter number cLen - length of string (0 for ASCII strings) pszBuf - pointer to string iMsgId - message identification used and filled in by application id - application identification cNode - destination node number cProcNr - process number cParmNr parameter number pcStatus - pointer to integer buffer where status can be stored piMsgId - message id. Return return values: 0, on success >0, on error This function will also trigger the different tasks in the DLL to do some action. return values: 0, on success 1, on error return values: 0, on success FBE_XXXX (1 .. 30), on error IDDFLD32_D.doc - P1D rev. date: 1999-12-21 Function int GetError() 9 Description Indicates if a network error occurred and clears the possible error. Parameters None Return return value: 0, no error occurred IE_BADID (-1) The device identifier is invalid or unsupported or lack of memory IE_OPEN (-2) The device is already open. IE_NOPEN (-3) The device is not open. IE_MEMORY (-4) The function cannot allocate the queues. IE_DEFAULT (-5) The default parameters are in error. IE_HARDWARE (-10) The hardware is not available (is locked by another device). IE_BYTESIZE (-11) The specified byte size is invalid. IE_BAUDRATE (-12) The device's baud rate is unsupported. FBE_PROTOCOLL_ERR OR, error in received data FBE_SEND_ERROR, error sending data FBE_OPEN_COMM, for PC-ISA in case com port not opened FBE_CLOSE_COMM, for the PC-ISA card in case network not opened FBE_HOST_OVERFLOW , for PC-ISA in case to many messages send to Host IDDFLD32_D.doc - P1D rev. date: 1999-12-21 10 Function int CheckReceivedMsg ( APPL_ID id, char *pcNode, char *pcProc, char *pcParm, char *pMType, char *pcType, int *piMsgId) Description Indicates if a message is available for the application. If so, then node, process, parameter, type and msg id. are filled. int ClaimCommand (APPL_ID id, HWND hWnd, char cNode, char cProcNr, int iMsgId); Adds a claim process message to the DLL int UnClaimCommand (APPL_ID id, HWND hWnd, char cNode, char cProcNr, int iMsgId); Adds an unclaim process message to the DLL int GetClaimStatus (APPL_ID id, char cNode, char cprocNr, char *pcStatus, int *piMsgId); Determines the answer on the claim request int StartBroadcast (APPL_ID id, HWND hWnd, char cNode, char cProcNr, char cRepTime, int iMsgId); Adds an start broadcast process message to the DLL int GetStartBroadcastStatus (APPL_ID id, char cNode, char cProcNr, char *pcStatus, int *piMsgId) Determines the answer on the start broadcast request Parameters Id - application identification pcNode - destination node number pcProc - process number pcParm - parameter number pMType - indicates type of message (send/ask) pcType - indicates the answer is on a ReadXxx() or on a WriteXxx() request. piMsgId - message id. id - application identification pcNode - destination node number pcProc - process number piMsgId - message id. id - application identification pcNode - destination node number pcProc - process number piMsgId - message id. id - application identification cNode - destination node number cProcNr - process number pcStatus status piMsgId - message id. id - application identification cNode - destination node number cProcNr - process number cRepTime repetition time in 10 msec. iMsgId - message id. id - application identification cNode - destination node number cProcNr - process number pcStatus status piMsgId - message id. Return return value: 0, on success >0, on error (no message available) If no answer is available and time since the last call to this function is more then 10 msec, the internal state-machine is triggered. This is used for polling in case the ISA card is used. return value: 0, on success >0, on error return value: 0, on success >0, on error return value: 0, on success >0, on error return value, 0, on success >0, on error return value: 0, on success >0, on error IDDFLD32_D.doc - P1D rev. date: 1999-12-21 Function void RemoveMsg ( APPL_ID id, char cNode, char cProc, char cParm) void GetInterfaceType( char *pszName) int GetCommunication() int GetNrPendingMessages( APPL_ID id) 11 Description Deletes a read answer from the DLL Indicates the network currently used. Default is COM1. Indication if the connection with the Host is correct. Determines the number of outstanding requests of the application. Parameters id application ident. cNode desti. node nr cProc process number cParm parameter number. pszName - name of device currently used none Id - application ident. Sets the last node address in the network (default 125). Has to be called in front of ReadSystemConfig Returns last node address. Reads the system configuration and builds the channel database. iNode - last node number int FindFirstFreeNode( int iStartNode) Scans the network for the first node address not in use char GetProgress() Gives an indication of the progress of the ReadSystemConfig and FindFirstFreeNode functions Determines the channel corresponding with the node and process Gets node and process from a channel iStartNode - address of node where search should start (0 means cancel previous search) none void SetSystemLNA( int iNode) int GetSystemLNA(void) int ReadSystemConfig( int iNode) int GetChannel( int iNode, int iProc) bool GetNodeProc( int iChannel, int *piNode, int *piProc) int GetModuleType( int iNode) Determines module type on node address void GetModuleNumber( int iNode, char *pszIDNumber) Determines the module serial number on node address None iNode iNode iProc Return None none return value: 0, no connection 1, connection ok return value: number of requests none last node address - last node to scan ( 0 means stop scan in progress) - node address - process number iChannel - channel number piNode - storage for node piProc - storage for process iNode - node address iNode - node address pszIDNumber - storage for serial number return value: 0, on success 1, communication not open 2, scan already in progress 3, busy with open/close or change communication action return value: 0, on error (communication closed, busy with other action, already searching node) > 0 node found progress of action as a percentage return value: 0, on error > 0 channel number return value, false (0), channel not found true, channel found return value: 0, on error > 0 module type none IDDFLD32_D.doc - P1D rev. date: 1999-12-21 Function int GetModuleDevType( int iNode) int GetMaxChannel() int GetMaxNode() 12 Description Determines the module functional group Retrieves maximum channel number Retrieves maximum node number Parameters iNode - node address Return return value, module function type none maximum channel value none maximum node address found Notes: 1. MsgId. is an identification number applied by the application. It is not used inside the DLL. The DLL just copies it back in the answer. The application can use this message id. for own purposes. For example, root the answer back to a specific part of the program. 2. APPL_ID is an identification number of the application. It is assigned by the DLL when an application calls OpenCommunication. This identification is used in WIN16 by the DLL to connect the received answers back to the correct application. In WIN 32 it can be used to identify threads in an application. 3.2.3 Error values The following table gives an overview of possible error values. Name FBE_NO_ERROR FBE_PROCESS_CLAIM Value 0 1 Description No error STATUS RESPONSE MODULE, this process cannot be operated by this module */ FBE_COMMAND 2 FBE_PROCESS 3 FBE_PARM_NUMBER 4 FBE_PARM_TYPE 5 FBE_PARM_VALUE 6 FBE_NETWORK_ NOT_ACTIVE 7 STATUS RESPONSE MODUL, no such command possible for this module STATUS RESPONSE MODULE, no such process at this module STATUS RESPONSE MODULE, no such parameter at this process STATUS RESPONSE MODULE, type of parameter sent differs from type on module DLL ERROR, wrong value for this parameter or not accepted HOST ERROR, no communication activity on FLOW-BUS detected FBE_TIME_OUT_ START_CHAR 8 HOST ERROR, start character serial communication failed FBE_TIME_OUT_ SERIAL_LINE 9 HOST ERROR, serial communication failed FBE_MODULE_ HARDWARE_MEM 10 memory on FLOW-BUS module failed FBE_NODE_ADDRESS FBE_COMMUNICATION 11 12 FBE_READ_ONLY_PARM 13 wrong node number HOST ERROR, general communication error with FLOW-BUS DLL_ERROR, retires expired this parameter value can only be read IDDFLD32_D.doc - P1D rev. date: 1999-12-21 13 Name FBE_PC_COMMUNICATION FBE_RS232_CONNECTION Value 14 FBE_PC_MEMORY 16 FBE_WRITE_ONLY_PARM 17 Description there is no communication between PC and FLOW-BUS HOST_ERROR, no/bad connection between PC and a RS232-module DLL ERROR, not enough memory in your PC for communication structure this parameter value can only be send FBE_SYS_CONFIG_ UNKNOWN 18 FLOW-BUS system configuration is unknown FBE_NO_FREE_NODE_ ADDR 19 FLOW-BUS system reached maximum size (32 nodes) FBE_WRONG_INTERFACE _TYPE 20 need other type of interface for this option FBE_BUILD_DCB 21 FBE_OPEN_COMM 22 DLL_ERROR, error building device control block serial port DLL ERROR, open communication went wrong FBE_COMM_STATE 23 DLL ERROR, communication status error FBE_INTERFACE_BUSMAS TER 24 interface tries to start communication (alone in system) FBE_TIMEOUT_ON_RX_ ANSWER 25 time out on rx answer FBE_NO_START_CHAR 26 HOST ERROR, no ':' on start of message FBE_FIRST_DIGIT 27 HOST ERROR, error in first digit FBE_HOST_OVERFLOW 28 HOST ERROR, buffer overflow in host FBE_BUFFER_OVERFLOW 29 DLL ERROR, buffer overflow in DLL FBE_NO_ANSWER_ FOUND 30 DLL ERROR, requested answer not found FBE_CLOSE_COMM 31 DLL ERROR, closing communication error FBE_SYNCHRON_ERROR 32 DLL ERROR, other application performs action FBE_SEND_ERROR 33 DLL ERROR, requested msg. not send FBE_PROTOCOL_ERROR 34 DLL ERROR, error in received data FBE_NO_EVENT 35 DLL ERROR, no event present on realtimechannel 15 IDDFLD32_D.doc - P1D rev. date: 1999-12-21 3.3 14 PROCEDURES 3.3.1 Using the DLL This paragraph explains the minimal steps necessary to use the DLL. 1. First an application opens the DLL and gets an application id. (Function OpenDLL). The DLL start the internal threads. Default the DLL sets the RS232 connection as the active network. 2. The application should check the software version. (Function GetDLLVersion) 3. The application should set the chaining attributes. Default the DLL supports both process and parameter chaining. Process chaining is not supported on older FlowBus modules. Therefor process chaining should be disabled. (Function ConfigureChaining should be called with the parameters (false, true)) 4. The application should determine a free network it wants to use. First the number of ports should be determines (Function GetNrPorts), then for each port the name and an in-use indication should be determined (Function GetPort). 3 The application should configure the network (port) it wants to use. • In case the application wants to use an ISA card it configures the specified card (Function ConfigureTNet with device name, node number, secondary node, next node and arbitration mode (only device name and arbitrage are used internally)). • In case the application wants to use a RS232 host it should configure both the name and baudrate of the com port and also the ISA settings the RS232 host should use. From the ISA settings only the arbitrage will be used and then only for old host types. (Functions ConfigureTNet and ConfigureRS232). See also 3.3.3 5. The application opens the communication on a specified port. (Function OpenCommunication) 6. The application performs some communication task actions. 7. The application closes the communication (Function CloseCommunication) 8. The application ends the connection with the DLL, the application tells the DLL is closes and the DLL closes all threads (Function CloseDLL) 3.3.2 Open and Closing communication This paragraph explains how communication can be opened and closed. 1. After the application has obtained an application id. It should determine which physical network is available, if any. (Function GetAvailableInterfaces or GetNrPorts + GetPort). 2. Then the application opens the communication (Function OpenComm ) with a free port returned in 1. 3. If the communication is already open, it is closed automatically. All messages that are in the DLL buffer that still have to be send are flushed. The physical port is opened. 4. In case of an RS232 host it is checked if this node is already installed on a node number (only true for new host types), if so this node number will be used. 5. In contrast, old RS232 hosts and all ISA hosts are started by the DLL on node 0. In this case the DLL searches for a free node number. If a node is found the host is installed to this free node number. 6. The DLL checks if the host takes part in the network arbitrage scheme for a maximum of 20 seconds. 7. When the application closes the communication, (Function CloseCommunication) the DLL first waits till an answer is received on pending messages. Afterwards the physical port is closed and messages that still have to be send, are flushed 8. If the application closes it is not necessary to close the communication. The DLL will close the communication when the application calls CloseDLL() or if the DLLEntryPoint function is called with PROCESS_DETACH (the DLL is unloaded from memory). 9. The communication can be checked (Function GetCommunication) which indicates if the connection with the Host is correct (or at least the DLL thinks this connection is correct). 3.3.3 Configuring communication IDDFLD32_D.doc - P1D rev. date: 1999-12-21 15 1. First there is a FlowBus configuration for the Host. The current configuration can be determined (Function GetTNetConfig). The configuration can be changed (Function ConfigureTNet). These functions apply both to the settings of the PC-ISA card and to the FlowBus settings of the RS232 Host. Only if the function ConfigureTNet is called when a port is open the host will use all the ISA settings. The physical port is claimed (wait till there are no more messages pending to the modules). Then the port is closed and reopened with the new settings. 2. Second there is the RS232 configuration. The current configuration can be determined (Function GetRS232Config) The settings can be changed (Function ConfigureRS232). If the RS232 port is opened and ConfigureRS232 is called, the port is claimed, than closed and then reopened with the new settings. 3. If an application calls ConfigureTNet and ConfigureRS232 at the same time. The last call is only used to store the settings internally. This can happen with two threads in one application. The following table lists the internal usage of the FlowBus settings: Port Open Host Type No No new RS232 (with auto-install) old RS232 No ISA host Yes new RS232 Yes old RS232 Yes ISA host FlowBus Settings Used none secondary node + arbitration device name + arbitration all settings except device name all settings except device name all settings Table 1 Usage of ConfigureTNet settings. 3.3.4 Sending / Receiving data • • • • • • First an application opens the DLL and gets an application id. See 3.3.1 Next the DLL opens a physical network. See 3.3.2 An application can now start placing messages in the Interface-Buffer (Functions ‘ReadXxx’ or ‘WriteXxx’). If the application passes a valid Window Handle the DLL will notify the application when an answer is received, otherwise the DLL has to poll the DLL (Function CheckReceivedMsg. ) If an answer is received, the application should first check if a network error occurred (Function GetError). Parameters returned with CheckReceivedMsg are node, process, parameter and request-type for which an answer is received. The following steps are dependent of the message type: parameter send: determine the status of the answer (GetStatus). This can be a status response from the Host or an internal error value from the DLL. parameter ask: determine the status of the answer (GetStatus) to check for error responses. If no error occurred, call one of the GetXxx functions to determine the received parameter value claim: determine the status of the answer (GetClaimStatus) to check for errors. unclaim: determine the status of the answer (GetClaimStatus) to check for errors IDDFLD32_D.doc - P1D rev. date: 1999-12-21 - • 16 broadcast: determine the status of the answer (GetStartBroadcastStatus) to check for errors The application can now remove the message data from the DLL buffer (Function RemoveMsg) To prevent the application places too many requests in the DLL (with a corresponding long period between request and response) the application can ask for the number of outstanding request (Function GetNrPendingMessages). To get a better throughput of requests (performance) the following notes give some ideas: 1. Place requests on a timer interval and continue with requests while GetNrPendingMessages is still smaller than 100 messages 2. Try to place several requests for the same node at the same time (to make use of the chaining of request) 3. Try to place requests for different nodes at the same time (the hosts support at this moment concurrent requests for 5 different nodes) 4. Maintain a start point, at this point the application should wait till all pending requests are handled. This should prevent that the interface buffer gets filled with one kind of slow request. An overflow because some kind of request to some kind of node takes more time than the other kind of requests. 3.3.5 Database functions Internally the DLL maintains a database of FlowBus Channels. Each node at least as one channel assigned to it. A channel represents a single process in a node. Nodes with several inputs can have more than one channel. This database is available after the application calls ReadSystemConfig. This function takes as parameter the number of nodes to scan, starting from 1. This parameter should be filled in based on system knowledge. The maximum node value supported is 125. The channel database is sorted. Controller modules come in front of operator and interface modules. IDDFLD32_D.doc - P1D rev. date: 1999-12-21 17 4 Physical Interface design There are three lower level interfaces: 1. serial interface with RS232 host, described in [2] 2. DPM interface with ISA host on Win95 operating system, described in [2] 3. DeviceIOControl function interface with ISA Device Driver on Win NT4.0 operating system IDDFLD32_D.doc - P1D rev. date: 1999-12-21 18 A. Example application program This appendix gives a short programming example. 1. Initialisation char bool bool NETWORK_TYPE int HWND int char APPL_ID pszPortName[MAX_PORT_LEN]; chain_proc; chain_parm; net; idTimer; NotifyHandler; polling_period; Version[10]; AppId; GetDLLVersion(Version); // check version, only continue if appropriate … // determine current configuration AppId = OpenDLL(NULL); strcpy(pszPortName, "COM1"); if (GetCommunication()) { GetInterfaceType(pszPortName); if (strncmp(pszPortName, "COM", 3) == 0) net = RS232; else net = T_NET; if (net == T_NET) { idTimer = SetTimer(1, polling_period); // NotifyHandler = NULL; } else { NotifyHandler = this->HWindow; } } chain_proc = false; chain_parm = true; ConfigureChaining(chain_proc, chain_parm); 2. Open RS232 port RS232_SET TNET_SET char char int set; set_tnet; pszPort[MAX_PORT_LEN]; szName[MAX_PORT_LEN]; iRes; GetRS232Config(pszPort, (unsigned short *)&set.baudrate); GetTNetConfig(&set_tnet.cNode, &set_tnet.cSecNode, &set_tnet.cNextNode, &set_tnet.cLastNode, &set_tnet.cArbiter, &set_tnet.cTxRetries, &set_tnet.cRxRetries, szName); // change settings as necessary sprintf(pszPort, “COM1”); iRes = ConfigureTNet(set_tnet.cNode, set_tnet.cSecNode, set_tnet.cNextNode, set_tnet.cLastNode, set_tnet.cArbiter, set_tnet.cTxRetries, set_tnet.cRxRetries, szName); iRes = ConfigureRS232(pszPort, set.baudrate); IDDFLD32_D.doc - P1D rev. date: 1999-12-21 19 iRes = OpenCommunication(pszPort); 3. Send some request and check answers char char char char char char char int short float long int int buffer[125]; cNode; cParm; cProc; cStatus; mType; cType; iError; iMsgId; fDest; lDest; msg_rec = 0; error_rec = 0; if (GetNrPendingMessages(AppId) <= pInputScript->GetCyclusSize()) { // number of pending messages smaller than max. number of messages that // can be send in a cyclus bRes = pInputScript->HandleNext(); // e.g iRes = WriteChar(AppId, NotifyHandler, 1, 0, 3, 125, MsgId++); iRes = ReadInt(AppId, NotifyHandler, 1, 1, 1, MsgId++); } while (CheckReceivedMsg(AppId, &cNode, &cProc, &cParm, &mType, &cType, &iMsgId) == FBE_NO_ERROR) { // answer available iError = GetError(); //get info about network error if (iError == FBE_NO_ERROR) { switch (mType) { case PARM_SEND_TYPE: // get info about error or status response iError = GetStatus(AppId, cNode, cProc, cParm, &cStatus, &iMsgId); if (cStatus <= FBE_PARM_VALUE) { ReportStatus(AppId, cNode, cProc, cParm, cStatus); } else { ReportError(AppId, cNode, cProc, cParm, cStatus); } break; case PARM_ASK_TYPE: // get info about error or status response GetStatus(AppId, cNode, cProc, cParm, &cStatus, &iMsgId); if (cStatus == FBE_NO_ERROR) { switch (cType) { case PARM_CHAR: if (GetChar(AppId, cNode, cProc, cParm, (char *)&lDest, &iMsgId) == FBE_NO_ERROR) IDDFLD32_D.doc - P1D rev. date: 1999-12-21 20 ReportParm(AppId, cNode, cProc, cParm, PARM_CHAR, (char)lDest); else ReportError(AppId, cNode, cProc, cParm, FBE_NO_ANSWER_FOUND); break; default: // handle other parm types … break; } } else // handle error break; default: // handle other message types break; } } else { // handle error } RemoveMsg(AppId, cNode, cProc, cParm); } 4. Terminate iRes = CloseCommunication(); // not really necessary CloseDLL(AppId); // required INSTRUCTION MANUAL RS232 INTERFACE with FLOW-BUS protocol FOR DIGITAL MASS FLOW / PRESSURE INSTRUMENTS Doc. no.: 9.17.027 B Date: 18-06-2001 Multi-bus ATTENTION: Before installing and operating the instrument it is recommended that this instruction be read. Not following the guidelines could result in personal injury and/or damage to the equipment. Short form start-up All necessary settings for this module are already performed at Bronkhorst High-Tech B.V. To follow next steps carefully is the quickest way to get this module operational in your own system. Procedure: - Make sure your PC or PLC is connected to the RS232 interface by means of the correct cable • • • Multibus instruments need a special cable with T-connector (7.03.313) see figure 1. RS232/FLOW-BUS interfaces need a one-on-one 9-pole cable without crossings with male and female connector Cable lengths for RS232 must not exceed 10 meters. - Make sure instrument or interface is powered (+15Vdc or +24Vdc) - In case of RS232/FLOW-BUS interface without micro-switch and LED’s, first see that interface gets a free address on the FLOW-BUS. Follow initialisation procedure described at [Initialising RS232/FLOW-BUS interface] - Use settings [19200,n,8,1] for your COM-port: Baudrate = 19K2 Baud, no parity, 8 databits, 1 stopbit. - Start sending messages as described in following paragraphs. - In case of trouble programs like Hyperterminal (available in MS-Windows) or FlowDDE (from Bronkhorst High-Tech B.V.) could be very usefull. BRONKHORST HIGH-TECH B.V. Table of contents 1 2 3 4 5 6 INTRODUCTION ........................................................................................................................................ 4 Available interfaces .................................................................................................................................... 5 2.1 RS232/FLOW-BUS interface .............................................................................................................. 5 2.1.1 D-connector for RS232 ................................................................................................................ 5 2.1.2 Specifications ............................................................................................................................... 5 2.2 RS232 on multibus instrument ............................................................................................................ 6 2.2.1 D-Connector for analog operation, power, RS232:...................................................................... 6 2.2.2 Specifications multibus RS232: ................................................................................................... 7 2.2.3 Connection diagram interface cable (7.03.313):.......................................................................... 7 FLOW-BUS protocol description ................................................................................................................ 8 3.1 General................................................................................................................................................ 8 3.2 Initialising RS232/FLOW-BUS interface.............................................................................................. 8 3.3 Communication messages .................................................................................................................. 8 3.4 Chaining .............................................................................................................................................. 9 3.5 Status message................................................................................................................................... 9 3.6 Send parameters............................................................................................................................... 11 3.7 Request parameter............................................................................................................................ 11 3.8 Initialising RS232/FLOW-BUS interface............................................................................................ 13 3.9 Examples........................................................................................................................................... 14 3.9.1 Sending setpoint ........................................................................................................................ 14 3.9.2 Sending chained parameters ..................................................................................................... 14 3.9.3 Request setpoint ........................................................................................................................ 16 3.9.4 Request chained parameters..................................................................................................... 16 Dual interface operation ........................................................................................................................... 19 Parameter information .............................................................................................................................. 20 5.1 General.............................................................................................................................................. 20 5.2 Parameter properties......................................................................................................................... 23 5.3 Parameter values: ............................................................................................................................. 29 Troubleshooting........................................................................................................................................ 38 9.17.027 Page 3 BRONKHORST HIGH-TECH B.V. 1 INTRODUCTION This manual will explain how to communicate with a Bronkhorst High-Tech instrument to your PC/PLC using RS232 serial communication. You have to write software yourself using the information of this document in order to be able to operate these instruments. Bronkhorst High-Tech B.V. also offers software to support a quicker way to operate digital instruments with your PC using MS-Windows 95, 98, NT or 2000. On the highest supported communication level, you may use DDE-channels for Windows applicationprograms with this facility. You can use the program FlowDDE for easy connection between MS-Windows applications (e.g. Excel, Visual Basic, LabView, Delphi, Borlandc) and digital instruments. There are several examples available for LabView, Visual Basic and Excel environments. On a lower communication level, you can also use the FLOWB32.DLL for reading/changing parameter values. To read and write parameter values from or to FLOW-BUS devices directly through the available interfaces there is a special protocol for messages between these devices. This protocol has been specially developped for Bronkhorst High-Tech equipment so no third party equipment can be connected. It consists of a hierarchical setup for instruments/nodes (max. 128) containing processes (max. 128) with parameters (max. 32) which values can be set to certain values to enable settings/properties for the instruments. When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol if you choose to drive the interfaces directly. When you use a new type of RS232/FLOW-BUS (baudrates up to 38K4 with switch and 2 LEDs) interface you first have to initialize the interface. This can be done by means of sending some ASCII-strings to the interface through RS232 or by means of the micro-switch. See chapter 2 for more details. When you communicate directly via RS232 on a multibus instrument, no special initialisation is needed. 9.17.027 Page 4 BRONKHORST HIGH-TECH B.V. 2 Available interfaces 2.1 RS232/FLOW-BUS interface The RS232/FLOW-BUS interface is an interface between the FLOW-BUS and the RS232 V24 serial (computer) port. It will either be supplied as a separate enclosed unit with a FLOW-BUS connector and a RS232 connector or as an integral 14TE module of your E-7000 readout and control system. The converter offers communication with a baudrate up to 38,4 kBaud. Communication software support is available. Communication settings are: 38400,n,8,1. RS232 FLOW-BUS FLOW-BUS status 2.1.1 D-connector for RS232 The female RS232 (x) (subminiature 9-pin) D-connector has the following pin configuration: Pinnumber 1 2 3 4 5 6 7 8 9 Description not connected TXD RXD not connected 0 Vd DTR CTS RTS Shield 2.1.2 Specifications Power supply Power consumption Operating temperature Storing temperature Housing dimensions Baudrates Galvanic Isolation 9.17.027 +15Vdc/+24Vdc +/- 10% +15Vdc : 50 mA +24Vdc : 35 mA 0…+50 ºC -20…+60 ºC box: 160x80x44mm module: 14TE 4800 Baud 9600 Baud 19200 Baud 38400 Baud FLOW-BUS: opto isolated Page 5 BRONKHORST HIGH-TECH B.V. Power : DC-DC converter 2.2 RS232 on multibus instrument The RS232 interface on a multibus instrument can be connected to any RS232 V24 serial (computer) port. The interface offers communication with a baudrate of 19.2 kBaud. On the 9-pin male subD connecter of the instrument RX and TX are available on pin 6 and pin 1 (see table below). +15Vdc/ +24Vdc RS232 7.03.313 7.03.300 2.2.1 D-Connector for analog operation, power, RS232: Pinnumber 1 2 3 4 5 6 7 8 9 Description TX-RS232 Analog output Analog input (setpoint) sense +Valve RX-RS232 +15Vdc/+24Vdc common/0 Vdc Shield No handshaking facilities are used. On the side of the PC/PLC a nul-modem connector is needed. Communication settings are: 19200,n,8,1. Bronkhorst High-Tech B.V. offers a special cable needed for communication (7.03.313). Communication software support is available. 9.17.027 Page 6 BRONKHORST HIGH-TECH B.V. 2.2.2 Specifications multibus RS232: Operating temperature Storing temperature Baudrates Galvanic Isolation 0…+70 ºC -20…+60 ºC 19200 Baud not for RS232 The multibus RS232 interface is a serial interface between the multibus instrument and the RS232 V24 serial (computer) port using the FLOW-BUS protocol for communication. This means that for serial RS232 communication a multibus instrument with RS232 can be treated as a FLOW-BUS system with one instrument and a FLOW-BUS/RS232 interface. All available software already existing for FLOW-BUS RS232 communication can be used for multibus instruments also. Only initialization is different. Use of FLOWDDE32 is only possible from V4.23 and higher. 2.2.3 Connection diagram interface cable (7.03.313): RS232 COM-port at PC 1 2 3 4 5 6 7 8 9 Analog/RS232 9 pin sub-D chassis part male Analog/RS232 9 pin sub-D cable part female 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 TX-RS232 Analog output Analog input (setpoint) sense +Valve RX-RS232 +15 Vdc/ +24Vdc Common/0 Vdc Power Shield instrument 9.17.027 Page 7 BRONKHORST HIGH-TECH B.V. 3 FLOW-BUS protocol description 3.1 General On the highest supported communication level, you may use DDE-channels for Windows applicationprograms with this facility. On a lower communication level, you can use the FLOWB32.DLL, FLOWBUS.DLL or FLOWBUS.LIB, for changing parameter values. To read and write parameter values from or to FLOW-BUS devices directly through the available interfaces there is a special protocol for messages between these devices. When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol if you choose to drive the interfaces directly. When you use a type of RS232/FLOW-BUS interface (baudrate up to 38K4) you first have to initialise the interface. This can be done by means of sending some ASCII-strings to the interface through RS232. How this should be implemented is described in 3.88 3.2 Initialising RS232/FLOW-BUS interface When you use a digital instrument with RS232 interface, baudrate is fixed on 19K2 baud and no special initialisation is needed. Through the serial line connected to a COM-port of your computer or to a PLC you have to communicate with the instrument using the FLOW-BUS protocol. Each instrument has its own node-address (3...120). If you want to send a message to the instrument you have to know this node-address. However, if you send a message to node-address 128 the instrument will always respond to your message. On a point-to-point connection like RS232 it is the easiest way to make the communication work under all circumstances (its independant of the real node-address of the instrument). 3.3 Communication messages Communication messages between FLOW-BUS interfaces and other devices consist of command strings with specific information. This command string is either ASCII (RS232) or BINARY. Basically the string contains several information bytes. Through RS232 these hexadecimal bytes are converted in ASCII (f.i.: bytevalue 0x0A is "0A" in ASCII and capital letters should be used). Messages via RS232 are preceded by the ':' character and terminated with "\r\n" (Carriage return-Line-feed). There are several COMMANDS available in the FLOW-BUS messages. However only Command RD (04) and WR (01) are enough to do all the standard parameter reading and writing. A RD command will be answered with a WR command, containing the value asked for or a status message, containing an errornumber. A WR command will be answered with a status message, containing an error-number (if errornumber = 0, than WR command was OK). Note: ASCII character ‘:’ has hexadecimal value: 3A ASCII character ‘\r’ has hexadecimal value: 0D ASCII character ‘\n’ has hexadecimal value: 0A Communication commands Command Description 00 Status message 01 Send parameter with destination address, will be answered with type 00 command 02 Send parameter with destination address, no status requested 03 Send parameter with source address, no status requested 04 Request parameter, will be answered with type 02 or 00 command 05 Instruction: send parameter repeatedly (followed by byte with repeating time) 06 Stop process 07 Start process 08 Claim process 09 Unclaim process 9.17.027 Page 8 BRONKHORST HIGH-TECH B.V. To access a specific parameter you need to know the following numbers. 1. 2. 3. 4. Node-address, each FLOW-BUS device is connected to a specific node-address in the system. Process number, each device (node) consists of several processes. Parameter number, each process consists of several parameters. Parameter type, each parameter can be of a different type and value. For parameters numbers and values see PARTABLE.DOC and PARVALUE.DOC Parameter types Type Id Character 00h Integer 20h Float 40h Long 40h String 60h Bytes 1 2 4 4 X Range 0…255 0…65535 +-1.18e-38...+-3.39e+38 4 bytes 0... 4294967296 length needs to be specified 3.4 Chaining Chaining can be used to send or request more than one parameter per message. When the parameters are all members of the same process, they can be chained at parameter level. When the parameters are members of different processes, they can be chained at process level. A combination is also possible. For chaining at parameter level the first bit of the parameter number should be set if there is following another parameter at the same process. For chaining at process level the first bit of the process number should be set if there is another process following. 3.5 Status message status Nr Byte 0 : 1 04 2 Node 3 00 9.17.027 Description Start character Fixed message length 4. Node address Command status Page 9 BRONKHORST HIGH-TECH B.V. 4 6 00 No error 01 Process claimed 02 Command error 03 Process error 04 Parameter error 05 Parameter type error 06 Parameter value error 07 Network not active 08 Time-out start character 09 Time-out serial line 0A Hardware memory error 0B Node number error 0C General communication error 0D Read only parameter. 0E Error PC-communication 0F No RS232 connection 10 PC out of memory 11 Write only parameter 12 System configuration unknown 13 No free node address 14 Wrong interface type 15 Error serial port connection 16 Error opening communication 17 Communication error 18 Error interface busmaster 19 Timeout answer 1A No start character 1B Error first digit 1C Buffer overflow in host 1D Buffer overflow 1E No answer found 1F Error closing communication 20 Synchronisation error 21 Send error 22 Protocol error 23 Buffer overflow in module Index or Index pointing to the first byte in the send message for witch the above status applies. Claimed process In case of the status CLAIM ERROR, this field contains the claimed process. ‘\r’ Carriage Return 7 ‘\n’ 5 Status Line Feed *Note: Value from byte 5 of status message may be neglected if value of byte 4 = 0 ! 9.17.027 Page 10 BRONKHORST HIGH-TECH B.V. 3.6 Send parameters Send Nr 0 1 2 3 4 Byte : Length Node 01 or 02 Process Layout Description start character Message length Node address Command write, for type 01 a status message (00) will be returned Cppppppp c Process chained p Process number Cttppppp c Parameter chained t Parameter type p Parameter number Value for all types. For ‘strings’ this field contains the string length. 5 Parameter type 6 Value 1 7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’. 8 Value 3 Value for type ‘float’ or ‘long’. 9 Value 4 Value for type ‘float’ or ‘long’. X Value x X+1 ‘\r’ More value fields follow for type ‘string’ depending on string length. If given string length is zero, the final field should also contain a zero. Carriage Return X+2 ‘\n’ Line Feed 3.7 Request parameter For each requested parameter an index number can be given. The answering node will return this index number with the requested parameter. This can be used to check which parameter is returned when several parameters are requested. Request Nr Byte 0 : 1 Length 2 Node 3 04 * 4 Process (return) * Layout Cppppppp 5 Parameter type & Cttnnnnn index (return) 6 Process -ppppppp 7 Parameter -ttppppp 8 9 10 String length ‘\r’ ‘\n’ 9.17.027 Description start character Message length Node address Command read c Process chained p Process number c Parameter chained t Parameter type n Parameter index 0…31 - Not used p Process number - Not used t Type parameter p Parameter number For parameter type ‘string’ this field contains the expected string length. Carriage Return Line Feed Page 11 BRONKHORST HIGH-TECH B.V. Answer of request Nr Byte 0 : 1 Length 2 Node 3 02 4* Process 6 Description start character Message length Node address Command write Cppppppp c Process chained p Process number c Cttnnnnn Parameter chained Parameter type & index t Parameter type n Parameter index 0…31 Value 1 Value for all types. For ‘strings’ this field contains the string length. 7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’. 8 Value 3 Value for type ‘float’ or ‘long’. 9 Value 4 Value for type ‘float’ or ‘long’. X Value x X+1 ‘\r’ More value fields follow for type ‘string’ depending on string length. If given string length is zero, the final field should also contain a zero. Carriage Return X+2 ‘\n’ Line Feed 5* Layout *The requested module copies these values from the request message directly into the answer message. 9.17.027 Page 12 BRONKHORST HIGH-TECH B.V. 3.8 Initialising RS232/FLOW-BUS interface If you use a RS232/FLOW-BUS interface for communication (without the micro-switch and 2 LED’s), note that this module is not part of the (FLOW-BUS) token-ring network, directly at power-up. This means that it is always necessary to re-initialise the module when power has been interrupted! This is not the case when using an RS232/FLOW-BUS interface with micro-switch, red LED, green LED and RJ45 connector for FLOW-BUS. By means of the switch you may force the interface to find a free address on the FLOW-BUS once. You may skip the initialisation and start directly sending messages. Also when using digital (Multibus) instruments with RS232 directly on the instrument it is not needed to initialise (give a free node-address to) the instrument on the FLOW-BUS because instrument is not physically connected to the FLOW-BUS, but only uses the same protocol. You may start directly sending your messages to the instrument on either the node-address of the instrument in its memory e.g. node 3 (selective response) or to node-address 128 (always response). At power-up situation you can communicate with the RS232 interface only at the RS232 side via node 0. To get part of the FLOW-BUS you have to send an init. command, send the network parameters PNA, SNA, NNA, LNA and BM and send a reset command. From this moment the interface is part of the FLOWBUS. Ensure the module gets a free and unique address on the bus, 2 modules on the same address will cause communication problems. When you are sure that there are no more interfaces in the system, simply force the RS232/FLOW-BUS interface to address 1. This address is reserved for an interface. PC-support software (FLOWB32.DLL, FLOWBUS.DLL and FLOWBUS.LIB) will search for a free address on which the interface will be installed. Follow the steps below to realise correct initialisation for this interface via RS232: Initialisation RS232 interface (needed for FLOW-BUS/RS232 interfaces without switch and LEDs only) Send Response Comment :050001000A49\r\n* Init instruction for node 0 process 0. :04000000XX\r\n No error. :050001000101\r\n PNA = Primary Node Address = 1 :04000000XX\r\n No error. :05000100027F\r\n SNA = Secondary Node Address = 127 :04000000XX\r\n No error. :050001000302\r\n NNA = Next Node Address = 2 :04000000XX\r\n No error. :050001000420\r\n LNA = Last Node Address = 32 (depends on system size) :04000000XX\r\n No error. :050001000502\r\n BM = Bus Management = 67 67 = everything automatically (auto arbitration+gap skipping) 3 = auto arbitration 2 = always busmaster 1 = temporary In older systems: when no R/C-modules in system make BM = 2, when R/C-modules in system (already busmasters present) than make BM = 1; otherwise make = 67 :04000000XX\r\n No error. :050001000A52\r\n Reset instruction for module; from this moment on module will be active on FLOW-BUS at node address = PNA :04000000XX\r\n No error. • Sometimes it could be necessary to repeat the first instruction. Wait approx. 2 seconds before sending the next command. • XX means: don’t care Communication can be closed and interface can be disabled from FLOW-BUS token-ring traffic by sending the command below via the RS232 to the interface. Stop communication RS232 interface Send Comment :050101001101\r\n close communication instruct. for interface module there will be no aswer (because 9.17.027 Page 13 BRONKHORST HIGH-TECH B.V. communication stops) second byte is actual node address for interface (here: 01) 3.9 Examples 3.9.1 Sending setpoint Sending setpoint 50% to node 3 process 1. Setpoint values should be given in a range from 0 to 32000 so for this example 16000 should be send. Node 1 sends to node 3 Nr Byte Layout Description 0 ':' Start character 1 06 Length 6 2 03 Node 3 3 01 Command write with status response 4 01 00000001 C 00 Process not chained P 01 Process 1 5 21 00100001 C 00 Parameter not chained T 20 Parameter type ‘integer’ N 01 Parameter number 1 6 3E Setpoint 16000 = 3E80h 7 80 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer node 3 to node 1 Nr Byte Description 0 ‘:’ Start character 1 04 Fixed message length 4. 2 01 Node address 01 3 00 Command status 4 00 Status ok. 5 05 Status ok, value points to end of send message. 6 ‘\r’ Carriage Return 7 ‘\n’ Line Feed 3.9.2 Sending chained parameters Module at node 1 sends following parameters to module at node 3: Process 0: INIT MODE (10), 64 = soft init Process 1: FLUIDNUMBER(16). 1 Process 1: POLYNOMIAL CONSTANTE A(5), 0.0 Process 1: POLYNOMIAL CONSTANTE B(6), 1.0 Process 1: POLYNOMIAL CONSTANTE C(7), 0.0 Process 1: POLYNOMIAL CONSTANTE D(8), 0.0 Process 0: INIT MODE (10), 82 = reset initmode. Send parameters to node 3 Nr Byte Layout Description 0 ':' 1 1D Length 29 2 03 Node 3 3 01 Command write with status response 4 80 10000000 C 80 Process chained P 00 Process 0 5 0A 00001010 C 00 Parameter not chained 9.17.027 Page 14 BRONKHORST HIGH-TECH B.V. 6 7 40 81 8 C5 9 10 11 12 13 00 00 00 00 C6 14 15 16 17 18 3F 80 00 00 C7 19 20 21 22 23 00 00 00 00 C8 24 25 26 27 28 00 00 00 00 00 29 30 31 32 T 00 Parameter type ‘character’ N 0A Parameter number 10 01000000 Parameter value 64 set soft init mode 10000001 C 80 Process chained P 01 Process 1 11000101 C 80 Parameter chained T 40 Parameter type ‘float’ N 05 Parameter number 5 Parameter value ‘float’ 0.0 11000110 C 80 Parameter chained T 40 Parameter type ‘float’ N 06 Parameter number 6 Parameter value ‘float’ 1.0 1100111 C 80 Parameter chained T 40 Parameter type ‘float’ N 07 Parameter number 7 Parameter value ‘float’ 0.0 11001000 C 80 Parameter chained T 40 Parameter type ‘float’ N 08 Parameter number 8 Parameter value ‘float’ 0.0 00000000 C 00 Process not chained P 00 Process 0 0A 00001010 C 00 Parameter not chained T 00 Parameter type ‘character’ N 0A Parameter number 10 52 01010010 Parameter value 82, reset init mode ‘\r’ Carriage Return ‘\n’ Line Feed 9.17.027 Page 15 BRONKHORST HIGH-TECH B.V. Answer node 3 to node 1 Nr Byte Description 0 ‘:’ Start character 1 04 Fixed message length 4. 2 03 Node address 3 00 Command status 4 00 Status ok. 5 1C 6 7 Status ok, value points to end of send message. ‘\r’ Carriage Return ‘\n’ Line Feed 3.9.3 Request setpoint Request setpoint from node 3 process 1, type integer. Request by node 1 Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read 4 01 00000001 C 00 Process not chained (return) P 01 Process 1 (return) 5 21 00100001 C 00 Parameter not chained (return) T 20 Parameter type ‘integer’ (return) N 01 Parameter index 1 (return) 6 01 -0000001 P 00 Process 1 7 21 -0100001 T 20 Parameter type ‘integer’ P 01 Parameter number 1 ( setpoint) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer by node 3 Nr Byte Layout 0 ':' 1 06 2 03 3 02 4 01 00000001 5 21 6 7 8 9 3E 80 ‘\r’ ‘\n’ Description Length 6 Node 3 Command write C 00 Process not chained P 01 Process 1 ( receiving process) 00100001 C 00 Parameter chained T 20 Parameter type ‘integer’ N 0C Parameter index 1 Value 3E80h = 16000 = 50% Carriage Return Line Feed 3.9.4 Request chained parameters Module at node 1 sends a request for the following parameters to module at node 3: Process 0: LNA(5), ARBITRAGE(6), CHANNELS(12) and INSTRUMENT TYPE(13). Process 1: POLYNOMIAL CONSTANTES A(5), B(6), C(7), D(8) and FLUIDNUMBER(16). 9.17.027 Page 16 BRONKHORST HIGH-TECH B.V. Request by node 1 Nr Byte Layout 0 ':' 1 1F 2 03 3 04 4 81 10000001 5 8C 10001100 6 7 00 04 -0000000 -0000100 8 8D 10001101 9 10 00 05 -0000000 -0000101 11 8E 10001110 12 13 00 0C -0000000 -0001100 14 0F 00001111 15 16 00 0D -0000000 -0001101 17 01 00000001 18 D0 11010000 19 20 01 45 -0000001 -1000101 21 D1 11010001 22 23 01 46 -0000001 -1000110 24 D2 11010010 25 26 01 47 -0000001 -1000111 9.17.027 Description Length 31 Node 3 Command read C 80 Process chained (return) P 01 Process 1 (return) C 80 Parameter chained (return) T 00 Parameter type ‘character’ (return) N 0C Parameter index 12 (return) P 00 Process 0 T 00 Parameter type ‘character’ P 04 Parameter number 4 C 80 Parameter chained (return) T 00 Parameter type ‘character’ (return) N 0D Parameter index 13 (return) P 00 Process 0 T 00 Parameter type ‘character’ N 05 Parameter number 5 C 80 Parameter chained (return) T 00 Parameter type ‘character’ (return) N 0E Parameter index 14 (return) P 00 Process 0 T 00 Parameter type ‘character’ P 0C Parameter number 12 C 00 Parameter not chained (return) T 00 Parameter type ‘character’ (return) N 0F Parameter index 15 (return) P 00 Process 0 T 00 Parameter type ‘character’ P 0D Parameter number 13 C 00 Process not chained (return) P 01 Process 1 (return) C 80 Parameter chained (return) T 40 Parameter type ‘float’ (return) N 10 Parameter index 16 (return) P 01 Process 1 T 40 Parameter type ‘float’ P 05 Parameter number 5 C 80 Parameter chained (return) T 40 Parameter type ‘float’ (return) N 11 Parameter index 17 (return) P 01 Process 1 T 40 Parameter type ‘float’ P 06 Parameter number 6 C 80 Parameter chained (return) T 40 Parameter type ‘float’ (return) N 12 Parameter index 18 (return) P 01 Process 1 T 40 Parameter type ‘float’ Page 17 BRONKHORST HIGH-TECH B.V. 27 D3 11010011 28 29 01 48 -0000001 -1001000 30 14 00010100 31 32 01 10 -0000001 -0010000 33 34 ‘\r’ ‘\n’ Answer by node 3 Nr Byte Layout 0 ':' 1 22 2 03 3 02 4 81 10000001 5 8C 10001100 6 7 06 8D 10001101 8 9 43 8E 10001110 10 11 01 0F 00000001 00001111 12 13 02 01 00000001 14 D0 11010000 15 16 17 18 19 00 00 00 00 D1 9.17.027 P C T N P T P C T N P T P 07 80 40 13 01 40 08 00 00 14 01 00 10 Parameter number 7 Parameter chained (return) Parameter type ‘float’ (return) Parameter index 19 (return) Process 1 Parameter type ‘float’ Parameter number 8 Parameter not chained (return) Parameter type ‘character’ (return) Parameter index 20 (return) Process 1 Parameter type ‘character’ Parameter number 16 Carriage Return Line Feed Description Length 34 Node 3 Command write C 80 Process chained P 01 Process 1 ( receiving process) C 80 Parameter chained T 00 Parameter type ‘character’ N 0C Parameter index 12 Parameter value 6 C 80 Parameter chained T 00 Parameter type ‘character’ N 0D Parameter index 13 Parameter value 67 C 80 Parameter chained T 00 Parameter type ‘character’ N 0E Parameter index 14 Parameter value 1 C 00 Parameter not chained T 00 Parameter type ‘character’ N 0F Parameter index 15 Parameter value 2 C 00 Process not chained P 01 Process 1 ( receiving process) C 80 Parameter chained T 40 Parameter type ‘float’ N 10 Parameter index 16 Parameter value ‘float’ 0.0 11010001 C T N 80 40 11 Parameter chained Parameter type ‘float’ Parameter index 17 Page 18 BRONKHORST HIGH-TECH B.V. Parameter value ‘float’ 1.0 20 21 22 23 24 3F 80 00 00 D2 25 26 27 28 29 00 00 00 00 D3 30 31 32 33 34 00 00 00 00 14 35 02 36 ‘\r’ Carriage Return 37 ‘\n’ Line Feed 4 11010010 C 80 Parameter chained T 40 Parameter type ‘float’ N 12 Parameter index 18 Parameter value ‘float’ 0,0 11010011 C 80 Parameter chained T 40 Parameter type ‘float’ N 13 Parameter index 19 Parameter value ‘float’ 0,0 00010100 C 00 Parameter not chained T 00 Parameter type ‘character’ N 14 Parameter index 20 Parameter value 2 Dual interface operation When operating a controller (reading measured value and sending setpoint) for proper operation it is important that the controller gets its setpoint from the right source. Setpoints may come from different sources: analog input, fieldbus interface or RS232 or may be overruled by close valve or open valve (purge) commands. Therefore it is important to know what is the setpoint source of the controller. This can be set by means of parameter controlmode (process 1, parameter 12). In some cases it is possible that the setpoints may come from 2 sources at the same time. The last send setpoint will be valid and send to the controller. This is the case in controlmode = 0, when setpoints may come through any fieldbus interface or RS232. However, there could be situations where control over the instrument seems impossible. This is the case when the instrument comes into a safe-state e.g. when fieldbus communication is disturbed or disconnected. Valve will be forced to a safe state automatically: closed (NC) or fully open (NO). In case you want to get control back via RS232 operation, you have to change the controlmode. When controlmode gets value 18, safe state will be overruled and sending setpoints via RS232 interface will have effect on the controller again. See also document nr. 9.17.023 for more detailed description about digital instrument parameters and their behaviour. 9.17.027 Page 19 BRONKHORST HIGH-TECH B.V. 5 Parameter information 5.1 General FLOW-BUS is used for parameter value exchange between instruments and operation modules (keyboard or PC-interface). Parameter information consists of several properties for behaviour within the FLOW-BUS system. In the parameter table you will find a list of parameters and their properties filled in. In the parameter value table values are described more detailed if necessary. These list consists mostly of parameters for mode settings. Property description in parameter table: Item Description Parameter unique parameter number (also used for DDE-communication : P(x)) parameter name (max. 10 characters) Name used for parameter identification process where parameter is used on FLOW-BUS module used for communication directly through RS232 when filled in the table, this value has process to be used (for parameters located in only 1 process) when empty in the table, process has to be determined from the FLOW-BUS system information (for parameters located in more than one process, f.i. setpoint, measure); parameter number in process on FLOW-BUS module used for commucication directly FBnr through RS232 variable type for information about amount of bytes c : (unsigned) char type; 1 byte; value 0..255 i : (unsigned) integer type; 2 bytes; value 0..65535 VarType f : float type, 4 bytes, value +-1.18E-38..+-3.39E+38 (IEEE-floating point notation) l : (unsigned) long type, 4 bytes, value 0..4294967295 data types > 1 byte are MSB first. variable length to indicate length of string of chars used in combination with VarType c for transportation of strings through FLOW-BUS: value 0..65535 VarLength indicates the amount of bytes for a parameter type VarLength -2: indicates that a string is zero-terminated, not defined for length X : indicates a string with a length of X bytes (characters) 0 : means no info required. minimum value of parameter allowed when parameter is read/written via RS232, the Min value will be checked on this limit (error when out of limit) maximum value of parameter allowed when parameter is read/written via RS232, the Max value will be checked on this limit (error when out of limit) Read indication if parameter is allowed to be read via FLOW-BUS Write indication if parameter is allowed to be written via FLOW-BUS indication if parameter should be polled continuously by RS232 application in order to Poll keep (changing) parameter information up to date indication if parameter is for advanced users only these are mainly parameters for Advanced maintenance/service Secured High security Description indication if parameter is secured for use through FLOW-BUS reading this parameter is possible, but changing it needs special handling indication if parameter is highly secured (only few parameters) reading this parameter is possible, but changing it needs special handling short description about meaning of parameter or what it is used for Parameter acceptance: Changing parameter values is possible when a parameter is not read-only and not secured. The range and type of parameters are described in the tables. When parameter values are out of range they will be either 'clipped' on the nearest value allowed or you will get an error message: 'parameter value error'. Parameter numbers: 9.17.027 Page 20 BRONKHORST HIGH-TECH B.V. All parameter information is referenced to the parameter number. This is a unique number for a parameter to avoid redundancy. These numbers are needed for DDE communcation only. 9.17.027 Page 21 BRONKHORST HIGH-TECH B.V. For communication with FLOW-BUS through other ways than DDE: directly via RS232 ASCII-strings or via C-libraries (DOS or Windows), use the parameter numbers for the FLOW-BUS modules (in column FBnr of PARTABLE). Now you will always have to know the node-address of the instrument on the FLOW-BUS, the process number on the instrument and the parameter number on the instrument. Process nr could be read from the table or has to be determined, when nothing is filled-in. In most cases process number will be = 1. Node-address should be determined also. This is the node-address of the instrument on the FLOW-BUS. Newer RS232 protocols on multibus instruments accept node = 128. When sending messages to this node address, the message will be always accepted, unregarding the node-address of the instrument on the bus. When possible see system description added to manual for link between channels and node-processes. NOTE: It is important to know that not all parameters are available on all FLOW-BUS/Multibus devices. For more details about parameters and their use see also document nr. 9.17.023 for description of digital instruments. If you have the program FLOWDDE, you can also get an overview of which parameters are available on which devices. In other cases ask your local sales representative or send an e-mail to [email protected]. Following tables will give information about parameters, their properties and their possible values. 9.17.027 Page 22 5.2 Parameter properties Para meter 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 27 28 29 30 31 32 33 34 35 36 37 38 Name identstrng pna sna nna lna arbitrage initreset measure setpoint setpslope analoginp cntrlmode polycnst A polycnst B polycnst C polycnst D polycnst E polycnst F polycnst G polycnst H capacity sensortype capunit fluidnr fluidname claimnode modify alarminfo chanamount firstchan lastchan hostcontrl alrmmsgTA alrmmsgnr relstatus actualval signinpsel resinpsel Proc FBnr VarT VarLe ess ype ngth 0 0 0 0 0 0 0 0 0 0 9 10 10 10 0 1 2 3 4 5 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 12 13 14 1 0 1 2 0 1 2 c c c c c c c i i i i c f f f f f f f f f c c c c c c c c c c c c c c f c c Min Max Read 0 0 0 0 0 0 0 0 0 0 0 -10000000000 -10000000000 -10000000000 -10000000000 -10000000000 -10000000000 -10000000000 -10000000000 0.0000000001 0 0 0 128 128 128 128 255 255 65535 32767 30000 65535 255 10000000000 10000000000 10000000000 10000000000 10000000000 10000000000 10000000000 10000000000 10000000000 255 255 7 0 0 0 1 1 1 0 128 255 255 120 120 120 1 0 1000000000 -2 10 16 16 8 8 8 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Write Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No Yes Yes Poll No No No No No No No Yes Yes No Yes No No No No No No No No No No No No No No No No Yes No No No No Yes Yes No Yes No No Advanced No Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No Yes Yes No No No No Yes No No No No No No Secured No Yes Yes No No Yes No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No No No No No No No No No No No Description identnr.+softwareversion[+serialnr.] primary node address: network parameter FLOW-BUS secundary node address: network parameter FLOW-BUS next node address: network parameter FLOW-BUS last node address: network parameter FLOW-BUS FLOW-BUS arbitrage setting and/or automatic optimization init and reset security key commands for network/parameter settings measured value (100% = 32000) setpoint: wanted value (100% = 32000) setpoint ramp signal 0..100 % in up to 3000 sec. analog input signal, normally used for ext. setp. (100% = 32000) control mode selection for instrument or module polynomial constant A (offset) polynomial constant B (span] polynomial constant C polynomial constant D polynomial constant E (offset) for setpoint or power value polynomial constant F (span) for setpoint or power value polynomial constant G for setpoint or power value polynomial constant H for setpoint or power value maximum value at 100% in sensor base units sensor type information for actual reading and sensor/controller indication pointer to selected actual readout unit (index for list of readout units] fluid number: pointer to polynome, name and cap. name of fluid node address of module with operation rights contains number(s) of changed parameters status information of several alarms/errors in the instrument amount of channels which can be operated first channel that can be operated last channel that can be operated operation by HOST computer enable flag alarm message string with unit type information alarm message string with unit number information status of relays/potential free contacts actual value of counter signal input selection external reset input enable/disable BRONKHORST HIGH-TECH B.V. 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 limit delaytime duratntime vlvoutset reloutset opermodeTA readunit readfact resetunit TdValveDn TdValveUp TdSensorDn TdSensorUp CycleTime AnalogMode VrefOutput ValveOut DynDispFct StaDispFct CalMode ValveOffst Monitor AlarmReg1 AlarmReg2 CalRegZS1 CalRegFS1 CalRegZS2 CalRegFS2 ADCcntrReg BridgePotm AlarmEnble TestMode ChanSelect ContrResp ErrInFilCo ExpSmooCon AnOutCorZS AnOutCorFS AnInpCorZS AnInpCorFS TuningMode DefVlvType 9.17.027 114 115 116 114 117 117 115 116 115 114 114 116 116 116 116 114 116 115 115 115 114 117 117 115 114 3 4 5 6 7 8 9 10 12 9 10 11 12 12 3 6 1 1 2 1 7 2 2 3 1 2 3 4 4 5 4 5 6 5 3 4 21 22 23 24 7 6 f c c c c c c f c f f f f c c i l f f c i c c c l l l l l c c c c c f f i i i i c c 8 8 8 8 0 0 0 1000000000 99265959 99235960 0 9 0.0000000001 0 0 0 0 0 1 0 0 0 0 0 0 0 0 10000000000 1 10000000000 10000000000 10000000000 10000000000 255 255 65535 16777216 1 1 255 65535 255 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 16777216 16777216 16777216 16777216 16777216 255 1 255 32 255 1 1 65535 65535 65535 65535 255 255 7 8 8 Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes limit/batch for counter in sensor standard units delay time string in days,hours,minutes,seconds duration time string in days,hours,minutes,seconds valve output setting relay output setting operation mode of T/A module readout unit string readout factor matching readout unit string reset unit command valve output differentiation time constant downwards valve output differentiation time constant upwards sensor signal differentiation time constant downwards sensor signal differentiation time constant upwards cycle time * 10 msec. main loop signal processing analog mode selection for analog operation reference voltage output signal for analog operation valve output signal (24-bit number in range 0…14.3Vdc/0…23.3Vdc) dynamic display factor for display filter (goes with par 57) static display factor for display filter (goes with par 56) calibration mode selection (not active until cntrlmode has been set to value valve offset: amount of DAC steps within 1 potmeter step monitor: output signal (measure) selection for bus and analog output alarm register containing warning flags alarm register containing critical error flags calibration register zero scale input 1 ADC calibration register full scale input 1 ADC calibration register zero scale input 2 ADC calibration register full scale input 2 ADC ADC control register sensor bridge zero potmeter setting broadcast alarm messsage enable flag test mode selection (not active until cntrlmode has been set to value 5) channel selection ADC controller response for normal steps analog input filter constant sensor input filter constant analog output correction factor zero scale (measure output) analog output correction factor full scale (measure output) analog input correction factor zero scale (external setpoint) analog input correction factor full scale (external setpoint) (auto)tuning mode selection (not active until cntrlmode has been set to value valve type (needed for controlling behaviour) Page 24 BRONKHORST HIGH-TECH B.V. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 GlobModify SpanCorr VlvCrvStps MemShipNor MemShipOpn IOStatus FuzzStNeNo FuzzStPoNo FuzzStOpen DeviceType ModelNum SerialNum MfrConfig BHT1 BHT2 BHT3 BHT4 BHT5 BHT6 BHT7 BHT8 BHT9 BHT10 PulseHight Version PressSensr BaroPress AnIn1CorZS AnIn1CorFS AnIn2CorZS AnIn2CorFS AnOu1CorZS AnOu1CorFS Reset UserTag AlrmMaxLim AlrmMinLim AlrmMode AlrmOutMod AlrmStpMod AlrmNwSetp CntrValue 9.17.027 0 114 114 114 114 114 114 114 114 113 113 113 113 118 118 118 118 118 118 118 118 118 118 114 113 115 116 115 113 97 97 97 97 97 97 104 19 7 8 9 10 11 13 14 15 1 2 3 4 1 2 3 4 5 6 7 8 9 10 16 5 9 8 25 26 27 28 29 30 8 6 1 2 3 4 5 6 1 c f c c c c c c c c c c c c i l i c c c c l c c c c f i i i i i i c c i i c c c i f 0 0 255 1 0 255 0 -3000000000 0 0 0 0 0 -3000000000 0 0 65535 3000000000 65535 255 255 255 255 3000000000 1 255 0 800 0 0 0 0 0 0 0 255 1200 65535 65535 65535 65535 65535 65535 255 0 0 0 0 0 0 0 32767 32767 255 255 1 32767 9999999.99 -2 -2 -2 -2 -2 -2 6 14 20 16 -2 5 -2 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No Yes No No No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No No No No No Yes Yes No Yes No Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes contains number(s) of changed processes for indirect polling correction factor valve curve ratio high/low area Valve curve correction for controller (max. factor*0.1, flow where factor = 1) array with memberships for normal Fuzzy controller array with memberships for 0-open Fuzzy controller IO status byte for jumper settings and LED signal modes array with neg nor output steps for Fuzzy contr. array with pos nor output steps for Fuzzy contr. array with open at 0 output steps for Fuzzy contr. (FLOW-BUS) device type information string model number information string serial number information string (to be changed by Bronkhorst HT only) manufacturing configuration information string special BHT parameter (to be changed by Bronkhorst HT only) special BHT parameter special BHT parameter special BHT parameter special BHT parameter special BHT parameter special BHT parameter special BHT parameter special BHT parameter special BHT parameter (to be changed by Bronkhorst HT only) height of open at zero pulse train for valve revision number of firmware type of pressure sensor mbar atmospheric (central) barometer pressure analog sensor signal input correction factor zero scale analog sensor signal input correction factor full scale analog Vref input correction factor zero scale analog Vref input correction factor full scale analog setpoint output correction factor zero scale analog setpoint output correction factor full scale reset facilities (program/alarm/batchcounter) user definable alias string maximum limit for sensor signal to trigger alarm situation minimum limit for sensor signal to trigger alarm situation alarm mode alarm relais activity mode during alarm situation setpoint change enable during alarm situation new/safe setpoint during alarm situation (until reset) actual counter value Page 25 BRONKHORST HIGH-TECH B.V. 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 CntrUnit CntrLimit CntrOutMod CntrStpMod CntrNwSetp CntrUntstr capunitstr CntrMode HwRev RCreadfact channumber masterchan RCslavefct inputnode inputproc RCreadunit SlaveFact% VrefInput RespStable temperatur pressure time calvolume sensornr rangeselct TimeOut frequency imp/m3 RefVolFlow volumeflow delta-p scalefact sensorname RstAlarmEn RstCountEn MasterNode MasterProc InstrNode InstrProc RangeMin RangeMax Relay/TTL 9.17.027 104 104 104 104 104 104 104 113 33 33 114 33 33 33 33 115 33 33 33 33 33 33 97 104 33 33 33 33 33 33 115 2 3 4 5 6 7 31 8 7 1 2 3 4 5 6 7 1 2 17 7 8 9 10 16 10 2 9 10 5 6 11 13 17 9 9 14 15 16 17 18 20 11 c f c c i c c c c f c c I c c c f i c f f f f c c i f f f f f i c c c c c c c f f c 0 0 0 0 0 31 10000000 255 1 32767 0 255 0.0000000001 1 0 0 0 0 10000000000 120 120 32000 128 128 0 0 0 -50 -10000000 0 0 0 0 0 0 0 0 0 -100000 1 500 65535 255 100 10000000 1000000000 1000000000 4 99 30000 100000 10000000000 10000000000 10000000000 100000 10000 0 0 1 1 1 1 -10000000000 -10000000000 0 15 7 128 128 128 128 10000000000 10000000000 1 4 7 1 7 10 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No Yes Yes Yes Yes Yes No Yes No Yes Yes Yes No Yes Yes Yes Yes No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No Yes No Yes Yes Yes No Yes Yes No Yes No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No No No No Yes Yes No No No Yes No No No Yes No No Yes No Yes No No No No Yes Yes Yes No No Yes Yes Yes Yes Yes counter unit counter limit/batch counter relais activity mode when limit/batch has been reached setpoint change enable during counter limit/batch situation (until reset) new/safe setpoint at counter limit/batch situation (until reset) (normally = 0%) readout string at counter (informative) readout string at capunit (informative) counter mode minimum required hardware revision level for firmware version readout factor for direct reading (changes with readunit: local on module, channel number for operation master channel for master-slave operation RC slave factor physical node address for channel number physical process for channel number readout unit for direct reading (local variable on module: read only) slave factor for master slave control (setp = master output * slave factor) reference voltage input for setpoint signal controller response when controller is stable: |measure-setpoint| < 2% absolute temperature in degrees Celsius absolute pressure in mbar time in milliseconds calibrated volume in litres pointer to sensor number in calibration tube (FPP) Piston Prover operation mode (write) and status information (read back) maximum admitted duration time for specific procedure frequency in Hz impulses per m3 volume volume flow referenced to normal conditions i.e. 0 °C, 1013.25 hPa(a) in volume flow at actual conditions in l/min relative pressure between atmosphere and sensor position scaling factor (multiplication) for readout on display (for optimal resolution) label with information about stopsensor enable reset of alarm by: keyboard, external signal, FLOW-BUS, automatic enable reset of counter by: keyboard, external signal, FLOW-BUS, node number of master instrument output signal for a slave process number of master instrument output signal for a slave node number of instrument to be operated by another module process number of instrument to be operated by another module minimum value at 0% for special user readout unit maximum value at 100% for special user readout unit relay/TTL output setting (disabled when used by alarm or counter) Page 26 BRONKHORST HIGH-TECH B.V. 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 RespOpen0 ContrType PIDKp PIDKi PIDKd Density CalCertNr CalDate ServiceNr ServDate IdentNr BHT11 PowerMode Pupstream Pdownstrm Orifice FluidTemp AlrmDelay capacity0% NumOfChan DeviceFunc ScanChan ScanPar ScanTime ScanData UValveOpen NrOfRuns MinProTime LeakRate ModeInfReq ModeInfOpt ModeInfDes CalType MassFlow BusAddress InterfConf Baudrate BusDiagnos NrOfVanes Fieldbus fMeasure fSetpoint 9.17.027 114 114 114 114 114 33 113 113 113 113 113 118 115 113 113 113 113 97 33 0 0 123 123 123 123 114 115 115 116 115 115 115 115 33 125 125 125 125 115 125 33 33 18 20 21 22 23 21 8 9 10 11 12 11 12 13 14 15 16 7 22 18 20 1 3 4 10 24 13 14 9 15 16 17 18 4 10 3 9 20 22 21 0 3 c c f f f f c c c c c c c f f f f c f c c c c i c f c c f c c c c f c c l c c c f f 0 0 -10000000000 -10000000000 -10000000000 -10000000000 255 255 10000000000 10000000000 10000000000 10000000000 0 0 0 -100000 -100000 0 -50 0 -10000000000 0 0 1 0 0 255 255 50 100000 100000 1000 100 255 10000000000 120 255 255 255 65535 0 0 0 0 24 255 255 1 0 0 1 0 0 255 10000000000 126 3 10000000000 0 255 -10000000000 0 10000000000 10000000000 15 8 15 8 -2 4 255 255 -2 -2 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No Yes Yes Yes Yes Yes No No Yes No Yes Yes Yes No Yes No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No Yes No No Yes Yes No No Yes No Yes No Yes No Yes No No No controller response when valve opens from zero controller settings for special purpose PID factor Kp PID factor Ki PID factor Kd Density of selected fluid in kg/m3 Number of calibration certificate (last basic calibration) Date of last (basic) calibration Servicenumber for repair/rebuilding/recalibration Date of last service action Identification number (type) of instrument/device special BHT parameter (to be changed by Bronkhorst HT only) power supply indication in Vdc upstream pressure of fluid in bara (for first fluidnr only) downstream pressure of fluid in bara (for first fluidnr only) orifice diameter in mm temperature of fluid through instrument (for first fluidnr only) time alarm and reset action will be delayed when alarm limit has been capacity of instrument at zero 0% in sensor base units (mostly equal to zero) number of instrument channels available for this device function of device Channel number to scan with real time information (to be set once) Parameter number to scan with real time information (to be set once) Scan interval time in msec between two samples (to be set once) Scanned data with time label (can be readout event by event) First-step offset voltage for valve when opening from 0% (UopenAmount of runs of a piston prover Minimum process time of a piston prover in 0.1 seconds Leak rate piston prover Sets instr. in info mode for 1 read-cycle to check available parameter options Gives info about possible values of a mode in an array as result of ModeInfo Gives description about one of the mode options Enables/disables options for calibration device (8 bits for 8 options) Real mass flow in kg/min Station address for actual fieldbus system other than FLOW-BUS Configuration setting for interface to other bus-systems Baudrate for actual fieldbus system other than FLOW-BUS Bus diagnose string for actual fieldbus system other than FLOW-BUS Number of vanes for use in a rotor meter Fieldbus for which instrument has been equiped measured value for direct reading (in capunits, max.= capacity) setpoint: wanted value for direct reading (in capunits, max.= capacity) Page 27 BRONKHORST HIGH-TECH B.V. 207 Mass 9.17.027 33 23 f 0 10000000000 Yes No No No No Mass in g Page 28 5.3 Parameter values: Parameter 1 2 3 4 5 6 6 6 6 7 8 9 10 11 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 13 14 15 16 17 18 19 20 21 22 22 22 22 22 22 22 22 Name identstrng pna sna nna lna arbitrage arbitrage arbitrage arbitrage initreset measure setpoint setpslope analoginp cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode polycnst A polycnst B polycnst C polycnst D polycnst E polycnst F polycnst G polycnst H capacity sensortype sensortype sensortype sensortype sensortype sensortype sensortype sensortype Filter Value 1 2 3 67 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 0 1 2 3 4 128 129 130 Description IdentNr (parameter 175) + serialnr/version nr 1..128 1..128 (pna/127=broadcast message receive enabled) 2..128 (pna+1) (automatic change by optimize function) 3..128 (automatic change by optimize function) temporary busmaster always busmaster automatic busmaster auto busmaster and auto bus optimalization (fast token ring) ask BHT for use 0...32767 (32000=100 %) 0...32767 (32000=100 %) 0...30000 (*0.1 seconds) 0...32767 (32000=100 %) setpoint = BUS setpoint setpoint = analog input setpoint = master output(FLOW-BUS) * slave factor(FLOWclose valve setpoint idle (no reaction on changes in sensor signal) testmode enable (select subject with par 70) tuningmode enable (select subtject with par 79) setpoint = 100% purge valve (fully open) calibration mode enable (select subject with par 58) setpoint = master output(analog in) * slave factor(FLOW-BUS) setpoint = keyboard OR FLOW-BUS setpoint setpoint = 0% setpoint = master output(FLOW-BUS) * slave factor(analog in) (FPP) Range select mode (FPP) Manual start sensor select, automatic end sensor (FPP) Automatic start sensor select, manual end sensor (FPP) Automatic start and end sensor setpoint = RS232 setpoint 100% value of instrument (goes with par 23) pressure (controller) liquid volume (controller) liquid/gas mass (controller) gas volume (controller) other sensor type (controller) pressure (sensor) liquid volume (sensor) liquid/gas mass (sensor) BRONKHORST HIGH-TECH B.V. 22 22 23 24 25 26 27 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 44 44 44 44 44 44 44 45 46 47 48 49 50 51 9.17.027 sensortype sensortype capunit fluidnr fluidname claimnode modify alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo chanamount firstchan lastchan hostcontrl alrmmsgTA alrmmsgnr relstatus actualval signinpsel resinpsel limit delaytime duratntime vlvoutset reloutset opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA readunit readfact resetunit TdValveDn TdValveUp TdSensorDn TdSensorUp 131 gas volume (sensor) 132 other sensor type (sensor) see table with capacity units (depends on sensor type) &H01 &H01 &H02 &H02 &H04 &H04 &H08 &H08 &H10 &H10 &H20 &H20 &H40 &H40 &H80 &H80 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1...128 0xXX=modified par nr, 0xFF=more than on par changed no error message in alarm error status register at least 1 error message in alarm error status register no warning message in alarm warning status register at least 1 warning message in alarm warning status register no minimum alarm message (measure>mimimum limit) minimum alarm message for measured signal no maximum alarm message (measure<maximum limit) maximum alarm message for measured signal batch counter has not reached its limit batch counter has reached its limit response O.K. (setpoint-measure within limit) response alarm message: setpoint-measure is too high master output signal O.K. (or not used) master output signal not received: check master instrument hardware O.K. hardware error message: check your hardware '0' = not activated, '1' = activated ' '=no value,'+'=pos value,'-'=neg value input 'E'=enable,' '=disable 0 1 2 3 4 5 6 7 '0'=do nothing, '1'=close valve 'L'=low, 'H'=high, 'P'=pulse (1 sec.) OFF A: MAX & RESP AUTO; T: UP TO LIMIT A: MIN & RESP AUTO; T: UP AND REPEAT A: MAX & RESP; T: DOWN FROM LIMIT A: MIN & RESP; T: DOWN AND REPEAT A: MAXIMUM ALARM; T: ALWAYS UP A: MINIMUM ALARM A: RESPONSE ALARM 1=reset T/A unit Page 30 BRONKHORST HIGH-TECH B.V. 52 53 53 53 53 53 54 55 56 57 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 59 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 61 62 63 64 9.17.027 CycleTime AnalogMode AnalogMode AnalogMode AnalogMode AnalogMode VrefOutput ValveOut DynDispFct StaDispFct CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode ValveOffst Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor Monitor AlarmReg1 AlarmReg2 CalRegZS1 CalRegFS1 0 1 2 3 4 0...5 Vdc operation 0...10 Vdc operation 0...20 mA operation 4...20 mA operation 15...20 mA operation 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 0…1.0 (0= filter maximum, 1 = filter minimum) 0…1.0 (0= filter maximum, 1 = filter minimum) idle: no action adc self calibration dmfc dmfc dmfc dmfc dmfc dmfc dmfc zero sensor bridge circuit adjust Vref output by connecting it to analog in adjust analog out by connecting it to analog in adjust valveoutput by connecting it to analog in dmfc dmfc analog output = 0 % analog output = 100 % analog output = 50 % 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 (filtered) setpoint controller error input signal controller output signal to valve sensor signal slow sensor signal slow filtered linearization output differentiator output differentiator output filtered normal sensor signal (Output) analog input signal reference signal input (Vref) mass flow in display unit (normally ln/min) volume flow in l/min temperature in °C pressure absolute in mbara time in msec/frequency in Hz. calibrated volume at actual sensor in ml delta-P pressure in mbarg atmospheric (barometer) pressure in mbara mass flow in kg/min Page 31 BRONKHORST HIGH-TECH B.V. 65 66 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 68 69 69 70 70 70 70 70 70 70 70 70 70 70 70 70 71 71 72 73 74 75 9.17.027 CalRegZS2 CalRegFS2 ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg BridgePotm AlarmEnble AlarmEnble TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode ChanSelect ChanSelect ContrResp ErrInFilCo ExpSmooCon AnOutCorZS &H000FFF &H001000 &H001000 &H002000 &H002000 &H004000 &H004000 &H008000 &H008000 &H010000 &H010000 &H020000 &H020000 &H1C0000 &H1C0000 &H1C0000 &H1C0000 &H1C0000 &H1C0000 &H1C0000 &H1C0000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 0 1 0 1 0 1 0 1 0 1 0 1 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 0 1 2 3 4 5 6 7 8 9 10 11 12 1 2 ADC filter selection: value = 5117.1875/-3dB freq.(Hz.) ADC bipolar mode ADC unipolar mode ADC burn-out current off ADC burn-out current on ADC output compensation current off ADC output compensation current on ADC 16-bit word length ADC 24-bit word length ADC no power down mode (normal) ADC power down mode ADC input channel 1 selection ADC input channel 2 selection ADC gain = 1x ADC gain = 2x ADC gain = 4x ADC gain = 8x ADC gain = 16x ADC gain = 32x ADC gain = 64x ADC gain = 128x ADC normal (sampling) mode ADC activate self calibration on selected channel ADC activate system calibration ZS on selected channel ADC activate system calibration FS on selected channel ADC activate system offset calibration on selected channel ADC activate background calibration on selected channel ADC read/write ZS calibration coefficients on sel. channel ADC read/write FS calibration coefficients on sel. channel disable enable idle; no action uProcessor IO RAM FRAM ADC DAC sensor valve drive circuit Vref FLOW-BUS calibration keyboard AD channel 1 AD channel 2 128=normal, <128=slower, >128=faster 0…1.0 (0= filter maximum, 1 = filter minimum) 0…1.0 (0= filter maximum, 1 = filter minimum) DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset Page 32 BRONKHORST HIGH-TECH B.V. 76 77 78 79 79 79 79 79 79 80 80 80 80 80 81 82 83 84 85 86 86 86 86 86 86 86 86 86 86 86 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 106 106 9.17.027 AnOutCorFS AnInpCorZS AnInpCorFS TuningMode TuningMode TuningMode TuningMode TuningMode TuningMode DefVlvType DefVlvType DefVlvType DefVlvType DefVlvType GlobModify SpanCorr VlvCrvStps MemShipNor MemShipOpn IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus FuzzStNeNo FuzzStPoNo FuzzStOpen DeviceType ModelNum SerialNum MfrConfig BHT1 BHT2 BHT3 BHT4 BHT5 BHT6 BHT7 BHT8 BHT9 BHT10 PulseHight Version PressSensr PressSensr PressSensr 0 1 2 3 4 5 0 1 2 3 4 2000 = 1 * multiplication DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset 2000 = 1 * multiplication idle; no action sensor valve Fuzzy controller normal operation Fuzzy controller open at zero PID controller normally closed normally opened normally closed inverse controlled normally opened inverse controlled remain position 0xXX=modified proc nr, 0xFF=more than one proc changed boost factor * 0.1, percentage from where amplification = 1* &H03 &H03 &H03 &H03 &H0C &H0C &H0C &H0C &H10 &H20 &H40 &H80 0 1 2 3 0 1 2 3 16 32 64 128 Red LED off Red LED on Red LED blinking slow Red LED blinking fast Green LED blinking fast Green LED on Green LED blinking slow WINK; RED-GREEN-RED-GREEN blinking 0x10: external initialization jumper set 0x20: internal initialization jumper set 0x40: cntrlmode = 1: setpoint = analog input 0x80: special jumper set / micro switch pressed 0 delta-P 0..5" W.C. 1 delta-P 0...10" W.C. 2 absolute pressure 800-1200 mbar Page 33 BRONKHORST HIGH-TECH B.V. 106 106 106 106 106 106 107 108 109 110 111 112 113 114 114 114 114 114 114 115 116 117 118 118 118 118 119 119 119 120 120 121 122 123 124 125 125 125 126 127 128 129 130 130 130 131 132 133 134 135 136 137 138 9.17.027 PressSensr PressSensr PressSensr PressSensr PressSensr PressSensr BaroPress AnIn1CorZS AnIn1CorFS AnIn2CorZS AnIn2CorFS AnOu1CorZS AnOu1CorFS Reset Reset Reset Reset Reset Reset UserTag AlrmMaxLim AlrmMinLim AlrmMode AlrmMode AlrmMode AlrmMode AlrmOutMod AlrmOutMod AlrmOutMod AlrmStpMod AlrmStpMod AlrmNwSetp CntrValue CntrUnit CntrLimit CntrOutMod CntrOutMod CntrOutMod CntrStpMod CntrNwSetp CntrUntstr capunitstr CntrMode CntrMode CntrMode HwRev RCreadfact channumber masterchan RCslavefct inputnode inputproc RCreadunit 3 4 5 6 7 8 absolute pressure 800-1100 mbar delta-P -5...0 "W.C. delta-P -10...0 "W.C. delta-P -10...+10 "W.C. delta-P 0...1 PSI delta-P -1...0 PSI 0 1 2 3 4 5 DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset 2000 = 1 * multiplication DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset 2000 = 1 * multiplication DSCM-A: 0 = 0 offset, other modules: 32767 = 0 offset 2000 = 1 * multiplication no reset reset counter value (no mode change) or common reset reset alarm restart batch counter reset counter value (counter off) Reset module (soft reset) 0 1 2 3 0 1 2 0 1 off alarm on absolute limits alarm on limits related to setpoint (response alarm) alarm when instrument powers-up (eg. after power-down) no relais activity at alarm relais pulses until reset relais activated until reset no setpoint change at alarm new/safe setpoint at alarm enabled (set at par 121) see unit list table 0 1 2 0 no relais activity at batch limit relais pulses after reaching batch limit until reset relais activated after reaching batch limit until reset no setpoint change at batch limit 0 off 1 counting upwards continuously 2 counting up to limit (batchcounter) Page 34 BRONKHORST HIGH-TECH B.V. 139 140 147 147 147 147 147 147 147 147 147 147 147 147 147 148 149 150 151 152 153 154 155 156 156 156 156 156 156 156 156 156 156 156 156 156 156 156 156 157 157 157 157 157 157 157 157 157 157 157 157 157 157 9.17.027 SlaveFact% VrefInput rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct TimeOut frequency imp/m3 RefVolFlow volumeflow delta-p scalefact sensorname RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn 0 1 2 3 4 5 9 19 29 39 49 59 99 calibration ready/stop run calibration until stopsensor 1/select range 1 run calibration until stopsensor 2/select range 2 run calibration until stopsensor 3/select range 3 run calibration until stopsensor 4/select range 4 run calibration and select range 5 run calibration with automatic range selection run until stopsensor 1 until 3 values between limit run until stopsensor 2 until 3 values between limit run until stopsensor 3 until 3 values between limit run until stopsensor 4 until 3 values between limit run and select range 5 until 3 values between limit run with auto-select + 3 values between limit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 no reset possible reset: keyboard reset: external reset: keyboard or external reset: FLOW-BUS reset: FLOW-BUS or keyboard reset: FLOW-BUS or external reset: FLOW-BUS or keyboard or external reset: automatic reset: automatic or keyboard reset: automatic or external reset: automatic or keyboard or external reset: automatic or FLOW-BUS reset: automatic or FLOW-BUS or keyboard reset: automatic or FLOW-BUS or external reset: automatic or FLOW-BUS or keyboard or external no reset possible reset: keyboard reset: external reset: keyboard or external reset: FLOW-BUS reset: FLOW-BUS or keyboard reset: FLOW-BUS or external reset: FLOW-BUS or keyboard or external reset: automatic reset: automatic or keyboard reset: automatic or external reset: automatic or keyboard or external reset: automatic or FLOW-BUS reset: automatic or FLOW-BUS or keyboard Page 35 BRONKHORST HIGH-TECH B.V. 157 157 166 166 166 166 166 166 166 166 166 166 166 166 166 166 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 176 185 185 185 185 185 185 185 185 185 197 9.17.027 RstCountEn RstCountEn ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr BHT11 DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc CalType &H01 &H01 &H02 &H02 &H04 &H04 &H08 &H08 &H10 &H10 &H20 &H20 &H40 &H40 &H01 14 15 0 1 0 1 0 1 0 1 0 1 0 1 0 1 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 0 1 2 3 4 5 6 7 8 0 reset: automatic or FLOW-BUS or external reset: automatic or FLOW-BUS or keyboard or external valve in normal position after startup valve in safe position after startup open from zero with PID output to valve open from zero with ramp output to valve fixed monitor output signal monitor output changed at setpoint steps voltage drift compensation for valve output turned on voltage drift compensation for valve output turned off auto slope disabled auto slope enabled for pilot valves voltage drift compensation for valve output turned on voltage drift compensation for valve output turned off controller special mode (valve output steps) turned off controller special mode (valve output steps) turned on RS232/FLOW-BUS interface PC(ISA) interface ADDA4 (4 channels) R/C-module, 32 channels T/A-module ADDA1: 1 channel ADDA converter module DMFC: digital mass flow controller DMFM: digital mass flow meter DEPC: digital electronic pressure controller DEPM: digital electronic pressure meter ACT: single actuator DLFC: digital liquid flow controller DLFM: digital liquid flow meter DSCM-A: digital single channel module for analog instruments DSCM-D: digital single channel module for digital instr. FRM: FLOW-BUS rotor meter (calibration-instrument) FTM: FLOW-BUS turbine meter (calibration-instrument) FPP: FLOW-BUS piston prover/tube (calibration-instrument) F/A-module: special version of T/A-module DSCM-E: evaporator controller module (single channel) DSCM-C: digital single channel module for calibrators DDCM-A: digital dual channel module for analog instruments DMCM-D: digital multi channel module for digital instruments Profibus-DP/FLOW-BUS interface module FLOW-BUS Coriolis meter FLOW-BUS Balance Interface Unknown Interface ADDA Operator Supervisor (totalizer/alarm) Controller Meter Special (Protocol) converter Manual capacity setting for optimal resolution Page 36 BRONKHORST HIGH-TECH B.V. 197 197 197 200 200 200 200 9.17.027 CalType CalType CalType InterfConf InterfConf InterfConf InterfConf &H01 &H02 &H02 1 0 1 0 1 2 3 Automatic capacity setting for optimal resolution Barometer value input via parameter 107: BaroPress Barometer is master; input automatically from master Configuration A: 14 ch. Standard parms. with network scan Configuration B: 14 ch. Standard parms with fixed chan list Configuration C: 7 ch. Extended parms with fixed chan list Configuration D: 11 ch. Extended parms with network scan Page 37 BRONKHORST HIGH-TECH B.V. 6 Troubleshooting • RS232 communication problems Check cables. Make sure correct cables are used for specific purpose. Check address of interface (slave). Sending messages to node 128 will mostly be accepted by the interface. Try to reset the instrument and/or restart your PC/PLC. Make sure your messages are assembled according to FLOW-BUS protocol description. Make sure the parameter values you try to read/write are available and in the correct ranges (check tables). Controller doesn’t respond on setpoints: - Check control mode, when 0 and other fieldbus gives error: safe state will be entered, resulting in safe setpoint. Can be overruled by making controlmode = 18 (RS232 only operation) - Alarm or counter module in instrument forces setpoint to alarm setpoint. Reset alarm or counter and proceed. - Setpoint slope could have very high value. New setpoints will be reached when this slope time has been elapsed. Make setpoint slope smaller. - Control mode could have other value than 0 or 18. Check function when value is different. - If measure doesn’t change check forward pressure and piping (evt. shut-off valves). - Make sure setpoints are within allowed range: 0...32000 (= 0...100%). - Make sure setpoints are send to proper instrument and process (mostly = 1) and parameter (FBnr for setpoint = 1), and type of data is correct (short integer = 2 bytes MSB first) • Other (FLOW-BUS) problems 9.17.027 Contact local sales representative or service department. Contact Bronkhorst High-Tech local sales representative or send e-mail describing your problem to: help.flowbus@bronkhorst com Page 38 Instruction manual RS232 interface With FLOW-BUS protocol for digital Mass Flow / Pressure instruments Doc. no.: 9.17.027G Date: 26-01-2006 ATTENTION Before installing and operating the instrument it is recommended that this instruction be read. Not following the guidelines could result in personal injury and/or damage to the equipment. BRONKHORST HIGH-TECH B.V. SCOPE OF THIS MANUAL This manual covers the interface part of digital massflow / pressure instruments for gases or liquids. It describes the communication between the instrument and the operator according to the specific (fieldbus) protocol. More information can be found in other documents. Multibus instruments have modular instruction manuals consisting of: - General instructions digital Mass Flow / Pressure instruments laboratory style / IN-FLOW (document nr. 9.17.022) - General instructions CORI-FLOW (document nr. 9.17.031) - Operation instructions digital instruments (document nr. 9.17.023) - Fieldbus/interface description: 9.17.027 Page 2 BRONKHORST HIGH-TECH B.V. Short form start-up All necessary settings for this module are already performed at Bronkhorst High-Tech B.V. To follow next steps carefully is the quickest way to get this module operational in your own system. Procedure: - Make sure your PC or PLC is connected to the RS232 interface by means of the correct cable • • • Multibus instruments need a special cable with T-connector. RS232/FLOW-BUS interfaces need a one-on-one 9-pole cable without crossings with male and female connector Cable lengths for RS232 must not exceed 10 meters. - Make sure instrument or interface is powered (+15Vdc or +24Vdc) - In case of RS232/FLOW-BUS interface without micro-switch and LED’s, first see that interface gets a free address on the FLOW-BUS. Follow initialisation procedure described at [Initialising RS232/FLOW-BUS interface] - Use settings [38400,n,8,1] for your COM-port: Baudrate = 38K4 Baud, no parity, 8 databits, 1 stopbit. - Start sending messages as described in following paragraphs. - In case of trouble programs like Hyperterminal (available in MS-Windows) or FlowDDE (from Bronkhorst High-Tech B.V.) could be very useful. 9.17.027 Page 3 BRONKHORST HIGH-TECH B.V. Table of contents 1 2 3 4 5 6 INTRODUCTION ...................................................................................................................................5 Available interfaces................................................................................................................................6 2.1 RS232/FLOW-BUS interface...........................................................................................................6 2.1.1 D-connector for RS232 ............................................................................................................6 2.1.2 Specifications ..........................................................................................................................6 2.2 RS232 on multibus instrument ........................................................................................................7 2.2.1 Facilities ..................................................................................................................................8 2.2.2 Specifications multibus RS232: ................................................................................................8 FLOW-BUS protocol description ............................................................................................................9 3.1 General ..........................................................................................................................................9 3.2 Initialisation of local host interfaces on Multibus instruments ...........................................................9 3.3 Interface structure.........................................................................................................................10 3.3.1 Basic datalink format..............................................................................................................10 3.3.2 RS232 ASCII protocol............................................................................................................10 3.3.3 Enhanced binary protocol.......................................................................................................11 3.4 Communication messages............................................................................................................13 3.5 Chaining .......................................................................................................................................14 3.6 Status message ............................................................................................................................14 3.7 Send parameters ..........................................................................................................................15 3.8 Request parameter .......................................................................................................................15 3.9 Initialising RS232/FLOW-BUS interface ........................................................................................17 3.10 Examples ..................................................................................................................................18 3.10.1 Sending setpoint ....................................................................................................................18 3.10.2 Sending chained parameters .................................................................................................18 3.10.3 Request setpoint....................................................................................................................20 3.10.4 Request chained parameters .................................................................................................21 3.10.5 Request measure ..................................................................................................................23 3.10.6 Request counter value ...........................................................................................................23 Dual interface operation.......................................................................................................................24 Parameter information .........................................................................................................................25 Troubleshooting...................................................................................................................................27 Appendices 1 2 Parameter properties table Parameter values table 9.17.027 Page 4 BRONKHORST HIGH-TECH B.V. 1 INTRODUCTION This manual will explain how to communicate with a Bronkhorst High-Tech instrument to your PC/PLC using RS232 serial communication. You have to write software yourself using the information of this document in order to be able to operate these instruments. Bronkhorst High-Tech B.V. also offers software to support a quicker way to operate digital instruments with your PC using MS-Windows 95, 98, NT, 2000 or XP On the highest supported communication level, you may use DDE-channels for Windows applicationprograms with this facility. You can use the program FlowDDE for easy connection between MS-Windows applications (e.g. Excel, Visual Basic, LabView, Delphi, Borlandc) and digital instruments. There are several examples available for LabView, Visual Basic and Excel environments. On a lower communication level, you can also use the FLOWB32.DLL for reading/changing parameter values. To read and write parameter values from or to FLOW-BUS devices directly through the available interfaces there is a special protocol for messages between these devices. This protocol has been specially developed for Bronkhorst High-Tech equipment so no third party equipment can be connected. It consists of a hierarchical setup for instruments/nodes (max. 128) containing processes (max. 128) with parameters(FBnr) (max. 32) which values can be set to certain values to enable settings/properties for the instruments. When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol if you choose to drive the interfaces directly. When you use a RS232/FLOW-BUS interface (without the micro-switch and 2 LED’s), you first have to initialise the interface. This can be done by means of sending some ASCII-strings to the interface through RS232. See chapter 3 for more details. When you communicate directly via RS232 on a multibus instrument or when you use a new type of RS232/FLOW-BUS (baudrates up to 38K4 with switch and 2 LED’s) interface, no special initialisation is needed. 9.17.027 Page 5 BRONKHORST HIGH-TECH B.V. 2 Available interfaces 2.1 RS232/FLOW-BUS interface The RS232/FLOW-BUS interface is an interface between the FLOW-BUS and the RS232 V24 serial (computer) port. It will either be supplied as a separate enclosed unit with a FLOW-BUS connector and a RS232 connector or as an integral 14TE module of your E-7000 readout and control system. The converter offers communication with a baudrate up to 38,4 kBaud. Communication software support is available. Communication settings are: 38400,n,8,1. RS232 FLOW-BUS FLOW-BUS status 2.1.1 D-connector for RS232 The female RS232 (x) (subminiature 9-pin) D-connector has the following pin configuration: Pinnumber 1 2 3 4 5 6 7 8 9 Description not connected TXD RXD not connected 0 Vd DTR CTS RTS Shield 2.1.2 Specifications Power supply Power consumption Operating temperature Storing temperature Housing dimensions Baudrates Galvanic Isolation 9.17.027 +15Vdc/+24Vdc +/- 10% +15Vdc : 50 mA +24Vdc : 35 mA 0…+50 ºC -20…+60 ºC box: 160x80x44mm module: 14TE 4800 Baud 9600 Baud 19200 Baud 38400 Baud FLOW-BUS: opto isolated Power : DC-DC converter Page 6 BRONKHORST HIGH-TECH B.V. 2.2 RS232 on multibus instrument The RS232 interface on a multibus instrument can be connected to any RS232 V24 serial (computer) port. The interface offers communication with a baudrate of 38.4 kBaud. On the 9-pin male subD connector of the instrument RX and TX are available on pin 6 and pin 1. RS232 communication is possible by: - 9-pin Sub D-connector (non IP65 applications, e.g. EL-FLOW) - 8 DIN connector (IP65 applications, e.g. CORI-FLOW) For the exact connections please advise your hook-up diagram. Non IP65 applications, e.g. EL-FLOW Analog I/O, without businterface Instrument is supplied through 9-pin Sub D-connector. Power supply RS232 COM-port Application with businterface FLOW-BUS/DeviceNet Instrument is supplied through the bus. RS232 COM-port Application with businterface PROFIBUS Instrument is supplied through 9-pin Sub D-connector. Power supply RS232 COM-port IP65 applications, e.g. CORI-FLOW Analog I/O, without businterface Instrument is supplied through 8 DIN connector. RS232 COM-port Power supply 9.17.027 Page 7 BRONKHORST HIGH-TECH B.V. Application with businterface FLOW-BUS/DeviceNet Instrument is supplied through the bus. RS232 COM-port Application with businterface PROFIBUS Instrument is supplied through 8 DIN connector. RS232 COM-port Power supply 2.2.1 Facilities No handshaking facilities are used. On the side of the PC/PLC a nul-modem connector is needed. Communication settings are: 38400,n,8,1. Bronkhorst High-Tech B.V. offers a special cable needed for communication. Communication software support is available. 2.2.2 Specifications multibus RS232: Operating temperature Storing temperature Baudrates Galvanic Isolation 0…+70 ºC -20…+60 ºC 38400 Baud not for RS232 The multibus RS232 interface is a serial interface between the multibus instrument and the RS232 V24 serial (computer) port using the FLOW-BUS protocol for communication. This means that for serial RS232 communication a multibus instrument with RS232 can be treated as a FLOW-BUS system with one instrument and a FLOW-BUS/RS232 interface. All available software already existing for FLOW-BUS RS232 communication can be used for multibus instruments also. Only initialisation is different. Use of FLOWDDE32 is only possible from V4.23 and higher. 9.17.027 Page 8 BRONKHORST HIGH-TECH B.V. 3 FLOW-BUS protocol description 3.1 General On the highest supported communication level, you may use DDE-channels for Windows applicationprograms with this facility. On a lower communication level, you can use the FLOWB32.DLL, FLOWBUS.DLL or FLOWBUS.LIB, for changing parameter values. To read and write parameter values from or to FLOW-BUS devices directly through the available interfaces there is a special protocol for messages between these devices. When operating a FLOW-BUS system with a HOST computer, you need to know this message protocol if you choose to drive the interfaces directly. When you use a type of RS232/FLOW-BUS interface (baudrate up to 38K4) you may first have to initialise the interface. This can be done by means of sending some ASCII-strings to the interface through RS232. See also paragraph 3.2. There are two different communication protocols for the PC and the RS232 HOST: • an ASCII protocol for communication that is compatible with existing Flowbus applications. This protocol serves only one master/slave dialog at a time. • an enhanced binary protocol that supports concurrent sending of messages to different nodes. This protocol contains a message-sequence number an serves more than one master/slave dialogs at a time. The RS232-HOST module automatically recognises the protocol used by the PC and adapts its behaviour to the protocol in use. The type of protocol is determined by the first character of a message. • the first character is >:= (0x3A) existing type of message. • the first character is DLE (0x10) enhanced type of message. Via the FLOW-BUS DLL (FLOWB32.DLL)The PC determines which protocol is in use. The communication relation is always master (PC) and slave (HOST). The HOST will always respond on a request from the PC. 3.2 Initialisation of local host interfaces on Multibus instruments When you use a digital instrument with RS232 interface, baudrate is fixed on 38K4 baud and no special initialisation is needed. Through the serial line connected to a COM-port of your computer or to a PLC you have to communicate with the instrument using the FLOW-BUS protocol. Each instrument has its own node-address (3...120). If you want to send a message to the instrument you have to know this node-address. However, if you send a message to node-address 128 the instrument will always respond to your message. On a point-to-point connection like RS232 it is the easiest way to make the communication work under all circumstances (its independent of the real node-address of the instrument). 9.17.027 Page 9 BRONKHORST HIGH-TECH B.V. 3.3 Interface structure 3.3.1 Basic datalink format The basic datalink message format has the following fields: node message destination length data field length data data Data etc. In the Flowbus environment the data field may contain up to 256 bytes of data. In the HOST application described here, the messages are according to PROPAR coding rules and the data field will contain a maximum of 64 bytes. 3.3.2 RS232 ASCII protocol An ASCII protocol is used on the existing RS232-HOST. To be compatible with existing driver software the ASCII protocol is available. A basic datalink message is coded in ASCII as follows: len len1 : len2 >:= (semicolon) len1, len2 node node1 data data1 node2 data2 CR initial character length of message including the node address in bytes, so (len1,len2) is the basic message length +1. node address of destination (PC to HOST) node address of source (HOST to PC) message field termination character node1, node2 data1, data2 CR All bytes (except the initial and termination character) are converted from 1 binary byte to 2 hexadecimal bytes in ASCII representation. Example: binary data byte 0x2A --> hexadecimal ASCII characters 0x32, 0x41. A special message type is used to pass error messages from the HOST to the PC. Its structure is as follows: : 0x01 0x30 >:= (semicolon) 0x30, 0x31 error CR 9.17.027 0x31 error error1 error2 CR initial character length of the message (1 byte) error code, two digit HEX number termination character Page 10 BRONKHORST HIGH-TECH B.V. The error code can have the following values: Value 1 2 3 4 5 8 9 Meaning no >:= at the start of the message error in first byte error in second byte or number of bytes is 0 or message to long error in received message (receiver overrun, framing error etc.) Flowbus communication error: timeout or message rejected by receiver time out during sending no answer received within time out 3.3.3 Enhanced binary protocol Binary coding and control sequences The enhanced protocol is binary coded. Control sequences are used to recognise the begin and end of a message in a byte stream. A control sequence starts with a DLE byte (0x10) and is followed by a control byte. The following control sequences are defined: First byte DLE (0x10) DLE (0x10) DLE (0x10) DLE (0x10) Second byte STX (0x02) ETX (0x03) DLE (0x10) any other character Function Start of message End of message Data byte 0x10 Not allowed. Messages that contain such a sequence will be ignored. The receiver waits until a new DLE STX sequence. The [DLE DLE] sequence is used to prevent possible DLE bytes in the transmitted binary data stream from being recognised as the start of a control sequence. The sender replaces any DLE bytes in the data by two DLE bytes. The datalink of the receiver will convert a [DLE DLE] sequences to one DLE byte. Note: If a RS232 error (receiver overrun, framing error, not allowed control sequence) occurs, the datalink frame is ignored. Enhanced message coding The enhanced binary coded messages between PC and HOST are structured as follows: DLE STX DLE, STX seq node len data DLE, ETX seq node len data DLE ETX start sequence message sequence number node address of destination (PC to HOST) node address of source (HOST to PC) length of data field in bytes message field end sequence The enhanced protocol allows the transmission of more than one request at a time. The sequence number makes it possible to associate the answer to the according request. The HOST has more than one message buffer where messages may be stored (typical 5). When the message buffers are full, the HOST responds with an error message. 9.17.027 Page 11 BRONKHORST HIGH-TECH B.V. The responses from the HOST to the PC have the same message format as the request. An error message has a special format: DLE STX DLE, STX seq node error DLE, ETX seq node 0x00 error DLE ETX start sequence message sequence number, as in request node address of source, as in request error code end sequence The error code can have the following values: Value 3 5 8 9 9.17.027 Meaning Message rejected by HOST, host receiver buffer overflow Flowbus communication error: timeout or message rejected by Flowbus node time out during sending no response on a request received within time out Page 12 BRONKHORST HIGH-TECH B.V. 3.4 Communication messages Communication messages between FLOW-BUS interfaces and other devices consist of command strings with specific information. This command string is either ASCII (RS232) or BINARY. Basically the string contains several information bytes. Through RS232 these hexadecimal bytes are converted in ASCII (f.i.: bytevalue 0x0A is "0A" in ASCII and capital letters should be used). Messages via RS232 are preceded by the ':' character and terminated with "\r\n" (Carriage return-Line-feed). There are several COMMANDS available in the FLOW-BUS messages. However only Command RD (04) and WR (01) are enough to do all the standard parameter reading and writing. A RD command will be answered with a WR command, containing the value asked for or a status message, containing an errornumber. A WR command will be answered with a status message, containing an error-number (if errornumber = 0, than WR command was OK). Note: ASCII character ‘:’ has hexadecimal value: 3A ASCII character ‘\r’ has hexadecimal value: 0D ASCII character ‘\n’ has hexadecimal value: 0A Communication commands Command Description 00 Status message 01 Send parameter with destination address, will be answered with type 00 command 02 Send parameter with destination address, no status requested 03 Send parameter with source address, no status requested 04 Request parameter, will be answered with type 02 or 00 command 05 Instruction: send parameter repeatedly (followed by byte with repeating time) 06 Stop process 07 Start process 08 Claim process 09 Unclaim process To access a specific parameter you need to know the following numbers. 1. 2. 3. 4. Node-address, each FLOW-BUS device is connected to a specific node-address in the system. Process number, each device (node) consists of several processes. Parameter number(FBnr), each process consists of several parameters. Parameter type, each parameter can be of a different type and value. For parameters numbers and values see tables “parameter properties” and “parameter values” in this manual. Parameter types Type Id Character 00h Integer 20h Float 40h Long 40h String 60h 9.17.027 Bytes 1 2 4 4 X Range 0…255 0…65535 +-1.18e-38...+-3.39e+38 4 bytes 0... 4294967296 length needs to be specified Page 13 BRONKHORST HIGH-TECH B.V. 3.5 Chaining Chaining can be used to send or request more than one parameter per message. When the parameters are all members of the same process, they can be chained at parameter level. When the parameters are members of different processes, they can be chained at process level. A combination is also possible. For chaining at parameter level the first bit of the parameter number should be set if there is following another parameter at the same process. For chaining at process level the first bit of the process number should be set if there is another process following. 3.6 Status message status Nr Byte 0 : 1 04 2 Node 3 00 4 Status 6 Description Start character Fixed message length 4. Node address Command status 00 No error 01 Process claimed 02 Command error 03 Process error 04 Parameter error 05 Parameter type error 06 Parameter value error 07 Network not active 08 Time-out start character 09 Time-out serial line 0A Hardware memory error 0B Node number error 0C General communication error 0D Read only parameter. 0E Error PC-communication 0F No RS232 connection 10 PC out of memory 11 Write only parameter 12 System configuration unknown 13 No free node address 14 Wrong interface type 15 Error serial port connection 16 Error opening communication 17 Communication error 18 Error interface busmaster 19 Timeout answer 1A No start character 1B Error first digit 1C Buffer overflow in host 1D Buffer overflow 1E No answer found 1F Error closing communication 20 Synchronisation error 21 Send error 22 Protocol error 23 Buffer overflow in module Index or Index pointing to the first byte in the send message for witch the above status applies. Claimed process In case of the status CLAIM ERROR, this field contains the claimed process. ‘\r’ Carriage Return 7 ‘\n’ 5 Line Feed *Note: Value from byte 5 of status message may be neglected if value of byte 4 = 0 ! 9.17.027 Page 14 BRONKHORST HIGH-TECH B.V. 3.7 Send parameters Send Nr 0 1 2 3 4 Byte : Length Node 01 or 02 Process Layout Description start character Message length Node address Command write, for type 01 a status message (00) will be returned Cppppppp c Process chained p Process number Cttppppp c Parameter chained t Parameter type p Parameter number Value for all types. For ‘strings’ this field contains the string length. 5 Parameter type 6 Value 1 7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’. 8 Value 3 Value for type ‘float’ or ‘long’. 9 Value 4 Value for type ‘float’ or ‘long’. X Value x X+1 ‘\r’ More value fields follow for type ‘string’ depending on string length. If given string length is zero, the final field should also contain a zero. Carriage Return X+2 ‘\n’ Line Feed 3.8 Request parameter For each requested parameter an index number can be given. The answering node will return this index number with the requested parameter. This can be used to check which parameter is returned when several parameters are requested. Request Nr Byte 0 : 1 Length 2 Node 3 04 * 4 Process (return) Layout Cppppppp 5* Parameter type & Cttnnnnn index (return) 6 Process -ppppppp 7 Parameter -ttppppp 8 9 10 String length ‘\r’ ‘\n’ 9.17.027 Description start character Message length Node address Command read c Process chained p Process number c Parameter chained t Parameter type n Parameter index 0…31 - Not used p Process number - Not used t Type parameter p Parameter number For parameter type ‘string’ this field contains the expected string length. Carriage Return Line Feed Page 15 BRONKHORST HIGH-TECH B.V. Answer of request Nr Byte 0 : 1 Length 2 Node 3 02 4* Process 6 Description start character Message length Node address Command write Cppppppp c Process chained p Process number Parameter type Cttnnnnn c Parameter chained & index t Parameter type n Parameter index 0…31 Value 1 Value for all types. For ‘strings’ this field contains the string length. 7 Value 2 Value for type ‘integer’, ‘float’ or ‘long’. 8 Value 3 Value for type ‘float’ or ‘long’. 9 Value 4 Value for type ‘float’ or ‘long’. X Value x X+1 ‘\r’ More value fields follow for type ‘string’ depending on string length. If given string length is zero, the final field should also contain a zero. Carriage Return X+2 ‘\n’ Line Feed 5* Layout *The requested module copies these values from the request message directly into the answer message. 9.17.027 Page 16 BRONKHORST HIGH-TECH B.V. 3.9 Initialising RS232/FLOW-BUS interface If you use a RS232/FLOW-BUS interface for communication (without the micro-switch and 2 LED’s), note that this module is not part of the (FLOW-BUS) token-ring network, directly at power-up. This means that it is always necessary to re-initialise the module when power has been interrupted! This is not the case when using an RS232/FLOW-BUS interface with micro-switch, red LED, green LED and RJ45 connector for FLOW-BUS. By means of the switch you may force the interface to find a free address on the FLOW-BUS once. You may skip the initialisation and start directly sending messages. Also when using digital (Multibus) instruments with RS232 directly on the instrument it is not needed to initialise (give a free node-address to) the instrument on the FLOW-BUS because instrument is not physically connected to the FLOW-BUS, but only uses the same protocol. You may start directly sending your messages to the instrument on either the node-address of the instrument in its memory e.g. node 3 (selective response) or to node-address 128 (always response). At power-up situation you can communicate with the RS232 interface only at the RS232 side via node 0. To get part of the FLOW-BUS you have to send an init. command, send the network parameters PNA, SNA, NNA, LNA and BM and send a reset command. From this moment the interface is part of the FLOWBUS. Ensure the module gets a free and unique address on the bus, 2 modules on the same address will cause communication problems. When you are sure that there are no more interfaces in the system, simply force the RS232/FLOW-BUS interface to address 1. This address is reserved for an interface. PC-support software (FLOWB32.DLL, FLOWBUS.DLL and FLOWBUS.LIB) will search for a free address on which the interface will be installed. Follow the steps below to realise correct initialisation for this interface via RS232: Initialisation RS232 interface (needed for FLOW-BUS/RS232 interfaces without switch and LEDs only) Send Response Comment :050001000A49\r\n* Init instruction for node 0 process 0. :04000000XX\r\n No error. :050001000101\r\n PNA = Primary Node Address = 1 :04000000XX\r\n No error. :05000100027F\r\n SNA = Secondary Node Address = 127 :04000000XX\r\n No error. :050001000302\r\n NNA = Next Node Address = 2 :04000000XX\r\n No error. :050001000420\r\n LNA = Last Node Address = 32 (depends on system size) :04000000XX\r\n No error. :050001000502\r\n BM = Bus Management = 67 67 = everything automatically (auto arbitration+gap skipping) 3 = auto arbitration 2 = always busmaster 1 = temporary In older systems: when no R/C-modules in system make BM = 2, when R/C-modules in system (already busmasters present) than make BM = 1; otherwise make = 67 :04000000XX\r\n No error. :050001000A52\r\n Reset instruction for module; from this moment on module will be active on FLOW-BUS at node address = PNA :04000000XX\r\n No error. • Sometimes it could be necessary to repeat the first instruction. Wait approx. 2 seconds before sending the next command. • XX means: don’t care Communication can be closed and interface can be disabled from FLOW-BUS token-ring traffic by sending the command below via the RS232 to the interface. Stop communication RS232 interface Send Comment :050101001101\r\n close communication instruct. for interface module there will be no aswer (because communication stops) second byte is actual node address for interface (here: 01) 9.17.027 Page 17 BRONKHORST HIGH-TECH B.V. 3.10 Examples 3.10.1 Sending setpoint Sending setpoint 50% to node 3 process 1. Setpoint values should be given in a range from 0 to 32000 so for this example 16000 should be send. Send parameters to node 3 Nr Byte Layout Description 0 ':' Start character 1 06 Length 6 2 03 Node 3 3 01 Command write with status response 4 01 00000001 C 00 Process not chained P 01 Process 1 5 21 00100001 C 00 Parameter not chained T 20 Parameter type ‘integer’ P 01 Parameter number 1 6 3E Setpoint 16000 = 3E80h 7 80 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer from node 3 Nr Byte Description 0 ‘:’ Start character 1 04 Fixed message length 4. 2 01 Node address 01 3 00 Command status 4 00 Status ok. 5 05 Status ok, value points to end of send message. 6 ‘\r’ Carriage Return 7 ‘\n’ Line Feed 3.10.2 Sending chained parameters Interface sends following parameters to module at node 3: Process 0: INIT MODE (10), 64 = soft init Process 1: FLUIDNUMBER(16). 1 Process 1: POLYNOMIAL CONSTANTE A(5), 0.0 Process 1: POLYNOMIAL CONSTANTE B(6), 1.0 Process 1: POLYNOMIAL CONSTANTE C(7), 0.0 Process 1: POLYNOMIAL CONSTANTE D(8), 0.0 Process 0: INIT MODE (10), 82 = reset initmode. Send parameters to node 3 Nr Byte Layout Description 0 ':' 1 1D Length 29 2 03 Node 3 3 01 Command write with status response 4 80 10000000 C 80 Process chained P 00 Process 0 9.17.027 Page 18 BRONKHORST HIGH-TECH B.V. 5 0A 6 7 40 81 8 C5 9 10 11 12 13 00 00 00 00 C6 14 15 16 17 18 3F 80 00 00 C7 19 20 21 22 23 00 00 00 00 C8 24 25 26 27 28 00 00 00 00 00 29 30 31 32 00001010 C 00 Parameter not chained T 00 Parameter type ‘character’ N 0A Parameter number 10 01000000 Parameter value 64 set soft init mode 10000001 C 80 Process chained P 01 Process 1 11000101 C 80 Parameter chained T 40 Parameter type ‘float’ N 05 Parameter number 5 Parameter value ‘float’ 0.0 11000110 C 80 Parameter chained T 40 Parameter type ‘float’ N 06 Parameter number 6 Parameter value ‘float’ 1.0 1100111 C 80 Parameter chained T 40 Parameter type ‘float’ N 07 Parameter number 7 Parameter value ‘float’ 0.0 11001000 C 80 Parameter chained T 40 Parameter type ‘float’ N 08 Parameter number 8 Parameter value ‘float’ 0.0 00000000 C 00 Process not chained P 00 Process 0 0A 00001010 C 00 Parameter not chained T 00 Parameter type ‘character’ N 0A Parameter number 10 52 01010010 Parameter value 82, reset init mode ‘\r’ Carriage Return ‘\n’ Line Feed 9.17.027 Page 19 BRONKHORST HIGH-TECH B.V. Answer from node 3 Nr Byte Description 0 ‘:’ Start character 1 04 Fixed message length 4. 2 03 Node address 3 00 Command status 4 00 Status ok. 5 1C 6 7 Status ok, value points to end of send message. ‘\r’ Carriage Return ‘\n’ Line Feed 3.10.3 Request setpoint Request setpoint from node 3 process 1, type integer. Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read 4 01 00000001 C 00 Process not chained (return) P 01 Process 1 (return) 5 21 00100001 C 00 Parameter not chained (return) T 20 Parameter type ‘integer’ (return) N 01 Parameter index 1 (return) 6 01 -0000001 P 01 Process 1 7 21 -0100001 T 20 Parameter type ‘integer’ P 01 Parameter number 1 ( setpoint) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer by node 3 Nr Byte Layout 0 ':' 1 06 2 03 3 02 4 01 00000001 5 21 6 7 8 9 3E 80 ‘\r’ ‘\n’ 9.17.027 Description Length 6 Node 3 Command write C 00 Process not chained P 01 Process 1 ( receiving process) 00100001 C 00 Parameter not chained T 20 Parameter type ‘integer’ N 01 Parameter index 1 Value 3E80h = 16000 = 50% Carriage Return Line Feed Page 20 BRONKHORST HIGH-TECH B.V. 3.10.4 Request chained parameters Interface sends a request for the following parameters to module at node 3: Process 113: SerialNum (3), UserTag (6) Process 1 : Measure (0), Capacity (13), Capunitstr (31), Fluidname (17) Request by node 3 Nr Byte Layout 0 ':' 1 1A 2 03 3 04 4 F1 11110001 5 EC 11101100 6 7 71 63 -1110001 -1100011 8 9 14 6D 10000100 01101101 10 11 71 66 -1110001 -1100110 12 13 00 01 00000000 00000001 14 AE 10101110 15 16 01 20 -0000001 -0100000 17 CF 11001111 18 19 01 4D -0000001 -1001101 20 F0 11110000 21 22 01 7F -0000001 -1111111 23 24 07 71 00001110 01110001 9.17.027 Description Length 31 Node 3 Command read C 80 Process chained (return) P 71 Process 113 (return) C 80 Parameter chained (return) T 60 Parameter type ‘string’ (return) N 0C Parameter index 12 (return) P 71 Process 113 T 60 Parameter type ‘string’ P 03 Parameter number 3 – Serial Number 14 String length 20 C 00 Parameter not chained (return) T 60 Parameter type ‘string’ (return) N 0D Parameter index 13 (return) P 71 Process 113 T 60 Parameter type ‘string’ P 06 Parameter number 6 – Usertag String length 00, length not defined C 00 Parameter not chained (return) P 01 Process 1 (return) C 80 Parameter chained (return) T 20 Parameter type ‘integer’ (return) N 0E Parameter index 14 (return) P 00 Process 1 T 20 Parameter type ‘integer’ P 00 Parameter number 0 – Measure C 80 Process chained (return) T 40 Parameter type ‘float’ (return) N 0F Parameter index 15 (return) P 01 Process 1 T 40 Parameter type ‘float’ P 0D Parameter number 13 – Capacity C 80 Parameter chained (return) T 60 Parameter type ‘string’ (return) N 10 Parameter index 16 (return) P 01 Process 1 T 60 Parameter type ‘string’ P 1F Parameter number 31 – Capacity Unit Sting 07 String length 7 C 00 Parameter not chained (return) T 60 Parameter type ‘string’ (return) N 11 Parameter index 17 (return) Page 21 BRONKHORST HIGH-TECH B.V. 25 26 01 71 27 33 34 0A ‘\r’ ‘\n’ -0000001 P 01110001 T P Answer by node 3 Nr Byte Layout 0 ':' 1 41 2 03 3 02 4 F1 11110001 01 60 11 Process 1 Parameter type ‘string’ Parameter number 17 – Fluidname String length 10 Carriage Return Line Feed Description Number of bytes which do follow: 65 bytes Node 3 Command write C 80 Process chained P 71 Process 113 ( recieving process) 5 EC 11101100 C 80 Parameter chained T 60 Parameter type ‘string’ N 0C Parameter index 12 6 14 Length of the answer 20 Bytes 7-25 4D 36 32 31 32 33 34 35 41 20 20 20 20 20 20 20 20 20 20 20 Parameter value converted from hex to ASCII : M6212345A 27 6D 01101101 C 00 Process not chained T 60 Parameter type ‘string’ N 0D Parameter index 13 28 00 String length 00, length not defined 29-36 55 53 45 52 54 41 47 00 Parameter value converted from hex to ASCII, the values do read: USERTAG 37 01 00000001 C 00 Process not chained P 01 Process 1 ( receiving process) 38 AE 10101110 C 80 Parameter chained T 20 Parameter type ’integer’ N 0E Parameter index 14 Parameter value is: 1CD8 (hex) 39 1C Measure Value is: 7384 (dec) 40 D8 41 CF 11001111 C 80 Parameter chained T 40 Parameter type ‘float’ N 0F Parameter index 15 Parameter Value: 3F 80 00 00 (IEEE-floating point notation , 32-bit single precision ) 42 3F Parameter value converted from float to decimal , the values do read: 1.0 43 80 44 00 45 00 46 F0 11110000 C 80 Parameter chained T 60 Parameter type ’string N 10 Parameter index 16 47 07 Length of the answer 7 Bytes 48-54 6D 6C 6E 2F 6D 69 6E Parameter value converted from hex to ASCII, the values do read: mln/min 55 71 01110001 C 00 Parameter not chained T 60 Parameter type ’string’ N 11 Parameter index 17 56 0A Length of the answer 10 Bytes 57-66 4E 32 20 20 20 20 20 20 20 20 Parameter value converted from hex to ASCII, the values do read: N2 9.17.027 Page 22 BRONKHORST HIGH-TECH B.V. 3.10.5 Request measure Request measure from node 3 process 1, type integer. Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read 4 01 00000001 C 00 Process not chained (return) P 01 Process 1 (return) 5 21 00100001 C 00 Parameter not chained (return) T 20 Parameter type ‘integer’ (return) N 01 Parameter index 1 (return) 6 01 -0000001 P 01 Process 1 7 20 -0100000 T 20 Parameter type ‘integer’ P 00 Parameter number 0 ( measure) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed Answer by node 3 Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 02 Command write 4 01 00000001 C 00 Process not chained P 01 Process 1 ( receiving process) 5 21 00100001 C 00 Parameter not chained T 20 Parameter type ‘integer’ N 01 Parameter index 1 6 3E Value 3E80h = 16000 = 50% 7 80 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed 3.10.6 Request counter value Request countervalue (cntrvalue) from node 3 process 104, type float. Nr Byte Layout Description 0 ':' 1 06 Length 6 2 03 Node 3 3 04 Command read 4 68 01101000 C 00 Process not chained (return) P 68 Process 104 (return) 5 41 01000001 C 00 Parameter not chained (return) T 40 Parameter type ‘float’ (return) N 01 Parameter index 1 (return) 6 68 -1101000 P 68 Process 104 7 41 -1000001 T 40 Parameter type ‘float’ P 01 Parameter number 1 ( cntrvalue) 8 ‘\r’ Carriage Return 9 ‘\n’ Line Feed 9.17.027 Page 23 BRONKHORST HIGH-TECH B.V. Answer by node 3 Nr Byte Layout 0 ':' 1 08 2 03 3 02 4 68 01101000 5 41 6 7 8 9 10 11 45 9C FF AE ‘\r’ ‘\n’ 4 Description Length 8 Node 3 Command write C 00 Process not chained P 68 Process 104 ( receiving process) 01000001 C 00 Parameter not chained T 40 Parameter type ‘float’ N 01 Parameter index 1 Parameter value ‘float’ = 5023.96 dec. Carriage Return Line Feed Dual interface operation When operating a controller (reading measured value and sending setpoint) for proper operation it is important that the controller gets its setpoint from the right source. Setpoints may come from different sources: analog input, fieldbus interface or RS232 or may be overruled by close valve or open valve (purge) commands. Therefore it is important to know what is the setpoint source of the controller. This can be set by means of parameter controlmode (process 1, parameter 12). In some cases it is possible that the setpoints may come from 2 sources at the same time. The last send setpoint will be valid and send to the controller. This is the case in controlmode = 0, when setpoints may come through any fieldbus interface or RS232. However, there could be situations where control over the instrument seems impossible. This is the case when the instrument comes into a safe-state e.g. when fieldbus communication is disturbed or disconnected. Valve will be forced to a safe state automatically: closed (NC) or fully open (NO). In case you want to get control back via RS232 operation, you have to change the controlmode. When controlmode gets value 18, safe state will be overruled and sending setpoints via RS232 interface will have effect on the controller again. See also document nr. 9.17.023 for more detailed description about digital instrument parameters and their behaviour. 9.17.027 Page 24 BRONKHORST HIGH-TECH B.V. 5 Parameter information FLOW-BUS is used for parameter value exchange between instruments and operation modules (keyboard or PC-interface). Parameter information consists of several properties for behaviour within the FLOW-BUS system. In the ‘parameter properties’ table you will find a list of parameters and their properties. In the ‘parameter values’ table values are described more detailed if necessary. These list consists mostly of parameters for mode settings. Property description in ‘parameter properties’ table: Item Description Parameter(DDE) unique parameter number (also used for DDE-communication : P(x)) Name parameter name (max. 10 characters) used for parameter identification process process where parameter is used on FLOW-BUS module used for communication directly through RS232 when filled in the table, this value has to be used (for parameters located in only 1 process) when empty in the table, process has to be determined from the FLOW-BUS system information (for parameters located in more than one process, f.i. setpoint, measure); FBnr(parameter) parameter number in process on FLOW-BUS module used for communication directly through RS232 VarType variable type for information about amount of bytes c : (unsigned) char type; 1 byte; value 0..255 i : (unsigned) integer type; 2 bytes; value 0..65535 f : float type, 4 bytes, value +-1.18E-38..+-3.39E+38 (IEEE-floating point notation) l : (unsigned) long type, 4 bytes, value 0..4294967295 data types > 1 byte are MSB first. VarLength variable length to indicate length of string of chars used in combination with VarType c for transportation of strings through FLOW-BUS: value 0..65535 VarLength indicates the amount of bytes for a parameter type -2: indicates that a string is zero-terminated, not defined for length X : indicates a string with a length of X bytes (characters) 0 : means no info required. Min minimum value of parameter allowed when parameter is read/written via RS232, the value will be checked on this limit (error when out of limit) Max maximum value of parameter allowed when parameter is read/written via RS232, the value will be checked on this limit (error when out of limit) Read indication if parameter is allowed to be read via FLOW-BUS Write indication if parameter is allowed to be written via FLOW-BUS Poll indication if parameter should be polled continuously by RS232 application in order to keep (changing) parameter information up to date Advanced indication if parameter is for advanced users only these are mainly parameters for maintenance/service Secured High security Description indication if parameter is secured for use through FLOW-BUS reading this parameter is possible, but changing it needs special handling indication if parameter is highly secured (only few parameters) reading this parameter is possible, but changing it needs special handling short description about meaning of parameter or what it is used for Parameter acceptance: Changing parameter values is possible when a parameter is not read-only and not secured. The range and type of parameters are described in the tables. When parameter values are out of range they will be either 'clipped' on the nearest value allowed or you will get an error message: 'parameter value error'. 9.17.027 Page 25 BRONKHORST HIGH-TECH B.V. (DDE)Parameter numbers: All parameter information is referenced to the parameter number. This is a unique number for a parameter to avoid redundancy. These numbers are needed for DDE communication only. For communication with FLOW-BUS through other ways than DDE: directly via RS232 ASCII-strings or via C-libraries (DOS or Windows), use the parameter numbers for the FLOW-BUS modules (in column FBnr of table Parameter properties). Now you will always have to know the node-address of the instrument on the FLOW-BUS, the process number on the instrument and the parameter number on the instrument. Process nr could be read from the table or has to be determined, when nothing is filled-in. In most cases process number will be = 1. Node-address should be determined also. This is the node-address of the instrument on the FLOW-BUS. Newer RS232 protocols on multibus instruments accept node = 128. When sending messages to this node address, the message will be always accepted, unregarding the node-address of the instrument on the bus. NOTE: It is important to know that not all parameters are available on all FLOW-BUS/Multibus devices. For more details about parameters and their use see also document nr. 9.17.023 for description of digital instruments. If you have the program FLOWDDE, you can also get an overview of which parameters are available on which devices. In other cases ask your local sales representative or send an e-mail to [email protected]. Appendix 1 and 2 will give information about parameters, their properties and their possible values. 9.17.027 Page 26 BRONKHORST HIGH-TECH B.V. 6 Troubleshooting • RS232 communication problems Check cables. Make sure correct cables are used for specific purpose. Check address of interface (slave). Sending messages to node 128 will mostly be accepted by the interface. Try to reset the instrument and/or restart your PC/PLC. Make sure your messages are assembled according to FLOW-BUS protocol description. Make sure the parameter values you try to read/write are available and in the correct ranges (check tables). Controller doesn’t respond on setpoints: - Check control mode, when 0 and other fieldbus gives error: safe state will be entered, resulting in safe setpoint. Can be overruled by making controlmode = 18 (RS232 only operation) - Alarm or counter module in instrument forces setpoint to alarm setpoint. Reset alarm or counter and proceed. - Setpoint slope could have very high value. New setpoints will be reached when this slope time has been elapsed. Make setpoint slope smaller. - Control mode could have other value than 0 or 18. Check function when value is different. - If measure doesn’t change check forward pressure and piping (evt. shut-off valves). - Make sure setpoints are within allowed range: 0...32000 (= 0...100%). - Make sure setpoints are send to proper instrument and process (mostly = 1) and parameter (FBnr for setpoint = 1), and type of data is correct (short integer = 2 bytes MSB first) • Other (FLOW-BUS) problems 9.17.027 Contact local sales representative or service department. Contact Bronkhorst High-Tech local sales representative or send e-mail describing your problem to: help.flowbus@bronkhorst com Page 27 APPENDIX 1 Parameter properties table Parameter properties table FlowDDE database version V3.49 Parameter number (DDE) Parameter name Group 0 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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 identstrng pna sna nna lna arbitrage initreset measure setpoint setpslope analoginp cntrlmode polycnst A polycnst B polycnst C polycnst D polycnst E polycnst F polycnst G polycnst H capacity sensortype capunit fluidnr fluidname claimnode modify alarminfo chanamount firstchan lastchan hostcontrl alrmmsgTA alrmmsgnr relstatus actualval signinpsel resinpsel limit delaytime duratntime vlvoutset reloutset opermodeTA readunit readfact resetunit TdValveDn TdValveUp TdSensorDn TdSensorUp CycleTime AnalogMode VrefOutput ValveOut 13 1 1 1 1 1 12 2 2 18 2 18 3 3 3 3 3 3 3 3 3 3 3 3 3 12 12 4 17 17 17 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 10 10 8 Group 1 2006-02-01 Group 2 Process number FB nr (par) Var Type Var Length 0 0 0 0 0 0 0 0 1 2 3 4 5 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 12 13 14 1 0 1 2 0 1 2 3 4 5 6 7 8 9 10 12 9 10 11 12 12 3 6 1 c c c c c c c i i i i c f f f f f f f f f c c c c c c c c c c c c c c f c c f c c c c c c f c f f f f c c i l -2 18 18 19 19 0 0 0 9 10 10 10 114 115 116 114 Min value Max value 0 0 0 0 0 0 -23593 0 0 -23593 0 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 0 0 0 128 128 128 128 255 255 41942 32767 30000 41942 255 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 255 255 8 0 0 0 1 1 1 0 128 255 255 120 120 120 1 0 3.4028E+38 0 0 0 3.4028E+38 99235959 99235959 0 9 1E-10 0 0 0 0 0 1 0 0 0 1E+10 1 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 255 255 65535 16777215 10 16 16 8 8 8 8 8 8 8 7 Page 1 of 5 Read Write Poll Secured Highly Secured Default Value Description Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No Yes Yes No Yes No No No No No No No No No No No No No No No No Yes No No No No Yes Yes No Yes No No No No No No No No No No No No No No No No No No Yes No Yes Yes No No Yes No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes No No Yes Yes No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No 7SN999999 0 0 1 32 67 identnr.+softwareversion[+serialnr.] primary node address: network parameter FLOW-BUS secundary node address: network parameter FLOW-BUS next node address: network parameter FLOW-BUS last node address: network parameter FLOW-BUS FLOW-BUS arbitrage setting and/or automatic optimization init and reset security key commands for network/parameter settings measured value (100% = 32000) setpoint: wanted value (100% = 32000) setpoint ramp signal 0..100 % in up to slope x 0.1 sec. analog input signal, normally used for ext. setp. (100% = 32000) control mode selection for instrument or module polynomial constant A (offset) polynomial constant B (span] polynomial constant C polynomial constant D polynomial constant E (offset) for setpoint or power value polynomial constant F (span) for setpoint or power value polynomial constant G for setpoint or power value polynomial constant H for setpoint or power value maximum value at 100% in sensor base units sensor type information for actual reading and sensor/controller indication pointer to selected actual readout unit (index for list of readout units] fluid number: pointer to polynome, name and cap. name of fluid node address of module with operation rights contains number(s) of changed par (0xXX par nr, 0xFF more than one par cha status information of several alarms/errors in the instrument amount of channels which can be operated first channel that can be operated last channel that can be operated operation by HOST computer enable flag alarm message string with unit type information alarm message string with unit number information status of relays/potential free contacts ('0' = not activated, '1' = activated) actual value of counter signal input selection (' '=no value,'+'=pos value,'-'=neg value input) external reset input enable/disable ('E'=enable,' '=disable) limit/batch for counter in sensor standard units delay time string in days,hours,minutes,seconds duration time string in days,hours,minutes,seconds valve output setting ('0'=do nothing, '1'=close valve) relay output setting ('L'=low, 'H'=high, 'P'=pulse (1 sec.)) operation mode of T/A module readout unit string readout factor matching readout unit string reset unit command (1=reset T/A unit) valve output differentiation time constant downwards valve output differentiation time constant upwards sensor signal differentiation time constant downwards sensor signal differentiation time constant upwards cycle time * 10 msec. main loop signal processing analog mode selection for analog operation reference voltage output signal for analog operation valve output signal (24-bit number in range 0…14.3Vdc/0…23.3Vdc) 0 0 0 0 0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 3 0 0 AIR 0 0 0 32 1 32 0 0 00000000 00000000 00000000 LLLLLLLL 0 ln/min 1 0.1 0.1 5.8 5.6 6 0 0 FlowDDE database version V3.49 Parameter number (DDE) Parameter name Group 0 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 DynDispFct StaDispFct CalMode ValveOffst Monitor AlarmReg1 AlarmReg2 CalRegZS1 CalRegFS1 CalRegZS2 CalRegFS2 ADCcntrReg BridgePotm AlarmEnble TestMode ChanSelect ContrResp ErrInFilCo ExpSmooCo AnOutCorZS AnOutCorFS AnInpCorZS AnInpCorFS TuningMode DefVlvType GlobModify SpanCorr VlvCrvStps MemShipNor MemShipOp IOStatus FuzzStNeNo FuzzStPoNo FuzzStOpen DeviceType ModelNum SerialNum MfrConfig BHT1 BHT2 BHT3 BHT4 BHT5 BHT6 BHT7 BHT8 BHT9 BHT10 PulseHight Version PressSensr BaroPress AnIn1CorZS AnIn1CorFS AnIn2CorZS AnIn2CorFS AnOu1CorZ AnOu1CorF Reset UserTag AlrmMaxLim 6 6 7 8 2 4 4 9 9 9 9 9 9 4 4 9 8 6 6 10 10 10 10 7 8 12 8 8 8 8 12 8 8 8 13 13 13 11 14 14 14 14 14 14 14 14 14 14 8 13 20 20 10 10 10 10 10 10 12 11 15 Group 1 20 20 2006-02-01 Group 2 Process number FB nr (par) Var Type 117 117 115 116 115 114 114 116 116 116 116 114 116 115 115 115 114 117 117 1 2 1 7 2 2 3 1 2 3 4 4 5 4 5 6 5 3 4 21 22 23 24 7 6 19 7 8 9 10 11 13 14 15 1 2 3 4 1 2 3 4 5 6 7 8 9 10 16 5 9 8 25 26 27 28 29 30 8 6 1 f f c i c c c l l l l l c c c c c f f i i i i c c c f c c c c c c c c c c c c i l i c c c c l c c c c f i i i i i i c c i 115 114 0 114 114 114 114 114 114 114 114 113 113 113 113 118 118 118 118 118 118 118 118 118 118 114 113 115 116 115 113 97 Var Length Min value Max value Read Write Poll Secured Highly Secured Default Value 0 0 0 -32767 0 1 1 255 65535 255 16777215 16777215 16777215 16777215 4294967295 255 255 255 32 255 1 1 65535 65535 65535 65535 255 255 255 1 0 255 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No Yes No No No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No No No No No Yes Yes No Yes No Yes Yes Yes Yes Yes Yes No Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No Yes No No No No No No No No Yes No No No No No No No No No No No No No 0,001 0,000001 0 61000 7 0 0 0 0 0 0 0 0 1 0 0 0 -32767 0 -32767 0 0 0 0 0 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes 8 8 -2 -2 -2 -2 -2 -2 6 14 20 16 -2 0 65535 -3000000000 3000000000 0 65535 0 255 0 255 0 255 0 255 -3000000000 3000000000 0 1 0 255 5 0 0 -32767 0 -32767 0 -32767 0 0 255 1200 65535 65535 65535 65535 65535 65535 255 0 32767 -2 Page 2 of 5 Description dynamic display factor for display filter (0=max, 1=min goes with par 57) static display factor for display filter (0=max, 1=min goes with par 56) calibration mode selection (not active until cntrlmode has been set to value 9) valve offset: amount of DAC steps within 1 potmeter step monitor: output signal (measure) selection for bus and analog output alarm register containing warning flags alarm register containing critical error flags 210A7D calibration register zero scale input 1 ADC 52A513 calibration register full scale input 1 ADC 210A7D calibration register zero scale input 2 ADC 52A513 calibration register full scale input 2 ADC 18904E ADC control register 0 sensor bridge zero potmeter setting 1 broadcast alarm messsage enable flag 0 test mode selection (not active until cntrlmode has been set to value 5) 1 channel selection ADC 0 controller response for normal steps (128=normal, <128=slower, >128=faster) 1.0 analog input filter constant (0=max, 1=min) 1.0 sensor input filter constant (0=max, 1=min) 32767 analog output correction factor zero scale (meas outp DSCM-A 0=0 other 3276 2000 analog output correction factor full scale (meas outp 2000 = 1 * multiplication) 32767 analog input correction factor zero scale (ext setp DSCM-A 0=0 other 32767=0 2000 analog input correction factor full scale (ext setp 2000 = 1 * multiplication) 0 (auto)tuning mode selection (not active until cntrlmode has been set to value 6 0 valve type (needed for controlling behaviour) 0 contains number(s) of changed processes for indirect polling (0xXX / 0xFF) 0.1 correction factor valve curve ratio high/low area 20,80 Valve curve correction for controller (max. factor*0.1, flow where factor = 1) 0,5000,10,5000array with memberships for normal Fuzzy controller 0000,3750,2000array with memberships for 0-open Fuzzy controller 4 IO status byte for jumper settings and LED signal modes 30000,-500,-50array with neg nor output steps for Fuzzy contr. 50,500,25000 array with pos nor output steps for Fuzzy contr. 90,180,12000 array with open at 0 output steps for Fuzzy contr. DMFC (FLOW-BUS) device type information string F201C-FA model number information string SN999999A serial number information string (to be changed by Bronkhorst HT only) STANDARD manufacturing configuration information string 01,01,95 special BHT parameter (to be changed by Bronkhorst HT only) 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter 0 special BHT parameter (to be changed by Bronkhorst HT only) 128 height of open at zero pulse train for valve VX.XX revision number of firmware 0 type of pressure sensor 1013.25 mbar atmospheric (central) barometer pressure 32767 analog sensor signal input corr. factor zero scale (DSCM-A 0=0 other 32767=0 2000 analog sensor signal input correction factor full scale (2000=1*multiplication) 32767 analog Vref input correction factor zero scale (DSCM-A 0=0 other 32767=0) 2000 analog Vref input correction factor full scale (2000=1*multiplication) 32767 analog setpoint output correction factor zero scale (DSCM-A 0=0 other 32767= 2000 analog setpoint output correction factor full scale (2000=1*multiplication) 0 reset facilities (program/alarm/batchcounter) USERTAG user definable alias string 0 maximum limit for sensor signal to trigger alarm situation FlowDDE database version V3.49 Parameter number (DDE) Parameter name Group 0 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 AlrmMinLim AlrmMode AlrmOutMod AlrmStpMod AlrmNwSetp CntrValue CntrUnit CntrLimit CntrOutMod CntrStpMod CntrNwSetp CntrUntstr capunitstr CntrMode HwRev RCreadfact channumber masterchan RCslavefct inputnode inputproc RCreadunit SlaveFact% VrefInput RespStable temperatur pressure time calvolume sensornr rangeselct TimeOut frequency imp/m3 RefVolFlow volumeflow delta-p scalefact sensorname RstAlarmEn RstCountEn MasterNode MasterProc InstrNode InstrProc RangeMin RangeMax Relay/TTL RespOpen0 ContrType PIDKp PIDTi PIDTd Density CalCertNr CalDate ServiceNr ServDate IdentNr BHT11 PowerMode 15 15 15 15 15 16 16 16 16 16 16 16 3 16 13 17 17 17 17 17 17 17 18 18 8 19 19 19 19 19 20 20 21 20 19 19 19 21 19 15 16 18 18 18 18 3 3 12 8 8 8 8 8 3 13 13 13 13 13 14 12 Group 1 2006-02-01 Group 2 Process number FB nr (par) Var Type 97 97 97 97 97 104 104 104 104 104 104 104 2 3 4 5 6 1 2 3 4 5 6 7 31 8 7 1 2 3 4 5 6 7 1 2 17 7 8 9 10 16 10 2 9 10 5 6 11 13 17 9 9 14 15 16 17 18 20 11 18 20 21 22 23 21 8 9 10 11 12 11 12 i c c c i f c f c c i c c c c f c c i c c c f i c f f f f c c i f f f f f i c c c c c c c f f c c c f f f f c c c c c c c 19 104 113 13 13 19 33 33 114 33 33 33 33 115 33 33 33 33 33 33 3 3 3 97 104 33 33 33 33 33 33 115 114 114 114 114 114 33 113 113 113 113 113 118 115 Var Length Min value Max value Read Write Poll Secured Highly Secured Default Value 0 0 0 0 0 0 0 0 0 0 0 32767 255 255 1 32767 9999999.99 31 10000000 255 1 32767 0 255 1E-10 1 0 0 0 0 1E+10 120 120 32000 128 128 0 0 0 -250 -3.4028E+38 0 0 0 0 0 0 0 0 -3.4028E+38 -100000 1 500 65535 255 500 3.4028E+38 3.4028E+38 3.4028E+38 4 99 30000 100000 3.4028E+38 3.4028E+38 3.4028E+38 100000 10000 0 0 1 1 1 1 -3.4028E+38 -3.4028E+38 0 0 0 0 0 0 0 15 15 128 128 128 128 3.4028E+38 3.4028E+38 1 255 255 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No Yes Yes Yes Yes Yes No Yes No Yes Yes Yes No Yes Yes Yes Yes No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No Yes No No No No No No No No No No No No No No No No No Yes No Yes Yes Yes No Yes Yes No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No No No No No Yes Yes No No No Yes No No No Yes No No Yes No Yes No No No No Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes No 0 0 0 0 0 0 0 0 0 0 0 ln ln/min 0 VX.XX 1.0 1 0 32000 3 1 ln/min 100.0 0 0 20 1013.25 0 50 0 0 0 0 42773.4 0 0 0 1 SENSOR0 15 7 3 1 3 1 0.0 100.0 0 0 1 10 0.05 0 1.293 4 7 1 7 10 -2 8 15 8 0 0 0 255 255 50 19991231 00000000 19991231 7 0 0 Page 3 of 5 Description minimum limit for sensor signal to trigger alarm situation alarm mode alarm relais activity mode during alarm situation setpoint change enable during alarm situation new/safe setpoint during alarm situation (until reset) actual counter value counter unit counter limit/batch counter relais activity mode when limit/batch has been reached setpoint change enable during counter limit/batch situation (until reset) new/safe setpoint at counter limit/batch situation (until reset) (normally = 0%) readout string at counter (informative) readout string at capunit (informative) counter mode minimum required hardware revision level for firmware version readout factor for direct reading (changes with readunit: local on module, R.O.) channel number for operation master channel for master-slave operation RC slave factor physical node address for channel number physical process for channel number readout unit for direct reading (local variable on module: read only) slave factor for master slave control (setp = master output * slave factor) reference voltage input for setpoint signal controller response when controller is stable: |measure-setpoint| < 2% absolute temperature in degrees Celsius absolute pressure in mbar time in milliseconds calibrated volume in litres pointer to sensor number in calibration tube (FPP) Piston Prover operation mode (write) and status information (read back) maximum admitted duration time for specific procedure frequency in Hz For FRM and FTM imp/m3 and for FCM imp/kg volume flow referenced to normal conditions i.e. 0 °C, 1013.25 hPa(a) in ln/min volume flow at actual conditions in l/min relative pressure between atmosphere and sensor position scaling factor (multiplication) for readout on display (for optimal resolution) label with information about stopsensor enable reset of alarm by: keyboard, external signal, FLOW-BUS, automatic enable reset of counter by: keyboard, external signal, FLOW-BUS, automatic node number of master instrument output signal for a slave process number of master instrument output signal for a slave node number of instrument to be operated by another module (keyboard/displa process number of instrument to be operated by another module (keyboard/dis minimum value at 0% for special user readout unit Maximum value at 100% for special user readout unit Relay/TTL output setting (disabled when used by alarm or counter) Controller response when valve opens from zero Controller settings for special purpose PID factor Kp PID factor Ki PID factor Kd Density of selected fluid in kg/m3 Number of calibration certificate (last basic calibration) Date of last (basic) calibration Servicenumber for repair/rebuilding/recalibration Date of last service action Identification number (type) of instrument/device special BHT parameter (to be changed by Bronkhorst HT only) power supply indication in Vdc FlowDDE database version V3.49 Parameter number (DDE) Parameter name Group 0 Group 1 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 Pupstream Pdownstrm Orifice FluidTemp AlrmDelay capacity0% NumOfChan DeviceFunc ScanChan ScanPar ScanTime ScanData ValveOpen NrOfRuns MinProTime LeakRate ModeInfReq ModeInfOpt ModeInfDes CalType MassFlow BusAddress InterfConf Baudrate BusDiagnos NrOfVanes Fieldbus fMeasure fSetpoint Mass Mstatus Mwarning Merror DiagHist DiagMode MStatEnabl AnOutZA AnOutSA AnInZA AnInSA SensInZA SensInSA TempInZA TempInSA ExpSmooAd SlopeSetp FilterLen fAccuracy LookI LookX LookY LookTempI LookTemp ValveMax ValveMode VlvOpenCor VlvZeroHld ValveSlope IFIData RangeUsed FldSetProp 13 13 13 13 15 3 12 12 4 4 4 22 8 20 20 20 12 12 12 20 20 23 23 23 23 20 23 2 2 20 4 4 4 4 4 4 10 10 10 10 10 10 10 10 6 18 6 2 3 3 3 3 3 8 8 8 8 8 23 20 3 3 3 3 4 18 2006-02-01 Group 2 Process number FB nr (par) Var Type 113 113 113 113 97 33 0 0 123 123 123 123 114 115 115 116 115 115 115 115 33 125 125 125 125 115 125 33 33 33 119 119 119 119 119 119 116 116 116 116 116 116 116 116 117 33 117 33 33 33 33 33 33 114 114 114 114 114 0 115 33 13 14 15 16 7 22 18 20 1 3 4 10 24 13 14 9 15 16 17 18 4 10 3 9 20 22 21 0 3 23 1 2 3 4 5 6 21 22 23 24 25 26 27 28 5 24 6 25 26 27 28 29 30 25 26 27 28 29 21 20 31 f f f f c f c c c c i c f c c f c c c c f c c l c c c f f f c c c c c c f f f f f f f f f i i f c f f c f f c f f f c c c Var Length Min value Max value -100000 100000 -100000 100000 0 1000 -273.15 3.4028E+38 0 255 -3.4028E+38 3.4028E+38 0 120 0 255 1 255 0 255 0 65535 -2 0 0 0 0 24 255 255 1 4 255 255 0 255 -3.4028E+38 3.4028E+38 0 255 0 3 0 1E+10 -2 0 255 -2 -3.4028E+38 3.4028E+38 -3.4028E+38 3.4028E+38 -3.4028E+38 3.4028E+38 3 3 3 -2 0 0 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 -3.4028E+38 0 0 0 -3.4028E+38 0 -3.4028E+38 -3.4028E+38 0 -273.15 0 0 0 0 0 255 255 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 1 32000 255 3.4028E+38 20 3.4028E+38 3.4028E+38 1 3.4028E+38 24 255 1.5 1 50 0 0 99 255 -2 Read Write Poll Secured Highly Secured Default Value Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No Yes Yes Yes Yes Yes No No Yes No Yes Yes Yes No Yes No No Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No Yes Yes Yes Yes Yes Yes No No No No No No Yes No No Yes Yes No No Yes No Yes No Yes No Yes No No No No No No No No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes No Yes Yes Yes Yes Yes Yes No No Yes No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes 3 1 1 20 3 0 1 5 1 8 50 Page 4 of 5 Description upstream pressure of fluid in bara (for first fluidnr only) downstream pressure of fluid in bara (for first fluidnr only) orifice diameter in mm temperature of fluid through instrument (for first fluidnr only) time alarm and reset action will be delayed when alarm limit has been exceede capacity of instrument at zero 0% in sensor base units (mostly equal to zero) number of instrument channels available for this device function of device Channel number to scan with real time information (to be set once) Parameter number to scan with real time information (to be set once) Scan interval time in msec between two samples (to be set once) Scanned data with time label (can be readout event by event) 0.04 First-step offset current/voltage for valve when opening from 0% 1 Amount of runs of a piston prover (0 = stability check) 10 Minimum process time of a piston prover in 0.1 seconds 0.0001 Leak rate piston prover Sets instr. in info mode for 1 read-cycle to check available parameter options Gives info about possible values of a mode in an array as result of ModeInfo re Gives description about one of the mode options 0 Enables/disables options for calibration device (8 bits for 8 options) 0 Real mass flow in kg/min 2 Station address for actual fieldbus system other than FLOW-BUS 1 Configuration setting for interface to other bus-systems 12000000 Baudrate for actual fieldbus system other than FLOW-BUS Bus diagnose string for actual fieldbus system other than FLOW-BUS 10 Number of vanes for use in a rotor meter FLOW-BUS Fieldbus for which instrument has been equiped 0 measured value for direct reading (in capunits, max.= capacity) 0 setpoint: wanted value for direct reading (in capunits, max.= capacity) 0 Mass in g Manufacturer Status register (1 byte diag code + 2 byte diag bits) Manufacturer Warning register (1 byte diag code + 2 byte diag bits) Manufacturer Error register (1 byte diag code + 2 byte diag bits) Diagnostic history string (contains history of diag codes) 0 Diagnostic mode (0 = diagnostics off, 1 = diagnostics on) 0 Manufacturer Status enable (0-127 or 254 = disable all, 255 = enable all) 0 Analog measure output, zero adjust 1 Analog measure output, span adjust 0 Analog setpoint input, zero adjust 1 Analog setpoint input, span adjust 0 Sensor input, zero adjust 1 Sensor input, span adjust 0 Sensor temperature input, zero adjust 1 Sensor temperature input, span adjust 1.0 Sensor input filter adapt setting 32000 Slope setpoint step. Setpoint step for the given slopetime 1 Number of samples for Average filter 0 Actual accuracy in current unit 0 Lookup table for linearisation index (x and y direction) 0 Lookup table for linearisation x 0 Lookup table for linearisation y 0 Lookup table for linearisation at certain temperature index (z direction) 0 Lookup table for linearisation at certain temperature (z) 0.2 Maximum current/voltage for valve 1 Valve output mode selection (0 = voltage, 1 = current) 0.96 Valve open current/voltage correction (example: 0.96, Open = ValveOpen * 0.9 0 Valve hold current/voltage at %0 setp (example: 0.8, Hold = ValveOpen * 0.8) 0.009 Valve slope time (Seconds) 0 IFI data dump protocol communication string 0 Piston Prover information about used sensors 0 Fluidset properties FlowDDE database version V3.49 Parameter number (DDE) Parameter name Group 0 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 LUnitType LUnTypNam LUnit LUnitName CUnitType CUnTypNam CUnTypTem CUnTypPres CapMin CapMax FormulaTyp HeatCap ThermCond Viscosity NormMasFlw Kspeed SensorCode SensorRevC RestrCode RestrRevC RestrNxP Seals ValveCode ValveRevC InstrProp LookFreqI LFFreq LFTemp LFDensity LFSpanAdj 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 8 13 13 13 13 13 13 13 13 13 3 3 3 3 3 0 3 DensityAct Group 1 3 2006-02-01 Group 2 Process number FB nr (par) Var Type 33 33 33 33 1 1 33 33 1 1 113 113 113 113 113 114 113 113 113 113 113 113 113 113 113 116 116 116 116 116 0 116 12 13 16 17 29 30 10 11 27 28 17 18 20 21 22 30 23 24 25 26 27 28 29 30 31 10 11 12 13 14 0 15 c c c c c c f f f f i f f f f f i c i c l c i c l c f f f f f Var Length Min value Max value Read Write Poll Secured Highly Secured Default Value 0 255 255 0 255 -273.15 0 -3.4028E+38 -3.4028E+38 0 0 0 0 -3.4028E+38 0 0 0 0 0 0 0 0 0 0 0 -3.4028E+38 -273.15 -3.4028E+38 -3.4028E+38 0 -3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 65535 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 65535 255 65535 255 2147483648 255 65535 255 2147483648 1 3.4028E+38 3.4028E+38 3.4028E+38 3.4028E+38 0 3.4028E+38 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes No No No No No No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No No No No 0 0 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes 20 7 20 16 0 kg/s 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 0 V,V 0 0 0 0 0 0 0 0 0 Description Lookup table capacity unit type Lookup table capacity unit type name (informative) Lookup table capacity unit (unit LUTy) Lookup table capacity unit name (informative) Output capacity unit type Output capacity unit type name (informative) Output capacity unit type temperature (°C) Output capacity unit type pressure (bar (a)) Minimum capacity in output capacity units Maximum capacity in output capacity units Formula type needed for conversion Heat capacity (Cp) Thermal conductivity (lambda) Viscosity Normalized mass flow in ln/min air equivalent Controller speed factor (gain) Sensor code Sensor revision code Restriction code Restriction revision code Restriction NxP (proportional to air equivalent capacity of LFE) Seals information (1st byte = other, 2nd = plunger seal) Valve code Valve revision code Instrument properties Lookup table for frequency index Lookup table for frequency frequency Lookup table for frequency temperature Lookup table for frequency density Lookup table for frequency span adjust dummy parameter (for now) Actual density, measured by instrument Page 5 of 5 APPENDIX 2 Parameter values table Parameter values table FlowDDE database version V3.49 Parameter number (DDE) Parameter name 6 6 6 6 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 22 22 22 22 22 22 22 22 22 22 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 44 44 44 44 44 44 44 44 53 53 53 53 53 53 53 53 53 58 58 58 58 arbitrage arbitrage arbitrage arbitrage cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode cntrlmode sensortype sensortype sensortype sensortype sensortype sensortype sensortype sensortype sensortype sensortype alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo alarminfo opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA opermodeTA AnalogMode AnalogMode AnalogMode AnalogMode AnalogMode AnalogMode AnalogMode AnalogMode AnalogMode CalMode CalMode CalMode CalMode 2006-02-01 Filter Value &H01 &H02 &H04 &H08 &H10 &H20 &H80 &H02 &H08 &H20 &H40 &H80 &H10 &H40 &H04 &H01 &H3F &H3F &H3F &H3F &H80 &H80 &H40 &H40 &H3F Description 1 temporary busmaster 2 always busmaster 3 automatic busmaster 67 auto busmaster and auto bus optimalization (fast token ring) 7 setpoint = 100% 15 (FPP) Manual start sensor select, automatic end sensor 14 (FPP) Range select mode 11 setpoint = keyboard OR FLOW-BUS setpoint 10 setpoint = master output(analog in) * slave factor(FLOW-BUS) 6 tuningmode enable (select subtject with par 79) 8 purge valve (fully open) 18 setpoint = RS232 setpoint 2 setpoint = master output(FLOW-BUS) * slave factor(FLOW-BUS) 3 close valve 4 setpoint idle (no reaction on changes in sensor signal) 5 testmode enable (select subject with par 70) 9 calibration mode enable (select subject with par 58) 17 (FPP) Automatic start and end sensor 1 setpoint = analog input 19 RS232 broadcast mode 20 valve stearing (valve = setpoint) 21 analog valve stearing (valve = analog setpoint) 12 setpoint = 0% 13 setpoint = master output(FLOW-BUS) * slave factor(analog in) 0 setpoint = BUS setpoint 16 (FPP) Automatic start sensor select, manual end sensor 130 liquid/gas mass (sensor) 129 liquid volume (sensor) 128 pressure (sensor) 4 other sensor type (controller) 1 liquid volume (controller) 2 liquid/gas mass (controller) 132 other sensor type (sensor) 0 pressure (controller) 3 gas volume (controller) 131 gas volume (sensor) 1 at least 1 error message in alarm error status register 0 no warning message in alarm warning status register 0 no minimum alarm message (measure>minimum limit) 0 no maximum alarm message (measure<maximum limit) 0 batch counter has not reached its limit 0 response O.K. (setpoint-measure within limit) 0 hardware O.K. 1 at least 1 warning message in alarm warning status register 1 maximum alarm message for measured signal 1 response alarm message: setpoint-measure is too high 1 master output signal not received: check master instrument 1 hardware error message: check your hardware 1 batch counter has reached its limit 0 master output signal O.K. (or not used) 1 minimum alarm message for measured signal 0 no error message in alarm error status register 3 A: MAX & RESP; T: DOWN FROM LIMIT 4 A: MIN & RESP; T: DOWN AND REPEAT 5 A: MAXIMUM ALARM; T: ALWAYS UP 6 A: MINIMUM ALARM 1 A: MAX & RESP AUTO; T: UP TO LIMIT 7 A: RESPONSE ALARM 2 A: MIN & RESP AUTO; T: UP AND REPEAT 0 OFF 3 4...20 mA operation 2 0...20 mA operation 4 15...20 mA operation 0 0...5 Vdc operation 1 Analog output disabled 0 Analog output enabled 1 Analog input disabled 0 Analog input enabled 1 0...10 Vdc operation 10 adjust Vref output by connecting it to analog in 11 adjust analog out by connecting it to analog in 9 zero sensor bridge circuit 8 dmfc Page 1 of 5 FlowDDE database version V3.49 Parameter number (DDE) Parameter name 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 61 61 62 62 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 69 69 70 70 70 70 70 70 70 70 70 CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode CalMode monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor monitor AlarmReg1 AlarmReg1 AlarmReg2 AlarmReg2 ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg ADCcntrReg AlarmEnble AlarmEnble TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode TestMode Filter &H8000000000000000 &H8000000000000000 &H8000000000000000 &H8000000000000000 &H1C0000 &H020000 &H010000 &H1C0000 &H1C0000 &H020000 &H1C0000 &H1C0000 &H1C0000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 &HE00000 &H010000 &H1C0000 &HE00000 &H001000 &H008000 &H004000 &H004000 &H002000 &H002000 &H001000 &H008000 &H1C0000 2006-02-01 Value Description 7 dmfc 6 dmfc 4 dmfc 12 adjust valveoutput by connecting it to analog in 2 dmfc 1 adc self calibration 18 adjust heater balance 0 idle: no action 3 dmfc 15 analog output = 0 % 5 dmfc 17 analog output = 50 % 13 dmfc 16 analog output = 100 % 14 dmfc 9 analog input signal 0 (filtered) setpoint 11 mass flow in display unit (normally ln/min) 19 mass flow in kg/min 15 time in msec/frequency in Hz. 18 atmospheric (barometer) pressure in mbara 17 delta-P pressure in mbarg 16 calibrated volume at actual sensor in ml 8 normal sensor signal (Output) 10 power supply voltage 1 controller error input signal 12 volume flow in l/min 14 pressure absolute in mbara 13 temperature in °C 2 controller output signal to valve 7 differentiator output filtered 6 differentiator output 5 linearization output 4 sensor signal slow filtered 3 sensor signal slow 1 Diagnostics available in warning register 0 No diagnostics available in warning register 0 No diagnostics available in error register 1 Diagnostics available in error register 3 ADC gain = 8x 0 ADC input channel 1 selection 0 ADC no power down mode (normal) 6 ADC gain = 64x 4 ADC gain = 16x 1 ADC input channel 2 selection 2 ADC gain = 4x 1 ADC gain = 2x 0 ADC gain = 1x 7 ADC read/write FS calibration coefficients on sel. channel 6 ADC read/write ZS calibration coefficients on sel. channel 5 ADC activate background calibration on selected channel 4 ADC activate system offset calibration on selected channel 3 ADC activate system calibration FS on selected channel 1 ADC activate self calibration on selected channel 0 ADC normal (sampling) mode 1 ADC power down mode 7 ADC gain = 128x 2 ADC activate system calibration ZS on selected channel 1 ADC unipolar mode 1 ADC 24-bit word length 0 ADC output compensation current off 1 ADC output compensation current on 0 ADC burn-out current off 1 ADC burn-out current on 0 ADC bipolar mode 0 ADC 16-bit word length 5 ADC gain = 32x 1 enable 0 disable 2 IO 4 FRAM 3 RAM 12 keyboard 1 uProcessor 5 ADC 7 sensor 10 FLOW-BUS 6 DAC Page 2 of 5 FlowDDE database version V3.49 Parameter number (DDE) Parameter name 70 70 70 70 71 71 79 79 79 79 79 79 80 80 80 80 80 86 86 86 86 86 86 86 86 86 86 106 106 106 106 106 106 106 106 106 114 114 114 114 114 114 118 118 118 118 119 119 119 120 120 125 125 125 126 126 130 130 130 147 147 147 147 147 147 147 147 147 147 147 147 147 156 156 156 156 156 156 TestMode TestMode TestMode TestMode ChanSelect ChanSelect TuningMode TuningMode TuningMode TuningMode TuningMode TuningMode DefVlvType DefVlvType DefVlvType DefVlvType DefVlvType IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus IOStatus PressSensr PressSensr PressSensr PressSensr PressSensr PressSensr PressSensr PressSensr PressSensr Reset Reset Reset Reset Reset Reset AlrmMode AlrmMode AlrmMode AlrmMode AlrmOutMod AlrmOutMod AlrmOutMod AlrmStpMod AlrmStpMod CntrOutMod CntrOutMod CntrOutMod CntrStpMod CntrStpMod CntrMode CntrMode CntrMode rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct rangeselct RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn 2006-02-01 Filter Value &H01 &H40 &H80 &H10 &H08 &H03 &H03 &H03 &H20 &H02 Description 9 Vref 8 valve drive circuit 11 calibration 0 idle; no action 1 AD channel 1 2 AD channel 2 4 Fuzzy controller open at zero 3 Fuzzy controller normal operation 1 sensor 0 idle; no action 2 valve 5 PID controller 1 normally opened 2 normally closed inverse controlled 3 normally opened inverse controlled 4 remain position 0 normally closed 1 don't read diagnostic jumper (no diagnostics, read/write) 1 analog jumper set (read only) 1 micro switch pressed (read only) 1 diagnostic jumper set (read only) 1 don't read micro switch (always off, read/write) 1 don't read analog jumper (use cntrlmode, read/write) 3 Red LED blinking fast 0 Red LED off 1 initialization jumper set (read only) 1 not used 3 absolute pressure 800-1100 mbar 1 delta-P 0...10" W.C. 7 delta-P 0...1 PSI 2 absolute pressure 800-1200 mbar 6 delta-P -10...+10 "W.C. 5 delta-P -10...0 "W.C. 4 delta-P -5...0 "W.C. 0 delta-P 0..5" W.C. 8 delta-P -1...0 PSI 3 restart batch counter 4 reset counter value (counter off) 2 reset alarm 1 reset counter value (no mode change) or common reset 5 Reset module (soft reset) 0 no reset 0 off 1 alarm on absolute limits 2 alarm on limits related to setpoint (response alarm) 3 alarm when instrument powers-up (eg. after power-down) 0 no relais activity at alarm 2 relais activated until reset 1 relais pulses until reset 0 no setpoint change at alarm 1 new/safe setpoint at alarm enabled (set at par 121) 2 relais activated after reaching batch limit until reset 1 relais pulses after reaching batch limit until reset 0 no relais activity at batch limit 0 setpoint change at batch limit disabled 1 setpoint change at batch limit enabled 0 off 2 counting up to limit (batchcounter) 1 counting upwards continuously 9 run calibration with automatic range selection 0 calibration ready/stop 1 run calibration until stopsensor 1/select range 1 2 run calibration until stopsensor 2/select range 2 3 run calibration until stopsensor 3/select range 3 5 run calibration and select range 5 19 run until stopsensor 1 until 3 values between limit 29 run until stopsensor 2 until 3 values between limit 39 run until stopsensor 3 until 3 values between limit 49 run until stopsensor 4 until 3 values between limit 59 run and select range 5 until 3 values between limit 99 run with auto-select + 3 values between limit 4 run calibration until stopsensor 4/select range 4 9 reset: automatic or keyboard 11 reset: automatic or keyboard or external 0 no reset possible 15 reset: automatic or FLOW-BUS or keyboard or external 14 reset: automatic or FLOW-BUS or external 12 reset: automatic or FLOW-BUS Page 3 of 5 FlowDDE database version V3.49 Parameter number (DDE) 156 156 156 156 156 156 156 156 156 156 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 157 166 166 166 166 166 166 166 166 166 166 166 166 166 166 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 175 185 185 185 185 185 185 Parameter name RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstAlarmEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn RstCountEn ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType ContrType IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr IdentNr DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc DeviceFunc 2006-02-01 Filter Value &H40 &H08 &H40 &H20 &H04 &H20 &H04 &H02 &H02 &H01 &H01 &H10 &H10 &H08 Description 10 reset: automatic or external 7 reset: FLOW-BUS or keyboard or external 8 reset: automatic 6 reset: FLOW-BUS or external 5 reset: FLOW-BUS or keyboard 4 reset: FLOW-BUS 3 reset: keyboard or external 2 reset: external 1 reset: keyboard 13 reset: automatic or FLOW-BUS or keyboard 13 reset: automatic or FLOW-BUS or keyboard 8 reset: automatic 14 reset: automatic or FLOW-BUS or external 12 reset: automatic or FLOW-BUS 11 reset: automatic or keyboard or external 10 reset: automatic or external 9 reset: automatic or keyboard 15 reset: automatic or FLOW-BUS or keyboard or external 1 reset: keyboard 2 reset: external 3 reset: keyboard or external 6 reset: FLOW-BUS or external 4 reset: FLOW-BUS 7 reset: FLOW-BUS or keyboard or external 0 no reset possible 5 reset: FLOW-BUS or keyboard 1 controller special mode (valve output steps) turned on 1 voltage drift compensation for valve output turned off 0 controller special mode (valve output steps) turned off 1 voltage drift compensation for valve output turned off 1 monitor output changed at setpoint steps 0 voltage drift compensation for valve output turned on 0 fixed monitor output signal 1 open from zero with ramp output to valve 0 open from zero with PID output to valve 1 valve in safe position after startup 0 valve in normal position after startup 1 auto slope enabled for pilot valves 0 auto slope disabled 0 voltage drift compensation for valve output turned on 26 FLOW-BUS Balance Interface 32 FLOW-BUS Switch Interface 31 Keithley FLOW-BUS Interface 30 Instrument FLOW-BUS Interface 29 FLOW-BUS Interface Climate Control 27 CoriFlow Controller 5 T/A-module 25 FLOW-BUS Coriolis Meter 24 Profibus-DP/FLOW-BUS interface module 28 CoriFlow Meter 14 DSCM-A: digital single channel module for analog instruments 1 RS232/FLOW-BUS interface 20 DSCM-E: evaporator controller module (single channel) 21 DSCM-C: digital single channel module for calibrators 22 DDCM-A: digital dual channel module for analog instruments 23 DMCM-D: digital multi channel module for digital instruments 19 F/A-module: special version of T/A-module 10 DEPM: digital electronic pressure meter 18 FPP: FLOW-BUS piston prover/tube (calibration-instrument) 17 FTM: FLOW-BUS turbine meter (calibration-instrument) 3 ADDA4 (4 channels) 15 DSCM-D: digital single channel module for digital instr. 2 PC(ISA) interface 13 DLFM: digital liquid flow meter 12 DLFC: digital liquid flow controller 11 ACT: single actuator 9 DEPC: digital electronic pressure controller 8 DMFM: digital mass flow meter 7 DMFC: digital mass flow controller 6 ADDA1: 1 channel ADDA converter module 4 R/C-module, 32 channels 16 FRM: FLOW-BUS rotor meter (calibration-instrument) 6 Meter 0 Unknown 8 (Protocol) converter 3 Operator 2 ADDA 1 Interface Page 4 of 5 FlowDDE database version V3.49 Parameter number (DDE) 185 185 185 197 197 197 197 200 200 200 200 208 208 209 209 210 210 212 212 213 213 213 213 232 232 238 238 238 238 238 238 263 263 263 263 263 263 Parameter name DeviceFunc DeviceFunc DeviceFunc CalType CalType CalType CalType InterfConf InterfConf InterfConf InterfConf Mstatus Mstatus Mwarning Mwarning Merror Merror DiagMode DiagMode MStatEnabl MStatEnabl MStatEnabl MStatEnabl ValveMode ValveMode FldSetProp FldSetProp FldSetProp FldSetProp FldSetProp FldSetProp InstrProp InstrProp InstrProp InstrProp InstrProp InstrProp 2006-02-01 Filter Value &H01 &H01 &H02 &H02 &H800000 &H800000 &H800000 &H800000 &H800000 &H800000 &H01 &H04 &H02 &H01 &H02 &H04 &H04 &H01 &H02 &H04 &H01 &H02 Description 4 Supervisor (totalizer/alarm) 5 Controller 7 Special 0 Automatic capacity setting for optimal resolution 1 Manual capacity setting for optimal resolution 0 Barometer value input via parameter 107: BaroPress 1 Barometer is master; input automatically from master 1 Configuration B: 14 ch. Standard parms with fixed chan list 0 Configuration A: 14 ch. Standard parms. with network scan 2 Configuration C: 7 ch. Extended parms with fixed chan list 3 Configuration D: 11 ch. Extended parms with network scan 0 No diagnostics available in manufacturer status register 1 Diagnostics available in manufacturer status register 0 No diagnostics available in manufacturer warning register 1 Diagnostics available in manufacturer warning register 0 No diagnostics available in manufacturer error register 1 Diagnostics available in manufacturer error register 1 Debug mode on 0 Debug mode off 254 clear all status bits 127 set status bit (range 0…127) 0 set status bit (range 0…127) 255 set all status bits 0 voltage drive mode 1 current drive mode 1 Fluidset enabled 0 Fluidset is not actual calibrated 0 Fluidset is not set by Bronkhorst High-Tech 0 Fluidset is disabled 2 Fluidset is set by Bronkhorst High-Tech 4 Fluidset is actual calibrated 0 Instrument is not multi-range multi-fluid capable 1 Instrument has polynomial 2 Instrument has lookup table for linearization 3 Instrument is multi-range multi-fluid capable 0 Instrument has no polynomial 0 Instrument has no lookup table for linearization Page 5 of 5 Instruction manual Operation instructions digital Mass Flow / Pressure instruments parameters and properties Doc. no.: 9.17.023I Date: 26-10-2005 ATTENTION Before installing and operating the instrument it is recommended that this instruction be read. Not following the guidelines could result in personal injury and/or damage to the equipment. BRONKHORST HIGH-TECH B.V. SCOPE OF THIS MANUAL This manual covers the operation part of digital massflow / pressure instruments for gases or liquids. It describes the parameters and their properties needed for (digital) operation. More information can be found in other documents. Multibus instruments have modular instruction manuals consisting of: - General instructions digital Mass Flow / Pressure instruments laboratory style / IN-FLOW (document nr. 9.17.022) - General instructions CORI-FLOW (document nr. 9.17.031) - General instructions digital LIQUI-FLOW L30 (document nr. 9.17.044) - Operation instructions digital instruments (document nr. 9.17.023) - Fieldbus/interface descriptions. - FLOW-BUS interface (document nr. 9.17.024) - PROFIBUS–DP interface (document nr. 9.17.025) - DeviceNet interface (document nr. 9.17.026) - RS232 interface with FLOW-BUS protocol (document nr. 9.17.027) - Modbus interface (document nr. 9.17.035) special request page 2 9.17.023 BRONKHORST HIGH-TECH B.V. TABLE OF CONTENTS 1 2 3 4 5 DIGITAL INSTRUMENT.........................................................................................................................5 1.1 General ..........................................................................................................................................5 1.2 Functional block diagram ................................................................................................................6 1.3 Calibration with mathematical functions...........................................................................................6 1.3.1 General information .................................................................................................................6 1.3.2 Polynomial functions ................................................................................................................6 1.3.3 General form of a polynomial function ......................................................................................6 1.3.4 Polynomial function of sensor signal ........................................................................................7 1.3.5 Look-up tables .........................................................................................................................7 1.3.6 General form of 2-dimensional look-up tables...........................................................................7 1.3.7 Look-up table for sensor signal ................................................................................................7 1.3.8 Look-up tables with temperature compensation........................................................................7 1.3.9 General form of 3-dimensional look-up tables...........................................................................8 1.3.10 Look-up table with temperature compensation for sensor signal ...............................................8 1.3.11 Using mathematical functions at a digital instrument.................................................................8 1.4 Multi Fluid / Multi Range instruments...............................................................................................9 1.4.1 General information .................................................................................................................9 1.4.2 Differences between traditional and MFMR instruments ...........................................................9 PARAMETERS AND PROPERTIES ....................................................................................................10 2.1 Measured value (measure) ...........................................................................................................12 2.2 Setpoint ........................................................................................................................................12 2.3 Setpoint slope...............................................................................................................................12 2.4 Analog input .................................................................................................................................12 2.5 Setpoint/control modes .................................................................................................................13 2.5.1 Dual interface operation .........................................................................................................13 2.5.2 Master/slave (ratio) control.....................................................................................................14 2.5.3 Tuning, test and calibration ....................................................................................................14 2.6 Fluid number.................................................................................................................................14 2.7 Fluid name....................................................................................................................................14 2.8 Valve output .................................................................................................................................15 2.9 Temperature.................................................................................................................................15 DIRECT READING PARAMETERS .....................................................................................................16 3.1 Sensor type ..................................................................................................................................16 3.2 Capacity (100%) ...........................................................................................................................16 3.3 Capacity 0% .................................................................................................................................16 3.4 Fmeasure .....................................................................................................................................16 3.5 Fsetpoint.......................................................................................................................................17 3.6 Capunit.........................................................................................................................................17 3.7 Capacity unit string .......................................................................................................................17 IDENTIFICATION PARAMETERS .......................................................................................................18 4.1 Serialnumber ................................................................................................................................18 4.2 Modelnumber................................................................................................................................18 4.3 Firmware version ..........................................................................................................................18 4.4 Usertag.........................................................................................................................................18 4.5 Manufacturer config ......................................................................................................................18 4.6 Identnumber .................................................................................................................................19 4.7 Device type...................................................................................................................................19 ALARM/STATUS PARAMETERS ........................................................................................................20 5.1 Alarminfo ......................................................................................................................................20 5.2 Status...........................................................................................................................................20 5.3 Alarm mode ..................................................................................................................................20 5.4 Alarm maximum limit.....................................................................................................................21 5.5 Alarm minimum limit......................................................................................................................21 5.6 Alarm output mode .......................................................................................................................21 5.7 Alarm setpoint mode.....................................................................................................................21 5.8 Alarm new setpoint .......................................................................................................................21 5.9 Alarm delay time...........................................................................................................................21 5.10 Reset alarm enable ...................................................................................................................22 5.11 Using an alarm (examples)........................................................................................................22 page 3 9.17.023 BRONKHORST HIGH-TECH B.V. 6 COUNTER PARAMETERS..................................................................................................................24 6.1 Counter value ...............................................................................................................................24 6.2 Counter mode...............................................................................................................................24 6.3 Counter setpoint mode..................................................................................................................24 6.4 Counter new setpoint ....................................................................................................................24 6.5 Counter limit .................................................................................................................................24 6.6 Counter output mode ....................................................................................................................24 6.7 Counter unit..................................................................................................................................25 6.8 Counter unit string ........................................................................................................................25 6.9 Using a counter (example) ............................................................................................................25 7 SPECIAL PARAMETERS ....................................................................................................................26 7.1 Reset............................................................................................................................................26 7.2 Init/reset (key-parameter)..............................................................................................................26 7.3 Wink .............................................................................................................................................26 8 CONTROLLER PARAMETERS ...........................................................................................................27 8.1 Controller......................................................................................................................................27 8.2 RespOpen0 ..................................................................................................................................27 8.3 ContrResp ....................................................................................................................................27 8.4 RespStable...................................................................................................................................27 8.5 PIDKp...........................................................................................................................................27 8.6 PIDTi ............................................................................................................................................27 8.7 PIDTd...........................................................................................................................................27 8.8 TdsUp...........................................................................................................................................28 8.9 TdsDn...........................................................................................................................................28 8.10 ExpSmooCon ............................................................................................................................28 8.11 ExpSmooAd ..............................................................................................................................28 9 SPECIAL INSTRUMENT FEATURES..................................................................................................29 9.1 Zero (mass flow instruments only).................................................................................................29 9.1.1 Zeroing with the Micro-switch.................................................................................................29 9.1.2 Zeroing with digital communication.........................................................................................29 9.2 Restore parameter settings...........................................................................................................30 10 MANUAL INTERFACE: micro-switch and LED’s ...............................................................................31 10.1 General .....................................................................................................................................31 10.2 Readout/change bus-address/MAC-ID and baudrate .................................................................34 10.2.1 Set instrument to default installation address/MAC-ID: ...........................................................34 10.2.2 Readout bus-address/MAC-ID and baudrate: .........................................................................34 10.2.3 Change bus-address/MAC-ID and baudrate: ..........................................................................35 11 JUMPER SETTINGS MULTIBUS INSTRUMENTS ...........................................................................36 12 TESTING AND DIAGNOSTICS ........................................................................................................37 page 4 9.17.023 BRONKHORST HIGH-TECH B.V. 1 DIGITAL INSTRUMENT 1.1 General A digital instrument of Bronkhorst High-Tech is a Mass Flow or Pressure Meter/Controller which is equipped with a digital electronic multibus PCB. These electronics consist of a micro-controller with peripheral circuitry for measuring, controlling and communication. The flow/pressure signal, is measured and digitized directly at the sensor and processed by means of the internal software (firmware). Measured and processed values can be output through the analog interface or through the digital communication line (RS232 or optional fieldbus interface). For controllers the setting for the actuator is calculated by the firmware. Setpoint can be given through the analog interface or through the digital communication line. Digital instruments have many parameters for settings for signal processing, controlling and many extra features and therefore they have a wide range in use. Reading and changing of these settings is only possible through fieldbus or RS232, except for measured value, setpoint and valve output, which is also possible through the analog interface. (Depending on parameter setting) See operating instructions of Readout and Control module or PC-program how to read/change parameter values of digital instruments. Digital instruments can be operated by means of: 1. 2. 3. 4. 5. 6. Analog interface (0...5Vdc/0...10Vdc/0...20mA/4...20mA) RS232 interface (connected to COM-port by means of special cable on 38400 Baud) FLOW-BUS PROFIBUS-DP DeviceNet Modbus (special request) Option 1 and 2 are always present on multibus instruments. An interface to any available fieldbus is optional. Operation via analog interface, RS232 interface and an optional fieldbus can be performed at the same time. A special parameter called “control mode” indicates to which setpoint the controller should listen: analog or digital (via fieldbus or RS232). The RS232 interface behaves like a FLOW-BUS interface. When using more interfaces at the same time, reading can be done simultaneously without problems. When changing a parameter value, the last value send by an interface will be valid. Also the micro push-switch switch and the LED’s on top of the instrument can be used for manual operation of some options. The green LED will indicate in what mode the instrument is active. The red LED will indicate error/warning situations. page 5 9.17.023 BRONKHORST HIGH-TECH B.V. 1.2 Functional block diagram DMFC/DEPC functional block diagram Digital communication Analog Output Analog Input ADC DAC Switch LED's Setpoint Microcontroller Filter Differentiator Slope Difference Measure PID controller Control Linearisation DAC ADC Sensor Valve 1.3 Calibration with mathematical functions 1.3.1 General information A standard calibrated digital instrument has a linearized transfer function within 1% F.S. accuracy. This means that real flow/pressure is proportional to the output and setpoint signal (0-5 V, 0-10 V, 0-20 mA or 420 mA) within 1% of the full scale range. Depending on instrument and sensor type an instrument output signal is calculated with one of the following mathematical methods: • polynomial function • look-up table (2 dimensions) • look-up table with temperature compensation (3 dimensions) All these methods are methods of approximation which mathematically describes a continues transfer function to calculate a flow/pressure out of the sensor signal of the device. 1.3.2 Polynomial functions By means of a few samples, a polynomial function can be obtained. After determining the polynomial function, the original calibration points and an infinite amount of values in between, can be calculated with high accuracy. In a system where pressure- and/or flow meters and -controllers should be readout and set with high accuracy, these polynomial functions often are used for approximation of their transfer function. 1.3.3 General form of a polynomial function The general form of a polynomial function of the n-nd degree is as follows: y = a0 + a1 ⋅ X + a 2 ⋅ X 2 + a 3 ⋅ X 3 + ..... + a n ⋅ X n Where 'a0' to 'an' are polynomial parameters, which can be calculated. nd When you have 'n + 1' measure-points, they can be approximated by means of a 'n ' degree polynomial function. page 6 9.17.023 BRONKHORST HIGH-TECH B.V. 1.3.4 Polynomial function of sensor signal By means of a calibration at Bronkhorst High-Tech B.V. several measured calibration points will be used to obtain a polynomial function. rd The form of this function of the 3 degree is: Y = a + b⋅ X + c⋅ X 2 + d ⋅ X 3 In which 'Y' is the normalized measured value (0-100%) and 'X' is the value of the sensor signal. Characters 'a - d' are polynomial parameters, which can be obtained by a mathematical program. The polynomial parameters are calculated in such a way that the fit error between the calibration points and the polynomial function is minimized. 1.3.5 Look-up tables In certain cases it is not possible to describe a sensor signal curve by means of a polynomial function of the rd 3 degree. In those cases a look-up table is a good alternative. A look-up table is a table filled with calibration points. The embedded software inside the digital instrument calculates a continues smooth function which fits exactly through these calibration points. Using this method it is possible to describe any monotone rising sensor signal curve with high accuracy. 1.3.6 General form of 2-dimensional look-up tables The general form of a 2-dimensional look-up table is as follows: index X Y 0 x0 y0 1 x1 y1 2 x2 y2 3 x3 y3 … … … n xn yn In which 'Y' is the normalized measured value (0-100%), 'X' is the value of the sensor signal and ‘index’ represents the position in the look-up table. 1.3.7 Look-up table for sensor signal A digital instrument with look-up table capability for sensor signal can store look-up tables with at maximum 21 calibration points. 1.3.8 Look-up tables with temperature compensation Almost all flow and pressure sensors are temperature sensitive. For most of these sensors it is easy to decrease the temperature sensitivity to acceptable level by means of easy methods. This is called ‘intrinsic temperature compensation’. For some sensor types intrinsic temperature compensation is hard to establish. In those cases Bronkhorst uses a 3-dimensional look-up table with temperature compensation in its instruments. To compensate the measured sensor signal for the actual temperature, in those instruments a temperature sensor is added inside the flow or pressure sensor. The temperature signal is used to compensate the flow or pressure sensor signal to the correct value. page 7 9.17.023 BRONKHORST HIGH-TECH B.V. 1.3.9 General form of 3-dimensional look-up tables The general form of a 3-dimensional look-up table is as follows: In which 'T' is the calibration temperature, 'Y' is the normalized measured value (0-100%), 'X' is the value of the sensor signal and ‘index’ represents the position in the look-up table. 1.3.10 Look-up table with temperature compensation for sensor signal By means of a calibration at two different temperatures several measured calibration points will be used to obtain two look-up tables. Bronkhorst uses climatic chambers and fully automated calibration systems for calibration of the sensor signal. The actual measurement is based on both sensor and temperature measurement. 1.3.11 Using mathematical functions at a digital instrument Digital instruments are capable of storing 8 different fluid calibrations. Parameters for these calibrations are stored inside the instrument and can be changed through the fieldbus or the RS232 connection by means of a PC-program or a digital Readout and Control module. Factory calibration parameters are secured and can not be changed unless you have special rights to do this. Selection of another fluid is part of operation and therefore not secured. Digital instruments will need at least 1 fluidset of calibration parameters for operation. page 8 9.17.023 BRONKHORST HIGH-TECH B.V. 1.4 Multi Fluid / Multi Range instruments 1.4.1 General information Multi Fluid / Multi Range (MFMR) instruments are calibrated for standard ranges which can easily be configured for other fluids and ranges. This applies for both Bronkhorst and its customers. Changing fluid and range can be performed by means of a simple computer program through the RS232 connection of an instrument. The program can convert the primal calibration curve inside the instrument to the selected fluid and range. 1.4.2 Differences between traditional and MFMR instruments In traditional digital instruments the parameters capacity, density, unittype, unitname etc are static parameters and do not harm the behavior of the instrument. These parameters are used by for example read out units or PC-software to convert the measured value in percentage of the maximum output to a real value in a certain unit. However in MFMR instruments these parameters are dynamic. Examples: An instrument is configured for 2000 mln/min Air. Changing the unit name from ‘mln/min’ to ‘ln/min’ effects that the capacity automatically changes from ‘2000’ to ‘2’. The 100% output is not affected. Changing the capacity from ‘2000’ to ‘1000’ effects that the instruments full scale range (100% output) changes to 1000 mln/min. The instrument is reranged. page 9 9.17.023 BRONKHORST HIGH-TECH B.V. 2 PARAMETERS AND PROPERTIES Digital instruments consist of a microcontroller with several processes running simultaneously for: Measuring sensor value Reading analog input signal Digital signal processing Driving valve Setting analog output signal Communication with world outside Memory handling Each process needs its own specific parameters in order to function correctly. Most parameter values are accessible through the available interface(s) to influence the process behaviour. Many parameters may be controlled by end-users for more flexible use of the instruments. Bronkhorst High-Tech offers special software for these purposes (in combination with FLOWDDE): FlowView : Windows application for operation of max. 8 instruments FlowPlot : Windows application for adjustment of controllers (Value versus time on screen) End-users are also free to use their own software using either: FLOWDDE : DDE-server for data exchange with Microsoft Windows applications FLOWB32.DLL : Dynamic Link Library for Microsoft Windows applications RS232 interface : Protocol description for instructions with ASCII or Binary HEX telegrams Each parameter has its own properties, like data-type, size, reading/writing allowance, security. In general: all parameters used for operation of instruments are free to be used by end-users. (eg.: measure, setpoint, control mode, slope, fluid number, alarm and counter) all parameter for settings of instruments are meant for BHT-service personnel only. (eg.: calibration settings, controller settings, identification, network/fieldbus settings) Parameters for settings are secured. They can be read-out, but can not be changed without knowledge of special key-parameters and knowledge of the instrument. FLOWDDE parameter numbers: Reading/changing parameter values via FLOWDDE offers the user a different interface to the instrument. Besides the application name: ‘FLOWDDE’ there is only need of: topic, used for channel number: ‘C(X)’ item, used for parameter number: ‘P(Y)’ A DDE-parameter number is a unique number in a special FLOWDDE instruments/parameter database and not the same as the parameter number from the process on an instrument. Node-address and process number will be translated by FLOWDDE to a channel number. When not using FLOWDDE for communication with FLOW-BUS, each parameter value needs: node-address of instrument on FLOW-BUS process number on instrument parameter number on instrument All parameter information needed can be found in the parameter table(s) of FLOWDDE.MDB. page 10 9.17.023 BRONKHORST HIGH-TECH B.V. Following paragraphs will give short descriptions of how to use parameters for operation. For a more complete description of the parameters the document “917030 FLOWPLOT” can be used. The second line after the parameter name gives some additional information about the parameter. An explanation of the line is: Valve output [unsigned long, RW, secured, 0…16777215, DDEpar. = 55, Proces/par. = 114/1] unsigned long = one of the datatypes below. Unsigned char Unsigned int Unsigned long Float Unsigned char [] RW Secured 0…16777215 DDEpar. = 55 Process/par. = 114/1 = = = = = 1 byte 2 bytes, MSB first 4 bytes, MSB first 4 bytes IEEE 32-bit single precision numbers, MSB first array of characters (string) R - parameter can be read, W – parameter can be written. Parameter is secured. If omitted parameter is not secured. Parameter range. FlowDDE parameter number Process number / process parameter number Another example is: Fluidname [unsigned char[10], RW,secured,a...Z, 0...9, DDEpar. = 25, Proces/par. = 1/17] unsigned char[10] RW Secured a...Z 0...9 DDEpar. = 25 Process/par. = 1/17 page 11 = = = = = = = Datatype Unsigned char[], array of characters. [10] = number of characters. R - parameter can be read, W – parameter can be written. Parameter is secured. If omitted parameter is not secured. characters which can be used in the string numbers which can be used in the string FlowDDE parameter number Process number / process parameter number 9.17.023 BRONKHORST HIGH-TECH B.V. Normal operation parameters 2.1 Measured value (measure) [unsigned int, R ,0...41942, DDEpar. = 8, Proces/par. = 1/0] Depending on the type of instrument, measured value indicates the amount of mass flow or pressure metered by the instrument. Sensor signals at digital instruments will be digitized at the sensor bridge by means of highly accurate ADconverters, using at least 16 bits. Digitized signals will be internally processed by the microcontroller using floating point notation. The sensor signal will be differentiated, linearized and filtered. At the digital output measured values will be presented as an unsigned integer in the range of 0...65535. For Unipolair mode the signal of 0...100% will be presented in a range of 0...32000. For the instruments, maximum signal to be expected is 131.07 %, which is: 41942. 0 32000 41942 65535 Not used 0% 100% 130.07% For Bipolair mode the signal of 0...100% will be presented in a range of 0...32000. Maximum signal is 131.07 %, which is: 41942, minimum signal is -73.73 %, which is 41943 0 32000 41942 41943 0% 100% 130.07% -73.73% 65535 -0.003% 2.2 Setpoint [unsigned int, RW,0...32000, DDEpar. = 9, Proces/par. = 1/1] Setpoint is used to tell the controller of an instrument what the wanted amount of mass flow or pressure is. Signals are in the same range as the measured value, only setpoint is limited between 0 and 100 %. Setpoint can be given either via optional fieldbus or RS232 or via analog interface. Parameter control mode selects the active setpoint for the controller. See that paragraph for more detailed information. 2.3 Setpoint slope [unsigned int, RW,0...30000, DDEpar. = 10, Proces/par. = 1/2] Digital instruments can establish a smooth setpoint control using the setpoint slope time. The setpoint will be linear increased in time from old setpoint to new setpoint value. A value between 0 and 3000 seconds, with a resolution of 0.1 seconds, can be given to set the time for the integrator on the setpoint signal. Setpoint will reach its endvalue after newsp − oldsp ⋅ slope = seconds 100 Example; When slope = 10 seconds how long will it take to go from 20% to 80%? 80 − 20 ⋅ 10 = 6 seconds 100 2.4 Analog input [unsigned int, R ,0...65535, DDEpar. = 11, Proces/par. = 1/3] Depending on the parameter value of analog mode, this signal converts either 0..5Vdc / 0..10Vdc / 0..20mA / 4..20mA. Analog input signals (digitized) are in the same range as measured values (0...32000 = 0...100%). This input can be used to give setpoint or slave factor, depending on the value of control mode. page 12 9.17.023 BRONKHORST HIGH-TECH B.V. 2.5 Setpoint/control modes [unsigned char, RW,0...255, DDEpar. = 12, Proces/par. = 1/4] For switching between different functions in use of a digital meter or controller several modes are available. Output signals (sensor signal) on both analog and fieldbus interface are available at the same time. Table 1: Overview setpoint/control modes Nr Mode Instrument action 0 1 2 BUS/RS232 external input FLOW-BUS/ RS232 slave Setpoint source Controlling BUS/RS232 Controlling analog input controlling as slave Master/slave from other instrument process on bus 3 valve close close valve 4 controller idle stand-by on BUS/RS232 5 test mode testing enabled (BHT only) 6 tuning mode tuning enabled (BHT only) 7 setpoint 100% controlling on 100% 100% 8 valve purge purge valve 9 calibration mode calibration enabled (BHT only) 10 ext input slave controlling as slave Master/slave from other instrument process on analog input 12 setpoint 0% controlling on 0% 0% 13 FLOW-BUS controlling as slave Master/slave slave external from other instrument process input on bus, slavefactor is set with signal on analog input 18 RS232 Controlling RS232 note: analog input= external input= pin 3 on DB 9 connector. BUS = any available fieldbus Master source Slave factor source FLOW-BUS FLOW-BUS/ RS232 analog input FLOW-BUS/ RS232 FLOW-BUS analog input 2.5.1 Dual interface operation When operating a controller (reading measured value and sending setpoint) for proper operation it is important that the controller gets its setpoint from the right source. Setpoints may come from different sources: analog input, fieldbus interface or RS232 or may be overruled by close valve or open valve (purge) commands. Therefore it is important to know what is the setpoint source of the controller. This can be set by means of parameter controlmode (parameter 12). In some cases it is possible that the setpoints may come from 2 sources at the same time. The last send setpoint will be valid and send to the controller. This is the case in controlmode = 0, when setpoints may come through any fieldbus interface or RS232. However, there could be situations where control over the instrument seems impossible. This is the case when the instrument comes into a safe-state e.g. when fieldbus communication is disturbed or disconnected. Valve will be forced to a safe state automatically: closed (NC) or fully open (NO). In case you want to get control back via RS232 operation, you have to change the controlmode. When controlmode gets value 18, safe state will be overruled and sending setpoints via RS232 interface will have effect on the controller again. page 13 9.17.023 BRONKHORST HIGH-TECH B.V. 2.5.2 Master/slave (ratio) control In master/slave or ratio control the setpoint of an instrument is related to the output signal of another instrument. Setpoint (slave) = Output signal (master) * slave factor/100% Digital instruments offer possibilities for master/slave control via the FLOW-BUS. The output value of any instrument connected to the FLOW-BUS is automatically available to all other instruments (without extra wiring). When master/slave control is wanted the instrument can be put in control mode 2 or 13, depending on how the slave factor should be set (see table above). Through FLOW-BUS an instrument can be told that it should be a slave, who should be its master and what should be the slave factor to follow the master with. It is possible to have more masters and more slaves in one system. A slave can also be a master itself for other instruments. Notes: These options are available for FLOW-BUS or RS232 instruments only. Output signals from master can be received via FLOW-BUS only. Slave factors can also be changed via RS232. Master/slave is ment here for controlling purposes and has nothing to do with master and slave behaviour on fieldbus networks. 2.5.3 Tuning, test and calibration These are special modes to prepare the instrument for either a tuning, test or calibration action. These modes are used by Bronkhorst High-Tech service personnel only and are not meant for customer use. Putting the instrument in this mode, will disable normal control. The instrument will wait until: 1. Control mode will change again. 2. Instrument receives command (secured parameter) via bus which item should be tuned, tested or calibrated. When ready perfoming the wanted action the instrument will return to its previous control mode again. 2.6 Fluid number [unsigned char, RW,0...7, DDEpar. = 24, Proces/par. = 1/16] Fluid number is a pointer to the set of calibration parameters. For each fluid (gas or liquid) several parameters get values in order to store the calibration for a specific fluid. This increases accuracy. Fluid number is an unsigned char parameter (ucFluidnr) in a range of 0...7, where 0 = fluid1 and 7=fluid8. Up to 8 fluids can be stored in one instrument. Default value = 0 (fluid 1). 2.7 Fluid name [unsigned char[10], RW,secured,a...Z, 0...9, DDEpar. = 25, Proces/par. = 1/17] Fluid name consists of the name of the fluid of the actual selected fluidnumber. Up to 10 characters are available for storage of this name. Parameter is secured and read-only for normal users. During calibration of the instrument this parameter will get its value. Default value is “Air”. page 14 9.17.023 BRONKHORST HIGH-TECH B.V. 2.8 Valve output [unsigned long, RW,secured,0...16777215, DDEpar. = 55, Proces/par. = 114/1] This parameter is the signal coming out of the controller, going to the DAC for driving the valve. 0...16777215 corresponds with approximately 0...265mAdc for a 60 Ohm .valve coil. Maximum output voltage is approximately 14V. 2.9 Temperature [float, RW,,-250..500, DDEpar. = 142, Proces/par. = 33/7] This parameter shows the temperature of the tubes in the Cori-Flow. It is not used in other instruments. page 15 9.17.023 BRONKHORST HIGH-TECH B.V. 3 DIRECT READING PARAMETERS 3.1 Sensor type [unsigned char, RW,secured,0...4, DDEpar. = 22, Proces/par. = 1/14] Unsigned char used to select proper set of units for certain sensor, together with Counter unit. Default settings is 3. Value 0 1 2 3 4 128 129 130 131 132 Description pressure ( no counting allowed) liquid volume liquid/gas mass gas volume other sensor type (no counting allowed) pressure ( no counting allowed) liquid volume liquid/gas mass gas volume other sensor type (no counting allowed) Controller/Sensor Controller Sensor 3.2 Capacity (100%) [float, RW,secured,1E-10...1E+10, DDEpar. = 21, Proces/par. = 1/13] Capacity is the maximum value (span) at 100% for direct reading in sensor base units. The base unit will be determined by ‘sensor type’. For each fluid(number) capacity will be stored seperately. 3.3 Capacity 0% [float, RW,secured,-1E-10...1E+10, DDEpar. = 183, Proces/par. = 33/22] This is the capacity zero point (offset) for direct reading in sensor base units. The base unit will be determined by ‘sensor type’. This capacity 0% is the same for all stored fluid(number)s. 3.4 Fmeasure [float,R, 1E-10...1E+10, DDEpar. = 205, Proces/par. = 33/0] Floating point version of variable measure (see 2.1). The user will read-out the measured value in the capacity and capacity unit for which the instrument has been calibrated. These settings depend on variables: capacity, capunit, sensortype and capacity0%. Fmeasure is a read-only float on (FLOW-BUS) proc 33, par 0. Value is calculated as follows: proc33,par0 proc1,par 0 proc1,par13 proc33,par 22 proc33,par22 fmeasure = ((measure/32000)*(capacity-capacity0%)) + capacity0% The value is in units as described in parameter capunitstr (proc 1, par 31). page 16 9.17.023 BRONKHORST HIGH-TECH B.V. 3.5 Fsetpoint [float,RW, 1E-10...1E+10, DDEpar. = 206, Proces/par. = 33/3] With the use of parameter fmeasure, also fsetpoint is often needed. This parameter is R/W as variable in FLOW-BUS proc33, par3. Setpoint can be operated via 2 parameters at the same time. One parameter is setpoint (see 2.1), a short integer. The other one is fsetpoint, a float (in the capacity in which the instrument was calibrated (see also fmeasure). Last received setpoint by the instrument will be valid. It is not advised to use setpoint and fsetpoint at the same time. Choose either one or the other. Relation between setpoint and fsetpoint is calculated as follows: proc1,par1 proc33,par3 proc33,par22 proc1,par13 proc33,par22 setpoint = ((fsetpoint – capacity0% ) / (capacity - capacity0%)) * 32000 Note: Reading back actual values of fsetpoint is also possible. When a value has been send to proc1, par1 (integer setpoint), then this will be converted to the float setpoint for direct reading in the right capacity and unit. 3.6 Capunit [unsigned char, RW,secured,0...9, DDEpar. = 23, Proces/par. = 1/15] Capacity unit is a pointer to select an actual readout unit (see list below). For FLOW-BUS instruments all capacity units are available for direct reading. Other fieldbusses (eg. DeviceNet) are limited in options for direct reading facilities. Overview of capacity-unit strings in digital instruments and E-7000 for analog instruments: capunit Sensor Type 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 bar l/min kg/h ln/min usrtype °C hour kHz kg g/l mbar ml/h kg/min mln/h usrtype °F minute Hz g kg/l psi ml/min kg/s mln/min usrtype K seconds rpm mg g/m3 kPa l/h g/h ln/h unused unused unused unused ug kg/m3 cmH2O mm3/s g/min m3n/h Unused Unused Unused Unused Unused Unused cmHg cm3/min g/s mls/min unused unused unused unused unused` unused atm unused mg/h mls/h unused unused unused unused unused unused kgf/cm2 unused mg/min ls/min unused unused unused unused unused unused unused unused mg/s ls/h unused unused unused unused unused unused unused unused unused m3s/h unused unused unused unused unused unused name description sensortype Indicator for type of sensor in instrument in relation with a list of units for direct reading Points to wanted capacity unit for direct reading in list of available units capunit Example: If you want to readout your instrument in ln/min, then make sure parameter ‘sensortype’ has value 3 and parameter ‘capunit’ has value 0. By means of parameter ‘capunitstr’ the unit string can read-back as a 7 character string. 3.7 Capacity unit string [unsigned char[7], RW,secured, DDEpar. = 129, Proces/par. = 1/31] Parameter ‘capunitstr’ consisting of 7 characters (string) with selected unit out of table. Can only be written when sensortype = 4: usertype, userunit string of 7 chars can be send. page 17 9.17.023 BRONKHORST HIGH-TECH B.V. 4 IDENTIFICATION PARAMETERS 4.1 Serialnumber [unsigned char[20], RW,secured, DDEpar. = 92, Proces/par. = 113/3] This parameter consists of a maximum 20-byte string with instrument serial number for identification. Example: “M0202123A” 4.2 Modelnumber [unsigned char[14], RW,secured, DDEpar. = 91, Proces/par. = 113/2] Bronkhorst High-Tech instrument model number information string. 4.3 Firmware version [unsigned char[5], R, DDEpar. = 105, Proces/par. = 113/5] Revision number of firmware. Eg. “V6.01” 4.4 Usertag [unsigned char[13], RW,secured, DDEpar. = 115, Proces/par. = 113/6] User definable alias string. Maximum 13 characters allow the user to give the instrument his own tagname. It is advised here to limit the name up to 7 characters when using E-7000 readout and control modules. These modules can display the tagname of an instrument only up to 7 characters. Eg.: “Room1s6” 4.5 Manufacturer config [unsigned char[16], RW,secured, DDEpar. = 93, Proces/par. = 113/4] Digital instrument manufacturing configuration information string. This string can be used by Bronkhorst High-Tech to add extra information to the model number information. page 18 9.17.023 BRONKHORST HIGH-TECH B.V. 4.6 Identnumber [unsigned char, RW,secured,0...255, DDEpar. = 175, Proces/par. = 113/12] Bronkhorst High-Tech (digital) device/instrument identification number (pointer). See list below: Value Description 1 RS232/FLOW-BUS interface 2 PC(ISA) interface 3 ADDA4 (4 channels) 4 R/C-module, 32 channels 5 T/A-module 6 ADDA1: 1 channel ADDA converter module 7 DMFC: digital mass flow controller 8 DMFM: digital mass flow meter 9 DEPC: digital electronic pressure controller 10 DEPM: digital electronic pressure meter 11 ACT: single actuator 12 DLFC: digital liquid flow controller 13 DLFM: digital liquid flow meter 14 DSCM-A: digital single channel module for analog instruments 15 DSCM-D: digital single channel module for digital instr. 16 FRM: FLOW-BUS rotor meter (calibration-instrument) 17 FTM: FLOW-BUS turbine meter (calibration-instrument) 18 FPP: FLOW-BUS piston prover/tube (calibration-instrument) 19 F/A-module: special version of T/A-module 20 DSCM-E: evaporator controller module (single channel) 21 DSCM-C: digital single channel module for calibrators 22 DDCM-A: digital dual channel module for analog instruments 23 DMCM-D: digital multi channel module for digital instruments 24 PRODPS: FLOW-BUS/PROFIBUS DP-slave interface 25 FCM: FLOW-BUS Coriolis meter 26 FBI: FLOW-BUS Balance Interface 27 CoriFC: Cori-Flow Controller 28 CoriFM: Cori-Flow Meter 4.7 Device type [unsigned char[6], R, DDEpar. = 90, Proces/par. = 113/1] Devicetype information string: String value in max. 6 chars of descriptions in table above. page 19 9.17.023 BRONKHORST HIGH-TECH B.V. 5 ALARM/STATUS PARAMETERS 5.1 Alarminfo [unsigned char, R,0...255, DDEpar. = 28, Proces/par. = 1/20] This parameter contains 8 bits with status information about some (alarm) events in the instrument. Bit 0 1 2 3 4 5 6 7 Meaning 0 – no error, 1 – Error message in alarm error status register 0 – no error, 1 – Warning message in alarm warning status register 0 – no error, 1 – Minimum alarm (sensor signal < minimum limit) 0 – no error, 1 – Maximum alarm (sensor signal > maximum limit) 0 – no error, 1 – Batch counter has reached its limit 0 – no error, 1 – This bit only: Power-up alarm (probably power dip occurred) Together wit bit 2 or bit 3: Response alarm message (setpoint-measure too much difference) (bit 2 or bit 3 indicate if difference is positive or negative) 0 – no error, 1 – Master/slave alarm: master output signal not received or slave factor out of limits (> 100%) 0 – no error, 1 – Hardware alarm: check hardware 5.2 Status [unsigned char, R,,0...255] This parameter is a special byte for monitoring communication between converter and instruments (via FLOW-BUS). It contains 8 bits with information about certain (alarm) events. This parameter is unlike the other parameters not a PROPAR parameter and can not be read via FLOWBUS but only via PROFIBUS. Bit 0 1 2 3 4 5 6 7 Meaning 0 - no error in communication with channel, 1 - error in communication 0 - no PROPAR process error, 1 - a PROPAR process error has occurred 0 - no PROPAR parameter error, 1 - a PROPAR parameter error has occurred 0 - no PROPAR type error, 1 - a PROPAR type error has occurred 0 - no PROPAR value error, 1 - a PROPAR value error has occurred 0 - no error, 1 - a PROPAR process claim or command error has occurred Reserved Reserved 5.3 Alarm mode [unsigned char, RW,secured,0...3, DDEpar. = 118, Proces/par. = 97/3] Available alarm modes for device: Value Description 0 Off 1 alarm on absolute limits 2 alarm on limits related to setpoint (response alarm) 3 alarm when instrument powers-up (eg. after power-down) Note: Not all modes are available for all fieldbusses. Eg. For DeviceNet only mode 0 and 1 are available. page 20 9.17.023 BRONKHORST HIGH-TECH B.V. 5.4 Alarm maximum limit [unsigned int, RW,secured,0...32000, DDEpar. = 116, Proces/par. = 97/1] Maximum limit for sensor signal to trigger alarm situation (after delay time). Note: Minimum limit ≤ Maximum limit ≤ 100 % 5.5 Alarm minimum limit [unsigned int, RW,secured,0...32000, DDEpar. = 117, Proces/par. = 97/2] Minimum limit for sensor signal to trigger alarm situation (after delay time). Note: 0 % ≤ Minimum limit ≤ Maximum limit 5.6 Alarm output mode [unsigned char, RW,secured,0...2, DDEpar. = 119, Proces/par. = 97/4] Available alarm output modes for device: Value Description 0 no relais/TTL-output activity at alarm 1 relais/TTL-output pulses until reset 2 relais/TTL-output activated until reset 5.7 Alarm setpoint mode [unsigned char, RW,secured,0...1, DDEpar. = 120, Proces/par. = 97/5] Available alarm setpoint modes for device: Value Description 0 no setpoint change at alarm 1 new/safe setpoint at alarm enabled (set at alarm new setpoint) 5.8 Alarm new setpoint [unsigned int, RW,secured,0...32000, DDEpar. = 121, Proces/par. = 97/6] New/safe setpoint during alarm situation until reset. 5.9 Alarm delay time [unsigned char, RW,secured,0...255, DDEpar. = 182, Proces/par. = 97/7] Time in seconds alarm action will be delayed when alarm limit has been exceeded. Also time in seconds automatic reset will be delayed when sensor signal reaches safe level again. page 21 9.17.023 BRONKHORST HIGH-TECH B.V. 5.10 Reset alarm enable [unsigned char, RW,secured,0...15, DDEpar. = 69, Proces/par. = 115/4] Available alarm reset options: Value Description 0 no reset possible 1 reset: keyboard/micro-switch 2 reset: external 3 reset: keyboard/micro-switch or external 4 reset: BUS/RS232 5 reset: BUS/RS232 or keyboard/micro-switch 6 reset: BUS/RS232 or external 7 reset: BUS/RS232 or keyboard/micro-switch or external 8 reset: automatic 9 reset: automatic or keyboard/micro-switch 10 reset: automatic or external 11 reset: automatic or keyboard/micro-switch or external 12 reset: automatic or BUS/RS232 13 reset: automatic or BUS/RS232 or keyboard/micro-switch 14 reset: automatic or BUS/RS232 or external 15 reset: automatic or BUS/RS232 or keyboard/micro-switch or external 5.11 Using an alarm (examples) Using the alarms will take three steps: 1. Preparing the instrument (setting correct values for mode, limits etc.) 2. Monitoring the alarm info byte (gives info which alarm has occurred) 3. Resetting the alarm (will re-initialize the alarm and set output to normal values again) All settings needed are secured parameters. These parameters can only be changed if a key-parameter (‘init/reset’) value has been send first to get the instrument in a soft-init mode. It will stay in this mode until a new power-up situation. Using maximum and minimum alarm This alarm will check if the measured signal crosses the maximum or minimum limit set by the user. Example: Setting maximum alarm on 90 %. Setting minimum alarm on 10 %. Relay/TTL output should be on off. No new setpoint wanted at crossing alarm limit. Delay on action at output should be 10 seconds. Reset should be automatically, when signal comes into safe area again or via FLOW-BUS. Through DDE links send following parameter values: Value Parameter init/reset 64 alarm maximum limit 28800 alarm minimum limit 3200 alarm output mode 0 alarm setpoint mode 0 alarm reset enable * 12 alarm delay time 10 alarm mode 1 *) Default all reset inputs are enabled, so this command isn’t really necessary page 22 9.17.023 BRONKHORST HIGH-TECH B.V. Now the alarm will be active. Alarm status can be monitored by means of parameter alarminfo. Resetting the alarm will need the following command reset = 0 and then reset=2. To inactivate the alarm, put it in alarm mode “off”. This will also reset your outputs. This can be done sending command: alarm mode = 0. Using instrument with response alarm. This alarm will check if the measured value will come within an area limited by maximum limit and minimum limit, related to the setpoint, within a certain delay-time. Example: Setting maximum alarm limit on setpoint + 3 % . Setting minimum alarm limit on setpoint – 0.9 %. Relay/TTL output should not be used. Setpoint wanted at crossing alarm limit = 0 %. Delay on action at output should be 2 minutes. Reset via keyboard or BUS/RS232. Send following parameter values: Parameter Value init/reset 64 alarm maximum limit 960 alarm minimum limit 288 alarm output mode 0 alarm setpoint mode 1 alarm new setpoint 0 alarm reset enable * 5 alarm delay time 120 alarm mode 2 *) Default all reset inputs are enabled, so this command isn’t really necessary Now the alarm will be active. Alarm status can be monitored by means of parameter alarminfo. Resetting the alarm will need following command: reset = 2. To inactivate the alarm, put it in alarm mode “off”. This will also reset your outputs. This can be done sending command: alarm mode = 0. page 23 9.17.023 BRONKHORST HIGH-TECH B.V. 6 COUNTER PARAMETERS 6.1 Counter value [float, RW,secured,0...10000000, DDEpar. = 122, Proces/par. = 104/1] Actual counter value in units selected at Counter unit. Value is a float in IEEE 32-bits single precision notation. 6.2 Counter mode [unsigned char, RW,secured,0...2, DDEpar. = 130, Proces/par. = 104/8] Available counter modes for device: Value Description 0 Off 1 counting upwards continuously 2 counting up to limit (batchcounter) Default value = 0. 6.3 Counter setpoint mode [unsigned char, RW,secured,0...1, DDEpar. = 126, Proces/par. = 104/5] Setpoint change enable during counter limit/batch situation (until reset). Default = 0. Value Description 0 no setpoint change at batch limit allowed 1 setpoint change at batch limit allowed 6.4 Counter new setpoint [unsigned int, RW,secured,0...32000, DDEpar. = 127, Proces/par. = 104/6] New/safe setpoint at counter limit/batch situation (until reset). See measure for range. Normally this value is set to 0%. 6.5 Counter limit [float, RW,secured,0...10000000, DDEpar. = 124, Proces/par. = 104/3] Counter limit/batch. in units selected at Counter unit. Value is a float in IEEE 32-bits single precision notation. Default setting is 1000000 ln. 6.6 Counter output mode [unsigned char, RW,secured,0...2, DDEpar. = 125, Proces/par. = 104/4] Parameter to determine counter relais/TTL-output activity mode when limit/batch has been reached. Default setting is 0. Value page 24 Description 0 no relais/TTL-output activity at batch limit 1 relais/TTL-output pulses after reaching batch limit until reset 2 relais/TTL-output activated after reaching batch limit until reset 9.17.023 BRONKHORST HIGH-TECH B.V. 6.7 Counter unit [unsigned char, RW,secured,0...13, DDEpar. = 123, Proces/par. = 104/2] Parameter used to select a unit from for certain sensor type (pointer to a unit). Default setting is 0: ‘ln’ (for sensor type 3). Sensor type 0 1 2 3 4 and > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 n.a. l g ln n.a. n.a. mm3 mg mm3n n.a. n.a. ml ug mln n.a. n.a. cm3 kg cm3n n.a. n.a. ul n.a. uln n.a. n.a. m3 n.a. dm3n n.a. n.a. n.a. n.a. m3n n.a. n.a. n.a. n.a. Uls n.a. n.a. n.a. n.a. mm3s n.a. n.a. n.a. n.a. mls n.a. n.a. n.a. n.a. cm3s n.a. n.a. n.a. n.a. ls n.a. n.a. n.a. n.a. dm3s n.a. n.a. n.a. n.a. m3s n.a. 6.8 Counter unit string [unsigned char[4], R, DDEpar. = 128, Proces/par. = 104/7] Parameter ‘CntrUntstr’ consisting of 4 characters (string) with selected unit out of table. Read-only parameter. 6.9 Using a counter (example) Using the counter will take three steps: 1. Preparing the instrument (setting correct values for mode, limit etc.) 2. Monitoring the alarm info byte (gives info which alarm has occurred) 3. Resetting the counter (will re-initialize the counter and set output to normal values again) All settings needed are secured parameters. These parameters can only be changed if a key-parameter (‘init/reset’) value has been send first to get the instrument in a soft-init mode. It will stay in this mode until a new power-up situation. Using a batch counter The measured signal will be integrated in time and there will be a check on a certain limit set by the user. Example: You have an instrument with a range of 1 ln/min. Setting the batch to be reached on 1000 ln. Relay/TTL output should do nothing. New setpoint wanted at reaching the limit is 0% (valve should be closed). Reset should be enabled via BUS/RS232 or by means of keyboard/micro-switch. Through DDE links send following parameter values: Parameter Value init/reset 64 counter limit 1000.0 counter output mode 0 counter setpoint mode 1 counter new setpoint 0 counter reset enable * 5 counter mode 2 *) Default all reset inputs are enabled, so this command isn’t really necessary Now the counter will be active. Alarm/counter status can be monitored by means of parameter alarminfo. Resetting the counter will need following command: reset = 1. To inactivate the counter, put it in counter mode “off”. This will also reset your outputs. This can be done sending command: counter mode = 0. page 25 9.17.023 BRONKHORST HIGH-TECH B.V. 7 SPECIAL PARAMETERS 7.1 Reset [unsigned char, W,secured,0...5, DDEpar. = 114, Proces/par. = 115/8] Parameter to reset program, counter or alarms. Default value = 0. Value 0 1 2 3 4 5 Note: Description no reset reset counter value (no mode change) or common reset reset alarm restart batch counter reset counter value (counter off) Reset module (soft reset) To make sure the parameter is accepted send a 0 first. 7.2 Init/reset (key-parameter) [unsigned char, RW,0...255, DDEpar. = 7, Proces/par. = 0/10] Init and reset security key command for network/parameter settings. Make 64 to enable changing of secured parameters. Make 0 again to reset. Default setting is 82. Note: when an instrument powers-up this value will be reset to 82 always automatically. 7.3 Wink [unsigned char, W,0...9, DDEpar. = 1, Proces/par. = 0/0] Unsigned char in range 0...9 enables master to let the instrument connected to that channel wink for several seconds for tracing the physical location. Type of winking depends on instrument. This will be either with red and green LED turn-by-turn or with special characters on an LCD. Default setting = 0. page 26 9.17.023 BRONKHORST HIGH-TECH B.V. 8 CONTROLLER PARAMETERS 8.1 Controller The controlling algorithm for the valve handled by the micro-controller consists of several parameters which can be set via the BUS/RS232. Although many parameters could be accessed via BUS/RS232, Bronkhorst High-Tech advises not to change these parameters because during manufacturing they have got optimal values for their purposes. Controller parameters are classified as setting parameters. Changing of controller settings should be performed by or under supervision from trained service personnel only. Main parameter settings for controller adjustment are listed below: 8.2 RespOpen0 [unsigned char, RW,secured,0...255, DDEpar. = 165, Proces/par. = 114/18] Controller response when starting-up from 0% (when valve opens). Value 128 is default and means: no correction. Otherwise controller speed will be adjusted as follows: (128-RespOpen0) New response = old response * 1.05 8.3 ContrResp [unsigned char, RW, secured,0...255, DDEpar. = 72, Proces/par. = 114/5] Controller response during normal control (at setpoint step) (128-ContrResp) New response = old response * 1.05 8.4 RespStable [unsigned char, RW, secured,0...255, DDEpar. = 141, Proces/par. = 114/17] Controller response when controller is stable (within band of 2 %) (128-RespStable) New response = old response * 1.05 8.5 PIDKp [float, RW, secured,0...1E+10, DDEpar. = 167, Proces/par. = 114/21] PID controller response, proportional action, multiplication factor. 8.6 PIDTi [float, RW, secured,0...1E+10, DDEpar. = 168, Proces/par. = 114/22] PID controller response, integration action in seconds. 8.7 PIDTd [float, RW, secured,0...1E+10, DDEpar. = 169, Proces/par. = 114/23] PID controller response, differentiation action in seconds. page 27 9.17.023 BRONKHORST HIGH-TECH B.V. 8.8 TdsUp [float, RW, secured,0...1E+10, DDEpar. = 51, Proces/par. = 1/12] Sensor signal differentiation time in seconds needed to speed-up sensor signals going upwards. 8.9 TdsDn [float, RW, secured,0...1E+10, DDEpar. = 50, Proces/par. = 1/11] Sensor signal differentiation time in seconds needed to speed-up sensor signals going downwards. 8.10 ExpSmooCon [float, RW, secured,0...1, DDEpar. = 74, Proces/par. = 117/4] This factor is used for filtering the signal coming from the sensor circuitry before it is further processed. It filter according the following formula: out = in * ExpSmooCon + (1 - ExpSmooCon) * out For El-flow types of instruments it will be the “slow” (not differentiated), non-linearized sensor signal. Only in case of much noise on the sensor this value will have another value than 1.0. Advise: do not give a value much lower than 0.8, otherwise it would slow down sensor response too much. Best setting here: 1.0. For CoriFlow instruments it will influence the amount of averaging of the “bare” values. The smaller this value gets, the slower a CoriFlow instrument will get a sensor signal, but less noise will be on the signal. Response Slow Normal Fast Very fast Factor setting 0.05 0.1 0.2 0.5...1.0 (not advised) This filter is in the control loop so it affects the response time. 8.11 ExpSmooAd [float, RW, secured,0...1, DDEpar. = 222, Proces/par. = 117/5] This parameter is used in combination with the ExpSmooCon. It changes the rate of filtering for the exponential filter depending on the change of the measuring value. So it is adapting to the measuring input. If a step is seen on the measuring signal the exponential filter is decreased so a fast response is possible. If only noise is seen the exponential filter is increased to its set value to suppress noise. Possible values: 0.0 -> Exponential Smoothing filter behaves as an standard exponential smoothing filter. 1.0 -> Exponential Smoothing filter behaves as an adaptive exponential smoothing filter page 28 9.17.023 BRONKHORST HIGH-TECH B.V. 9 SPECIAL INSTRUMENT FEATURES 9.1 Zero (mass flow instruments only) The zero procedure is able to remove zero offset signals on the sensor signal automatically. This automatic procedure can be started through the BUS/RS232 or by means of the micro-switch on top of the instrument. 9.1.1 Zeroing with the Micro-switch • • • • • Set process conditions Warm-up, pressure up the system and fill the instrument according to the process conditions. Stop flow Make sure no flow is going through the instrument by closing valves near the instrument. Press and hold, Until With no flow, use the push-button switch (#) on the outside of the instrument to start the zero adjustment procedure. Press the push-button (#) and hold it, after a short time the red LED will go ON and OFF then the green LED will go ON. At that moment release the push-button (#). Zeroing The zeroing procedure will start at that moment and the green LED will blink fast. The zeroing procedure waits for a stable signal and saves the zero. If the signal is not stable zeroing will take long and the nearest point to zero is accepted. The procedure will take approx. 10 sec. So make always sure that there is going no flow through the instrument when performing the zeroing procedure. Ready When indication is showing 0% signal and the green indication LED is burning continuously again, then zero has been performed well. 9.1.2 Zeroing with digital communication The following parameters must be used for zeroing an instrument: Initreset Cntrlmode CalMode [unsigned char, RW,0...255, DDEpar. = 7, Proces/par. = 0/10] [unsigned char, RW,0...255, DDEpar. = 12, Proces/par. = 1/4] [unsigned char, RW,0...255, DDEpar. = 58, Proces/par. = 115/1] • Set process conditions Warm-up, pressure up the system and fill the instrument according to the process conditions. • Stop flow Make sure no flow is going through the instrument by closing valves near the instrument. • Send parameters Send the following values to the parameters in this sequence. Initreset 64 Cntrlmode 9 Calmode 255 Calmode 0 Calmode 9 • Zeroing The zeroing procedure will start at that moment and the green LED will blink fast. The zeroing procedure waits for a stable signal and saves the zero. If the signal is not stable zeroing will take long and the nearest point to zero is accepted. The procedure will take approx. 10 sec. So make always sure that there is going no flow through the instrument when performing the zeroing procedure. • Ready When indication is showing 0% signal and the green indication LED is burning continuously again, then zero has been performed well. Also parameter Cntrlmode goes back to zero. As last send 0 to parameter Initreset. This action will be performed already during production at Bronkhorst High-Tech, but may be repeated at wish on site (For Cori-Flow always perform a zero on site). page 29 9.17.023 BRONKHORST HIGH-TECH B.V. 9.2 Restore parameter settings All parameter value settings in the instruments are stored in non-volatile memory so each time at power-up these settings are known. However, several settings can be changed afterwards in the field by a user if needed. Sometimes it may be necessary to get back all original settings. Therefore a backup of all settings at production final-test will be stored in non-volatile memory also. Because of this it will be possible to restore these original factory settings at any moment. Of course this will only function as long as there is no memory failure. Restoring original factory settings can be achieved by means of the micro-switch on top of the instrument or through a command via BUS/RS232. See instructions for manual operation with switch and LED’s for details. page 30 9.17.023 BRONKHORST HIGH-TECH B.V. 10 MANUAL INTERFACE: micro-switch and LED’s 10.1 General The micro-switch on top of the digital instrument can be used to start a certain function at the instrument. When the switch is pressed down, both LED’s will start indicating different patterns in a loop. The switch has to be pressed down until the 2 LED’s are indicating the right pattern. Then the switch has to be released and the choice has been made. Normally (when the switch is not pressed) the green and red LED are used for mode indication on digital instruments (FLOW-BUS / PROFIBUS-DP / DeviceNet). (see table 1 and 2). When the switch is pressed-down both LED’s will be switched-off for function selection. As long as the switch will be pressed-down, there will be a change in indication by the 2 LED’s after each 4 seconds. The moment the user recognizes the indication (LED-pattern) for the function he wants, he must release the switch. Now he has triggered the wanted function. In table 3 is described what the indications are for the function to be performed at normal situation. This is when the switch will be pressed-down during normal operation of the instrument. In table 4 is described what the indications are for the functions to be performed at power-up situation of an instrument. This can be realized by pressing the switch first and while pressing, connecting the power. These actions have a more ‘initializing’ character for the instrument. In paragraph 10.2 is described how bus-address and baudrate can be set for an instrument. Using this 1 switch and 2 LED’s this way, offers the user a maximum of possibilities, even if this instrument is only operated by an analog interface. page 31 9.17.023 BRONKHORST HIGH-TECH B.V. Table 1: Green LED indication modes for digital instrument (no switch used) Green LED off on short flash Time Continuously Continuously 0.1 sec on, 2 sec off normal flash 0.2 sec on, 0.2 sec off long flash 2 sec on, 0.1 sec off slow wink 0.2 sec on, 0.2 sec off normal wink 1 sec on, 1 sec off fast wink 0.1 sec on, 0.1 sec off Note: wink = green-red-green-red turn-by-turn Indication Power-off or program not running Normal running/operation mode Special mode, see specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet Initialization mode Initialization mode Abort state or Secured params Secured params Initialization mode Secured params can be changed/ can be changed can be changed Remote install to FLOW-BUS Special function mode Instrument is busy performing any special function. E.g. auto-zero or self-test Special mode, see specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet not used not used Idle state Wink mode By a command send via FLOW-BUS the instrument can “wink” with LED’s to indicate its position in a (large) system Alarm indication: minimum alarm, limit/maximum alarm; power-up alarm or limit exceeded or batch reached. Switch-released, selected action started Table 2: Red LED indication modes for digital instrument (no switch used) Red LED off short flash Time Continuously 0.1 sec on, 2 sec off normal flash 0.2 sec on, 0.2 sec off long flash 2 sec on, 0.1 sec off on page 32 Continuously Indication No error Bus communication warning. Instrument functions o.k. See specific fieldbus for more details. FLOW-BUS PROFIBUS-DP DeviceNet Node occupied: No data-exchange Minor Re-install between master communication instrument and slave error Automatic recovery Warning message An error occurred of minor importance It would be wise to investigate the cause of this You are still able to work with your instrument See specific fieldbus for more details FLOW-BUS PROFIBUS-DP DeviceNet No details No details No bus power See specific fieldbus for more details FLOW-BUS PROFIBUS-DP Not used For special service purpose only DeviceNet Serious communication error; manual intervention needed Critical error message A serious error occured in the instrument Instrument needs service before further using 9.17.023 BRONKHORST HIGH-TECH B.V. Table 3: LED indications using micro-switch at normal running mode of an instrument Green LED off Red LED off Time 0 – 1 sec off off 1 – 4 sec off on 4 – 8 sec on off 8 – 12 sec on on 12 – 16 sec Indication Pressing a switch shortly by accident will not cause unwanted reactions of instrument. Pressing the switch 3x briefly with intervals of max. 1 sec. will force instrument to indicate its bus-address/MAC-ID and evt. baudrate. See paragraph 10.2 for more details. In case of min/max alarm or counter batch reached: Reset alarm (only if reset by keyboard has been enabled) See specific fieldbus for more details. FLOW-BUS PROFIBUS-DP DeviceNet When address is Not used Not used occupied: Autom. installation on FLOW-BUS. Reset instrument Instrument program will be restarted and all warning and error message will be cleared During (new) start-up intrument will perform a (new) self-test Auto-zero Instrument will be re-adjusted for measurement of zero-flow (not for pressure meter/controller) NOTE: First make sure there is no flow and instrument is connected to power for at least 30 minutes ! Prepare instrument for FLASH mode At next power-up FLASH mode will be active This mode will be indicated by both LEDs off when instrument is normally powered Note: short flash = 0.1 sec on, 2 sec off Table 4: LED indications using micro-switch at power-up situation of an instrument Green LED off Red LED off Time 0 – 4 sec off normal flash 4 – 8 sec normal flash off 8 – 12 sec normal flash normal flash 12 – 16 sec Indication No action Pressing a switch shortly by accident will not cause unwanted reactions of the instrument Restore parameters All parameter settings (except fieldbus settings) will be restored to situation of final test at BHT production See specific fieldbus for more details. FLOW-BUS PROFIBUS-DP DeviceNet Auto install to bus Not used Not used Instrument will install itself to a (new) free nodeaddress on the FLOW-BUS Remote/manual install. Instrument will get a default address. This can be changed by means of micro-switch and LEDs. See description below for description of this procedure. See specific fieldbus for default installation address: FLOW-BUS PROFIBUS-DP DeviceNet Node-address = 0 Station address = 126 MAC-ID = 63 Note: normal flash = 0.2 sec on, 0.2 sec off page 33 9.17.023 BRONKHORST HIGH-TECH B.V. 10.2 Readout/change bus-address/MAC-ID and baudrate 10.2.1 Set instrument to default installation address/MAC-ID: First instrument needs to be forced into “remote/manual install mode”. The switch needs to be pressed-down during power-up and released when both LEDs indicate normal flash (pattern: 0.2 sec. on, 0.2 sec. off). See also table 4 for more details. When the switch is released, instrument will get the default installation address. This will be different for each fieldbus system. Instrument may be switched-off now or will return into “normal running/operation mode” automatically after 60 sec.. Baudrate setting will not be changed by this action. 10.2.2 Readout bus-address/MAC-ID and baudrate: Pressing the switch 3x briefly with intervals of max. 1 second in normal running/operation mode will trigger the instrument to “show” its bus-address/MAC-ID and baudrate. For indication the bus-address/MAC-ID the green LED will flash the amount of tens and the red LED the amount of units in the number. For indication of baudrate setting, both LEDs will flash. The flashes are called “count-flashes” and have a pattern of 0.5 sec. on, 0.5 sec. off. Table 5: LED indications for bus-address/MAC-ID and baudrate Green LED Red LED Time Indication amount of count flashes Off 0 ... 12 sec. tens in bus-address/MAC-ID for instrument (0...12) Maximum off Amount of count flashes 0 ... 9 sec. units in bus-address/MAC-ID for instrument (0...9) Maximum amount of count flashes amount of count flashes 0 ... 10 sec. baudrate setting for instrument Maximum (0...10) (0...10) Note: Value zero will be indicated by a period of 1 sec. off (0.5 sec. off + 0.5 sec. off). E.g.: - for bus-address/MAC-ID 35 the green LED will flash 3 times and the red LED will flash 5 times. - for bus-address/MAC-ID 20 the green LED will flash 2 times and the red LED will flash 0 times. - for bus-address/MAC-ID 3 the green LED will flash 0 times and the red LED will flash 3 times. - for bus-address 126 the the green LED will flash 12 times and the red LED will flash 6 times. Table 6: Baudrate settings for different fieldbus systems: FLOW-BUS PROFIBUS-DP DeviceNet 0 = 187500 Baud 0 = not detected 1 = 125000 Baud (only 1 fixed baudrate) 1 = 9600 Baud 2 = 250000 Baud 2 = 19200 Baud 3 = 500000 Baud 3 = 45450 Baud 4 = 93750 Baud 5 = 187500 Baud 6 = 500000 Baud 7 = 1500000 Baud 8 = 3000000 Baud 9 = 6000000 Baud 10 = 12000000 Baud E.g.: - for PROFIBUS-DP baudrate readout of 12000000 Baud, both LEDs will flash 10 times. - for DeviceNet baudrate readout of 250000 Baud, both LEDs will flash 2 times. page 34 9.17.023 BRONKHORST HIGH-TECH B.V. 10.2.3 Change bus-address/MAC-ID and baudrate: First instrument needs to be forced into “remote/manual install mode”. Within the time-out period of 60 sec. it is possible to start changing the bus-address/MAC-ID of the instrument. For certain fieldbus systems it is necessary to select the baudrate also. Other fieldbus systems only have one baudrate or the baudrate setting will adapt to the setting of the master automatically. In these cases baudrate selection is not needed and will be skipped. Table 7: Procedure for changing bus-address/MAC-ID and baudrate step action Indication time handling Press switch during power-up and release when 1 Force instrument into both LEDs flashing 12-16 sec “remote/manual after both LEDs indicate normal flash. normal install mode” 0.2 sec on, 0.2 sec power-up Set tens of bus2 Green LED flashes time-out: Press switch and count green flashes for tens of address/MAC-ID 0.1 sec on, 60 sec bus-address/MAC-ID. 0.1 sec off Release when wanted amount has been count. 3 4 Set units of busaddress/MAC-ID count-flashes start when switch is pressed: 0.5 sec on, 0.5 sec off red LED flashes 0.1 sec on, 0.1 sec off Counts up to max. 12 and than starts at 0 again. When counting fails, keep switch pressed and restart counting for next attempt. time-out: 60 sec Press switch and count red flashes for units of bus-address/MAC-ID. Release when wanted amount has been count. count-flashes start when switch is pressed: 0.5 sec on, 0.5 sec off Set baudrate of both red and green time-out: fieldbus communication. LED flashes 60 sec 0.1 sec on, Only for specific 0.1 sec off types of fieldbusses: e.g. DeviceNet. This part will be skipped count-flashes if no baudrate needs to start when switch be selected. is pressed: 0.5 sec on, 0.5 sec off Counts up to max. 9 and than starts at 0 again. When counting failed, keep switch pressed and restart counting for next attempt. Press switch and count red and green flashes for baudrate setting of the specific fieldbus. Release when wanted amount has been count. Counts up to max. 10 and than starts at 0 again. When counting failed, keep switch pressed and restart counting for next attempt. Note: selection of 0 means: No change Instrument returns to normal running/operation mode. Changes are valid when they are made within the time-out times. Actual setting can be checked by pressing the switch 3x briefly with intervals of max. 1 sec. for readout the bus-address/MAC-ID and baudrate (see paragraph 10.2.2 for more details). Note 1: Value zero will be indicated by a period of 1 sec. off (0.5 sec. off + 0.5 sec. off). When value zero is wanted, press switch shortly and release it again within 1 sec. Note 2: Before each action of flash-counting, the LED(s) to be used for counting will flash in a high frequency. (Pattern: 0.1 sec on, 0.1 sec off). As soon as the switch is pressed-down, this LED (or both LEDs) will be off and the counting sequence will start. page 35 9.17.023 BRONKHORST HIGH-TECH B.V. 11 JUMPER SETTINGS MULTIBUS INSTRUMENTS Flatconductor cable Multibus instruments consist of 4 jumpers or a DIPswitch on the pc-board. In normal operation it is not necessary to change the jumpersetting (see table 8) If it is inevitable, the jumpers can only be reached when the uppercase of the housing is opened. Opening the uppercase should be done with great care, because the connection of the fieldbus and main p.c.board is accomplished by a small flatconductor cable. main PC board fieldbus interface Each jumper or switch can be used to make a certain setting by placing a link between a set of pins or by switching one of the DIPswitches as shown below: with jumpers with DIPswitch 4 off CORI-FLOW MBC-II 3 2 1 L30 digital J5 on S4 S3 S2 S1 J1 J2 J3 (J4) Table 8: Jumper settings digital pc-board Switch Jumper When placed (on) When not placed (off) S2 J1 Default settings from Settings loaded from non-volatile memory at EPROM loaded at power-up power-up S3 J2 Analog input used as Digital (bus) input used standard setpoint for as standard setpoint for controller at power-up controller at powerup S4 S1 page 36 J3 J4 J5 reserved reserved Normal RS232 communication Instrument in FLASH mode RS232 used for download of new firmware J5 J3 J2 J1 J1 J2 J3 J5 Remarks Normally not placed Setting depends on how instrument was ordered. Setting can be changed during normal operation using parameter ControlMode so take-over of setpoint control by RS232 or fieldbus is possible. At next power-up however, controller will read jumper first for actual setpoint source. Not always present FLASH mode can also be selected using the micro-switch on top of the instrument (see chapter 10, table 3). 9.17.023 BRONKHORST HIGH-TECH B.V. 12 TESTING AND DIAGNOSTICS All digital instruments have facilities to run self-test procedures for diagnostics. Most of the instrument functions will be tested automatically during start-up or normal running mode of the instrument. All results of testing or malfunctioning will be stored in special diagnostics registers in the non-volatile memory of the instrument. These registers will contain actual information about the functioning of the instrument. The red LED on top of the instrument is used to indicate if there is something wrong. The longer the LED is burning (blinking) red, the more is wrong with the instrument. See chapter 10 for more details about the LEDs and other documents for more specific troubleshooting. page 37 9.17.023