Hi all,
is it possible to create a clock based pulse train of specific length?
lets say we r using clock block, link it to out pin so we have clock signal going out,
but how to send only 10 clock pulses out?
thanks
clock based pulse train
-
- Active Member
- Posts: 51
- Joined: Tue Oct 11, 2011 4:48 pm
-
- Active Member
- Posts: 52
- Joined: Mon Oct 31, 2011 4:08 pm
Need to use buffered clocked port:
Code: Select all
#include <platform.h>
clock ClkBlk = XS1_CLKBLK_1;
out buffered port:32 Clk = XS1_PORT_1M;
#define CLK_PATTERN 0x55555555
int main()
{
// configure ports and clock blocks
configure_clock_ref(ClkBlk, 64); // set clock block frequency
configure_out_port(Clk, ClkBlk, 0); // set source clock for port and initial value
start_clock(ClkBlk); // start the clock block
partout(Clk, 2*10, CLK_PATTERN); // load 10 clocks
sync(Clk); // wait end of clock burst
return 0;
}
-
- Active Member
- Posts: 51
- Joined: Tue Oct 11, 2011 4:48 pm
Lele,
thanks for code -unfortunatly the idea was not to be limited by bufferd port size - in your sample code
train will be less or equal to the 32 pulses. I want ot create 400 pulses block for instance.
best
thanks for code -unfortunatly the idea was not to be limited by bufferd port size - in your sample code
train will be less or equal to the 32 pulses. I want ot create 400 pulses block for instance.
best
-
- Respected Member
- Posts: 363
- Joined: Thu Dec 10, 2009 10:17 pm
Well one way you can try going at it is to calculate how long its going to take the clock block to make that many pulses and enable it for only that amount of time.
So you could get a timestamp from a timer the next line after enabling the timer and wait for the time to pass and disable it right after. It might be problematic if your clocks are very fast tho.
So you could get a timestamp from a timer the next line after enabling the timer and wait for the time to pass and disable it right after. It might be problematic if your clocks are very fast tho.
-
- Active Member
- Posts: 51
- Joined: Tue Oct 11, 2011 4:48 pm
hi berni,
I found too that this is the way to go - i just put stamp after clock start and at some point clock stop. with some adjustment his is wokring very good.
thanks
I found too that this is the way to go - i just put stamp after clock start and at some point clock stop. with some adjustment his is wokring very good.
thanks