Intermec Janus 2010 Reference Manual page 138

Intermec janus 2010: reference guide
Hide thumbs Also See for Janus 2010:
Table of Contents

Advertisement

im_receive_byte
Example
With System, DosCall, Text_IO, Intrmecd_IO, Intrmecp_IO;
Use System, DosCall, Text_IO, Intrmecd_IO, Intrmecp_IO;
procedure recbyte Is
status
: System.Word;
RX_byte
: Character := ' ';
eom_char
: Character;
setup_comm_status : Integer;
function setup_com (port : System.Word) return Integer Is
-- This function sets up the communications port for RS232,
-- 9600 baud, even parity, 7-bit words, and 1 stop bit using
-- a DosCall procedure.
RS232
: Constant Integer := 16#14#;
B9600
: Constant System.Word := 16#E0#;
EVEN
: Constant System.Word := 16#18#;
WORD7
: Constant System.Word := 16#02#;
STOP1
: Constant System.Word := 16#00#;
Regs
: DosCall.Simple_Regs;
setup : System.Word;
begin
setup := 0;
if ((port /= 0) and (port /= 1)) then
return -1;
end if;
setup := B9600 + WORD7 + EVEN + STOP1;
Regs.AX := setup;
Regs.DX := port;
DosCall.Simple_Int_Call (RS232, Regs);
return 0;
end setup_com;
--************************* main program starts here *****************
begin
-- Phimec protocol handler must NOT be installed to run this routine
-- get the comm environment ready
setup_comm_status := setup_com(0);
if setup_comm_status = 0 then
eom_char := Ascii.CR;
Put_Line("Enter characters at");
Put_Line("terminal");
Put_Line("<CR> to end");
RX_byte := Ascii.NUL;
loop
-- Receive and display bytes until <CR> is sent
im_receive_byte (IM_COM1, RX_byte, status);
exit when RX_byte = eom_char;
if (im_issuccess(status)) then
if RX_byte in ' '..'~' then
Put(RX_byte);
else
Put_Line("Unprintable char");
end if;
3-98
-- Good return

Advertisement

Table of Contents
loading

This manual is also suitable for:

Janus 2050Janus 2020Janus psk for ada

Table of Contents