source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LAMSPAN.m@ 1751

Last change on this file since 1751 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.2 KB
Line 
1LAMSPAN ;SLC/DLG - MICROSCAN PROTOCALL ROUTINE W/ ACK-NAK ;7/20/90 09:50 ;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
3A L ^LA(T) I '$D(^LA(T,"P")) S ^("P")="MICROSCAN^IN"
4 S MODE=$P(^LA(T,"P"),"^",2),CTRL=$S($F(IN,"~")=$L(IN):$P(IN,"~",2),1:" ") D @MODE L Q
5 ;
6IN ;C= <STX>+<LF>+<CR> or there replaced values.
7 Q:"BU"[CTRL G I2:"C"[CTRL I CTRL["E" S OUT=$C(6) Q
8 G:CTRL["D" SETOUT
9 S C=2+13+13 F I=1:1:$L(IN) S C=C+$A(IN,I)
10 S ^LA(T,"P1")=C#256 Q
11I2 S C=$A(IN,1)-64*16+$A(IN,2)-64,CHK=$S($D(^LA(T,"P1")):^("P1"),1:-1),OUT=$S(C=CHK:$C(6),1:$C(21))
12 I C'=CHK S CNT=^LA(T,"I")-2,^("I")=$S(CNT'<0:CNT,1:0)
13 Q
14OUT I CTRL'="F" S CNT=^LA(T,"O",0)-2,^(0)=$S(CNT'<0:CNT,1:0) ;drop into next line
15 Q:'$D(^LA(T,"O",0)) S CNT=^LA(T,"O",0)+1 I '$D(^LA(T,"O",CNT)) K ^LA(T) Q ;Clean up and leave
16 S ^(0)=CNT,OUT=^LA(T,"O",CNT)
17 L ^LA("Q") S Q=^LA("Q")+1,^LA("Q")=Q,^("Q",Q)=T
18 Q
19SETOUT ;Change to output
20 Q:'$D(^LA(T,"O",0)) Q:^LA(T,"O")'>^LA(T,"O",0)
21 S $P(^LA(T,"P"),"^",2)="OUT" L ^LA("Q") S Q=^LA("Q"),^LA("Q",Q+1)=T,^(Q+2)=T,^LA("Q")=Q+2
22 Q
23 ;The MicroScan needs to have the field delimiter set to | (124)
24 ;LF is set to @ (64). Set " to 0.
25 ;Timeout set to a min of 20, Protocall set to ACK/NAK.
26 ;STX = ~B, ETX = ~C, EOT = ~D, ENQ = ~E, ACK = ~F, NAK = ~U
Note: See TracBrowser for help on using the repository browser.