DECUServe VMS Conference 3064.1

     
Next-Reply Prev-Reply    Next-Topic Prev-Topic    ConfDir-Paged-New>Old ConfDir-Paged-Old>New   ConfDir-All-New>Old ConfDir-All-Old>New
       
Directory of conferences This topic directory


Note 3064.1            X10 / X-10 / BSR / Home Automation                1 of 15

EISNER::COVERT "John.Covert@Compaq.com"              98 lines  21-DEC-1999 10:55

                              -< firecracker.bli >-

--------------------------------------------------------------------------------

module firecracker (main = start, addressing_mode(external=general))=

begin



require 'sys$library:starlet';



macro 

    dsc_0 (buffer) = $BBLOCK[8] INITIAL (LONG(0), LONG(BUFFER)) %;



external routine

	lib$get_foreign;



routine qiow ( chan, pvar) =

! Chan by value

! Pvar by value (qio uses address of stack element)

begin

local

    status,

    iosb:    VECTOR[4,word];

    status = $qiow (

		      chan   = .chan,

		      func   = io$_setmode or io$m_set_modem or io$m_maint,

		      iosb   = iosb,

		      p1     = pvar);

    if not .status then SIGNAL_STOP(.status);

    if not .iosb[0] then signal_stop (.iosb[0]);

    ss$_normal

end;



routine wait =

begin

local

    tvar: quad initial(-6000);

    $setimr(efn = 0, daytim = tvar);

    $waitfr(efn = 0)

end;



routine start =

begin



LOCAL

    status,

    chan: initial(0),

    buffer:  $BBLOCK[128],

    bufdesc:  dsc_0(buffer),

    i: initial(0),

    p: initial(buffer),

    pvar: initial(0);



!   Get foreign data



    bufdesc[dsc$w_length] = %allocation(buffer);

    status = lib$get_foreign(bufdesc,0,bufdesc[dsc$w_length]);



    if not .status then SIGNAL_STOP(.status);



    status = $assign(devnam=%ascid'TERM_DEV',chan=chan);

    if not .status then SIGNAL_STOP(.status);



    pvar<16,8,0> = tt$m_ds_rts or tt$m_ds_dtr;	! Turn on RTS and DTR

    pvar<24,8,0> = 0;

    qiow (.chan, .pvar);

    wait(); wait(); wait(); wait();		! Wait long time



!   Look at each character; is it one or zero?



    while (.i lss .bufdesc[dsc$w_length]) do

	begin

	if .(.p)<0,8,0> eql %C'1'

	then

	    begin

	    pvar<24,8,0> = tt$m_ds_dtr;	! Turn off DTR

	    pvar<16,8,0> = tt$m_ds_rts;	! Turn on RTS

	    end

	else

	    begin

	    if .(.p)<0,8,0> eql %C'0'

	    then

		begin

		pvar<24,8,0> = tt$m_ds_rts;	! Turn off RTS

		pvar<16,8,0> = tt$m_ds_dtr;	! Turn on DTR

		end

	    end;

	! if we don't find a zero or one, pvar is set to turn both on

        qiow (.chan, .pvar);

	wait();

	pvar<16,8,0> = tt$m_ds_rts or tt$m_ds_dtr;	! Turn on RTS and DTR

	pvar<24,8,0> = 0;

        qiow (.chan, .pvar);

	wait();

    i = .i + 1;

    p = .p + 1;

    end;



ss$_normal

end;



end

eludom


     
Next-Reply Prev-Reply    Next-Topic Prev-Topic    ConfDir-Paged-New>Old ConfDir-Paged-Old>New   ConfDir-All-New>Old ConfDir-All-Old>New
       
Directory of conferences This topic directory

DECUServe on-line conferencing system - consulting for peanuts

DECnotes Script provided by Roland Kessi, 21 February 1996