// Procedures to operate a Maxim 7219 LED driver.
//
// 7219			PIC
//
// DATA (pin 1)		B1
// CLOCK (pin 13)	B2	
// LOAD (pin 12)	B3


clock7219() // clock (CLK) pulse 
{

	output_low( PIN_B2 );
	delay_us( 1 );
	output_high( PIN_B2 );

}


load7219()  // load (LOAD) pulse
{

	output_low( PIN_B3 );
	delay_us( 1 );
	output_high( PIN_B3 );

}


send7219(long data) // pass 16 bit data word to the 7219
{

	int count;
	for (count=0; count<16; ++count) 
	{
		output_bit(PIN_B1, shift_left(&data,2,0)); // set data (DIN) level
		clock7219(); // clock data in
	}
	load7219(); // latch the last 16 bits clocked

}
