CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Timer 0 and 1/or ack

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jacqueskleynhans



Joined: 10 Apr 2008
Posts: 109
Location: Cape Town, South Africa

View user's profile Send private message

Timer 0 and 1/or ack
PostPosted: Sun Oct 24, 2010 7:01 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Oct 24, 2010 11:31 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Oct 24, 2010 12:07 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Oct 24, 2010 12:13 pm     Reply with quote

You didn't give your PIC. But consider using a PIC such as the 18F4550
that has a Streaming Parallel Port.
http://www.ccsinfo.com/forum/viewtopic.php?t=34952

Read the section in the 18F4550 data sheet on it.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sun Oct 24, 2010 2:58 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group