I am outputting data to a HL1606 string. It has an SPI like interface.
So it has a clock wchih is signaling the data put out.
I managed to set up a clocked port as specified in Programming in XC manual.
But I do not trust the clock - or to be more specific I do not trust my code to output the data fast enugh. So I want to ensure that I have a clock port which is clocking only when there is data to clock on the port - so putting something like 16 bits on the port and driving the clock just for 16 cycles.
I found a completely different question here http://www.xcore.com/forum/viewtopic.php?p=6067#p6067
Code: Select all
clock clk2Mhz = XS1_CLKBLK_1;
buffered out port:32 CLCK;
...
configure_clock_rate(clk2Mhz,50,25);
configure_out_port ( CLCK , clk2Mhz, 0 );
start_clock(clk2Mhz);
// Output clock edges
CLCK <: 0x55555555;
...
output 32 data values here
...
// Output next clock edges
CLCK <: 0x55555555;
...
Is this part of the solution I need?
Can I use the CLCK output port as clock source for the data output port like this:
Code: Select all
configure_clock_src(clkData, CLCK);
Code: Select all
configure_out_port(data_port, clkData, 0);
I just want to output the clock signal only if there is data on the port. Or just stop the clock after I have output some data until new data is available. Just found no easy answer in the documentation
Thanks
Marcus