View previous topic :: View next topic |
Author |
Message |
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
Timer 0 and 1/or ack |
Posted: Sun Oct 24, 2010 7:01 am |
|
|
Hi Guys, I need to run the following code 8mil times.
Code: |
output_low(read_clk);
output_high(read_clk);
data = PORTD;
printf("%u \n\r", data);
|
This is to read data back from a 8MB sram memory connected to a fpga with buffered image data to a pc through putty or something similar. Data will be available on the rising edge of the read clk.
Do I use a timer or generate a ack from the fpga when the 8mil mark is reached. Also is the little snippet implementable ? Or is there a better way of doing this ?
Thx in advance _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Sun Oct 24, 2010 11:31 am |
|
|
I guess I don't understand the question. What is wrong with counting to 8M times through the loop? A simple int32 will do the job. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
jacqueskleynhans
Joined: 10 Apr 2008 Posts: 109 Location: Cape Town, South Africa
|
|
Posted: Sun Oct 24, 2010 12:07 pm |
|
|
the problem is not the int32 but the time it will take to make a signal high then low read a byte from portd then transmit it to the computer, then increment the counter. _________________ "THE ONLY EASY DAY WAS YESTERDAY" |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Sun Oct 24, 2010 2:58 pm |
|
|
In the code you show, by far the longest part will be the printf(). If your data is 1 byte, the \n\r will add two more bytes, tripling the time it takes to send the data. Even at the highest baud rates this will be the bottleneck. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|