7.6. Program example
/************************************************************************************/
/*
*/
/*
EHQ.CPP
*/
/*
*/
/*
EXAMPLE PROGRAM FOR ISEG EHQ HV BOARDS, WRITTEN BY JENS RÖMER, 27.2.97
*/
/*
*/
/*
THIS CODE WAS COMPILED UNDER BC, PLEASE CONTACT ISEG FOR THE SOURCE FILE
*/
/*
*/
/*************************************************************************************/
#INCLUDE <DOS.H>
#INCLUDE <STDIO.H>
#INCLUDE <CONIO.H>
#INCLUDE <STDLIB.H>
#INCLUDE "INT14.H"
// COM2 HANDLING
CONST
ETX= 0X03;
CONST
F = 0X0A;
CONST
CR = 0X0D;
UNSIGNED
CHAR READU[]={'U','1',CR,LF,ETX};
//READ VOLTAGE
UNSIGNED
CHAR SENDU[]={'D','1','=','1','0',CR,LF,ETX};
//SET VOLTAGE TO 10V
UNSIGNED
CHAR *PTR;
UNSIGNED
CHAR RBY;
INT
I, CNT;
BOOLEAN OK;
VOID MAIN(VOID)
{
CLRSCR();
COM2_INIT();
COM2_SET(9600);
// COM2:
9600 BAUD, 8 DATABITS, NO PARITY, 1 STOPBIT
OK=TRUE_;
PTR=READU;
FOR (;;)
{
IF (*PTR==ETX) BREAK;
COM2_SEND(*PTR);
//SEND ONE BYTE
RBY=COM2_READ();
//READ ONE BYTE
IF (RBY!=*(PTR++)) OK=FALSE_;
//COMPARE SENT WITH READ DATA
ELSE SWITCH (RBY)
{
CASE LF : PRINTF("%C",LF); BREAK;
CASE CR : PRINTF("%C",CR); BREAK;
DEFAULT : PRINTF("%C",RBY); BREAK;
}
IF (OK==FALSE_)
{
PRINTF("NO COINCIDENT READ DATA FOUND!");
EXIT(1);
}
}
CNT=8;
DO
{
RBY=COM2_READ();
//READ VOLTAGE DATA
SWITCH (RBY)
{
CASE LF : PRINTF("%C",LF); BREAK;
CASE CR : PRINTF("%C",CR); BREAK;
DEFAULT : PRINTF("%C",RBY); BREAK;
}
CNT--;
} WHILE (CNT>=1);
}
EHQ High Voltage Power Supply series | Last changed on: 11.05.2020 |
www.iseg-hv.com
26/46