View previous topic :: View next topic |
Author |
Message |
cogitoist
Joined: 04 Nov 2009 Posts: 2
|
please help me the arduino code translate ccs c code. |
Posted: Wed Nov 04, 2009 6:41 pm |
|
|
please help me the arduino code translate to ccs c code for 12f675.
The code is using Led Fire Effect.
Thanks for your helping.
-- sinan
Code: | int ledPin1 = 10;
int ledPin2 = 9;
int ledPin3 = 11;
void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
}
void loop() {
analogWrite(ledPin1, random(x)+(255-x));
analogWrite(ledPin2, random(y)+(255-y));
analogWrite(ledPin3, random(z)+(255-z));
delay(random(100));
} |
|
|
|
andyfraser
Joined: 04 May 2004 Posts: 47 Location: UK
|
please help me the arduino code translate ccs c code. |
Posted: Wed Nov 04, 2009 6:53 pm |
|
|
If you spend 10 minutes reading the CCS manual you should have no problem converting this to CCS code.
Andy
www.sharpcontrols.net :: Free custom controls for .NET |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Nov 05, 2009 12:42 am |
|
|
Quote: | you should have no problem converting this to CCS code |
I don't agree. The said proprietary function analog_write() provides a software-PWM, no similar CCS built-in function exists.
It wouldn't be of much general use in my opinion, because it restricts the system performance seriously and thus
doesn't meet the requirements of embedded computing. A similar functionality can be implemented with
CCS C, if the processor is free of critical real-time tasks. But it can't be found in the CCS manual or examples. |
|
|
andyfraser
Joined: 04 May 2004 Posts: 47 Location: UK
|
|
Posted: Thu Nov 05, 2009 11:37 am |
|
|
Point taken, I should have spent more than 10 seconds reading the OP's post. Apologies to sinan for my terse reply |
|
|
cogitoist
Joined: 04 Nov 2009 Posts: 2
|
hi there, |
Posted: Thu Nov 05, 2009 12:05 pm |
|
|
I know not included ccs c compiler this command (analog_write()).
But I need this fire effect ccs c code.
How do they do it for the 12f675 ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|