[613] | 1 | LAMSPAN ;SLC/DLG - MICROSCAN PROTOCALL ROUTINE W/ ACK-NAK ;7/20/90 09:50 ;
|
---|
| 2 | ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
|
---|
| 3 | A 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 | ;
|
---|
| 6 | IN ;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
|
---|
| 11 | I2 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
|
---|
| 14 | OUT 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
|
---|
| 19 | SETOUT ;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
|
---|