VacNitro is a statecode program that runs on c1vac1. The program continuously reads the nitrogen pressure over a serial line from an OMEGA DPiS32 dac. The main loop of the program is:
ss VacNitro {
state init {
when(1) {
%% fd=open("/tyCo/1", O_CREAT | O_RDWR, 0666);
%% if(fd==ERROR)
%% printf("Error: Cannot open device /tyCo/1\n");
%% resetChannel(1);
%% initChannel(1);
%% ioctl(fd,FIOFLUSH,0);
%% taskDelay(100);
} state cycle
state cycle {
when(delay(1)) {
%% fdprintf(fd,"*X01\r\n");
%% taskDelay(15);
%% buf=serialRead(fd);
%% N2pres=serialConvert(buf);
%% if(N2pres > 0.0)
pvPut(N2pres);
} state cycle
}
}The "*X01" is the OMEGA "i-Series" command to send the current data value in decimal.
In the initChannel portion of the program, it is evident that the expected serial parameters are 9600 baud, 7 data bits, odd parity, 1 stop bit.
