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 support@ccsinfo.com

800KHz routine with PIC18F4550. Possible?

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



Joined: 17 Jan 2006
Posts: 66

View user's profile Send private message

800KHz routine with PIC18F4550. Possible?
PostPosted: Thu Apr 16, 2009 5:08 am     Reply with quote

Good morning,
I have been asked to evaluate whether it's possible or not to program a PIC according to the following requirements:

- Every 1,25us a timer or similar I should be polling must trigger.
- Once it has triggered I must do the following before the next iteration (1,25us later) comes:
1) Set a PIN to high level
2) Read a byte from an external memory
3) Increment the pointer to the external memory to the next address
4) Write one of the byte's nibble (4 bits) to a port
5) Increment another counter to generate a 28us pulse every 77us
6) Check the counter to toggle a pin to generate the 28us pulse
7) Increment another counter to generate 77us pulse every 12550us
8) Check the counter to toggle a pin to generate the 77us pulse
9) Set the PIN at step 1) to low level
10) Check for a new byte from another UC
11) Read (if applicable) the new byte
12) Store the byte in an external memory
13) Update the external address pointer
14) "Wait" for the next iteration to happen

The PIC should do all this stuff every 1,25us.

In my opinion is pretty difficult even with a 48MHz oscillator, considering the internal operation frequency as 1/4 from the external, which means 12MHz, which means 15 instruction cycles.

It seems to be really hard to do even in assembler code.

What do you think that would be the best option? overclocking? asm code? dsPIC maybe? HW solution? suicide?

In any case... would it be possible with regular CCS C code in some case?

Thanks for any orientation you can give me.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Thu Apr 16, 2009 7:18 am     Reply with quote

I'm all in favor of adventurous programming, but this sounds like "Not even close".

Your response should depend on how polite you need to be to the person who's asking.

But if you can get credit by suggesting an alternative--yes, a pile of logic chips should do it, or an FPGA.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 16, 2009 7:39 am     Reply with quote

When ever I have a problem like this I just code it up, and test it.
You will see how close you can come.
You will see where time is wasted.
And that will point you in a direction to proceed.
Perhaps several PIC is the answer.
Master could say do the pulse,.. and the slave does it, and handles when to turn off.
OR
Perhaps the propeller chip.http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PropellerDatasheet-v1.1.pdf
System Clock Speed = DC to 80 MHz
And several cores could work together like several PICs I mentioned above
Neckruin



Joined: 17 Jan 2006
Posts: 66

View user's profile Send private message

PostPosted: Thu Apr 16, 2009 10:08 am     Reply with quote

Well, I just would rather not feeling I'm wasting the time trying an impossible thing.
I think that the usage of more than one PIC may give better result but does not guarantee anything and generates new synchronization problems that had not been considered.
I'll try to gather aditional information to define the problem better.
Thanks.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Apr 16, 2009 11:26 am     Reply with quote

The intended functionality seems to fit a complex programmable logic device (CPLD), e.g. an Altera MAX II.
Neckruin



Joined: 17 Jan 2006
Posts: 66

View user's profile Send private message

Graphic Display Controller
PostPosted: Mon Apr 20, 2009 5:17 am     Reply with quote

Hi all,
Gathering more information I was said that the purpose of this code would be to implement a graphic display controller for a 160x160 LCD display with a refresh rate of 80Hz that receives the data "on the flow" but stores it to be able to draw full screens.

That means that the display has no controller and the PIC must generate Vertical and Horizontal syncs and all that stuff.

I have been looking in the web but I haven't found anybody who have done that.

Maybe the best solution would be buying a COTS controller, wouldn't it?

Any suggestions? :S
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

very close but---
PostPosted: Mon Apr 20, 2009 11:03 am     Reply with quote

you would HAVE to get ALL the timer based/retriggerable monostable stuff
OUTSIDE the pic - IE a hardware based interconnected bunch of logic and timer/counter chips - where the PIC monitors and adjusts as needed using flag bits etc .

to have ANY hope of success that 1.25Us repeat trigger has to be MONITORED , POST CHANGE - for a pin state change , and retrigger itself automatically perhaps.

kinda the way the TOIF flag works on an internal timer0

that 15 instrux limit is what you HAVE to break to make it fly.

INTS sure wont do it here - the overhead alone will crush you.

in short the 1.25us 'polling' interval is way to short to make use of a pic 18
and get anything else done.

i've managed things like an A/D with a 300 ns maximum trigger pulse requirement using a slow 16F 8 mhz pic ( .5 us instrux cycle ) - but an external fast one shot - added do the dirty work that is too fast for even a pin toggle at the pics native clock rate.

you need to be very hardware capable, or find somebody who is - if you want to pursue this with a pic
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