omr카드를 SR-505리더기로 읽을땐 아무런 이상이 없었는데,
SR-305s리더기로 읽으면 data를 읽어오지 못함...
리딩 부분 소스:
//==========================================================
function TfrmOmrRead.OMRFeed( str: string ): string;
begin
MSComm1.Output := str;
while(TRUE) do begin
Application.ProcessMessages; //카드 읽음
if MSComm1.InBufferCount <> 0 Then begin
Result := MSComm1.Input; //이부분 읽어오지
못함 -> 305s 기종에서만????
break;
end;
end;
end;
function TfrmOmrRead.OMRReadBuff( strMarkCnt: string; strList: TStringList ): integer;
var cTmp, cStr: string;
nIndex:integer;
begin
MSComm1.Output := #16 + 'E001' + strMarkCnt + #13;
cStr := '';
nIndex := -1;
while(TRUE) do begin
Application.ProcessMessages;
cTmp := MSComm1.Input;
if cTmp = '' then begin // #13 then begin
Inc(nIndex);
strList.Add( cStr );
cStr := '';
end
else begin
AppendStr(cStr, cTmp);
end;
if nIndex >= 58 then break;
end;
result := nIndex;
end;
procedure TfrmOmrRead.btnSaveClick(Sender: TObject);
begin
RUNOMR;
end;
procedure TfrmOmrRead.RunOmr;
var
nItems, n: integer;
cResult : string;
begin
strList := TStringList.Create;
if MSComm1.PortOpen=True Then MSComm1.PortOpen := False;
MSComm1.Settings := '9600,N,7,2';
MSComm1.InputLen := 1;
MSComm1.PortOpen := True;
cResult := OMRFeed( '?' + #13);
while (cResult = '0') do begin
nItems := OMRReadBuff( '025', strList );
for n := 0 to nItems do begin
OmrDataCheck(strList.Strings[n], n);
end;
OmrDabCheck;
strList.Clear;
cResult := OMRFeed( '?' + #13);
end;
if StrToInt(cResult)<>0 then begin
Case StrToInt(cResult) of
1: Showmessage('Command Error...!');
2: Showmessage('Omr Card가 걸렸습니다....!');
3: Showmessage('수신된 Data에이상이 잇습니다...!');
4: Showmessage('타이밍 마크를 정상적으로 읽을수가 없습니다..!"');
5: Showmessage('Card가 없습니다...!');
else
Showmessage('원인을 알수없는 Error 입니다...!');
end;
end;
MSComm1.PortOpen := False;
strList.Free;
end;
//================================================================
유 경험에 고수님들 부탁합니다.