/////////////////////////////////////////////////////////////////////////// //// Library for a 74595 Expanded Output Chip //// //// //// //// Any number of these chips may be connected in serise to get //// //// 8 additional outputs per chip. The cost is 3 I/O pins for //// //// any number of chips. //// //// //// //// write_expanded_outputs(eo); Writes the array eo to the chips //// //// //// /////////////////////////////////////////////////////////////////////////// //// (C) Copyright 1996,2003 Custom Computer Services //// //// This source code may only be used by licensed users of the CCS C //// //// compiler. This source code may only be distributed to other //// //// licensed users of the CCS C compiler. No other use, reproduction //// //// or distribution is permitted without written permission. //// //// Derivative programs created using this software in object code //// //// form are not restricted in any way. //// /////////////////////////////////////////////////////////////////////////// #ifndef EXP_OUT_ENABLE1 #define EXP_OUT_ENABLE1 PIN_E2 #define EXP_OUT_CLOCK1 PIN_E1 #define EXP_OUT_DO1 PIN_E0 #define NUMBER_OF_74595x 1 #endif void write_expanded_outputs1(BYTE* eox) { BYTE ix; output_low(EXP_OUT_CLOCK1); output_low(EXP_OUT_ENABLE1); for(ix=1;ix<=NUMBER_OF_74595x*8;++ix) { // Clock out bits from the eo array if((*(eox+(NUMBER_OF_74595x-1))&0x80)==0) output_low(EXP_OUT_DO1); else output_high(EXP_OUT_DO1); shift_left(eox,NUMBER_OF_74595x,0); output_high(EXP_OUT_CLOCK1); output_low(EXP_OUT_CLOCK1); } output_high(EXP_OUT_ENABLE1); output_low(EXP_OUT_ENABLE1); }