//---------------------------------------------------------------------- //---------------------------------------------------------------------- //S215 XCSB Standard Functions, version 7, group A S215 08 1102 //Basic I/O Functions //---------------------------------------------------------------------- //---------------------------------------------------------------------- proc ubyte GetInBts() if g_mode == 0 then gx = PORTA else gx = PORTB endif if g_polarity == 0 then return gx endif if g_polarity == 1 then return gx ^ 0xff //Invert bits because of negative input logic endif endproc //---------------------------------------------------------------------- proc ubyte SelBit(ubyte ibyt, ubyte bitno) gx = 1 << bitno //Prepare mask gy = ibyt & gx //Mask off all except for desired bit gy = gy >> bitno //Shift bit into bit 0 return gy endproc //---------------------------------------------------------------------- proc Outall(ubyte outbyte) g_obyt = outbyte if g_polarity == 0 then gx = outbyte else gx = outbyte ^ 0xff endif if g_mode == 0 then PORTB = gx else PORTA = gx endif endproc //---------------------------------------------------------------------- proc Outallopp(ubyte outbyte) //Same as Outall( ), except output port is opposite of what "g_mode" indicates g_opobyt = outbyte if g_polarity == 0 then gx = outbyte else gx = outbyte ^ 0xff endif if g_mode == 0 then PORTA = gx else PORTB = gx endif endproc //---------------------------------------------------------------------- proc Ob(ubyte bitvalue, ubyte bitno, ubyte f_print) gx = 1 gx = gx << bitno gy = bitvalue<