Page 1 of 6

Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 11:32 am
by Nandika
Hi Friends,
I have some basic knowledge about MicroC.
I am coding for 12 channel LED drivr/flasher for Poson :)
I have MicroC and Protus for debug/coding it. ;)

However,I have Little problems.
This is my 1st

I want a command to MikroC for Manipulate each bit of Port.
Simply,
i want to turn on channel4 witch was connected to 3rd bit/pin of PORTB.
I have tried before,But :cry:
My Try....And My MikroC About window
My Try....And My MikroC About window
err1.jpg (99.34 KiB) Viewed 21869 times
I have also used this code.

Code: Select all

PORTB.F2
please,Give me a command or example for this.
Thanks

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 11:52 am
by Nandika
2nd question is....

I want to add heder file like C++.
please,tel me how to add it and #include it.

Thans

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 12:21 pm
by Nandika
:biggrin: :biggrin:

Friends,
It's OK
I could solve my problem.

Answer for 1st question is,

Code: Select all

PORTX.Fn

X=PORTA,PORTB.....
n=pin/bit(0,1,2....)

Answer for 2nd question is,
1.manually create .h file in project folder.
2.use add file in Project manager of MikroC.
3.code this(it's like C++ :) )

Code: Select all

#include filename.h
filename=manually created file name

However,Your help will want me for this Project. :) :)

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 1:56 pm
by SevenZero
I'm not discouraging you on Mikro C. But I should say HI-TECH C is very good for PIC, dsPIC programming. It is the only 3rd part C compiler recommended by Microchip. The main point I love about HI-TECH C is, it is very straightforward. MikroC has fancy libraries which make it looks like a very high level environment. I don't see any advantage in driving a say LCD with a library where we don't know what is happening inside. No fun when we don't know what is happening. Assembly is the best, but since time is also important C is the most suitable option.

http://www.microchip.com/stellent/idcpl ... e=en534868

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 3:21 pm
by Nandika
Thank you ZevenZero,

I really know HI-TECH C is good.before,i worked with HI-TECH C.I created some small project using it. :D
But,Now i haven't HI-TECH C.I must download it feature.
Actually,I can understand that you said.I'm a beginner for PIC.therefore,I must use Assembly like languages.It is advice for understand reality of Micro controller.
Till,I download HI-TECH C,please help me for Mikro C.(I never discourage :) )

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 3:21 pm
by Nandika
Now,I have some big problem.I want to adjust Time delay in code.Now,it's constant.like this,

Code: Select all

Delay_ms(500)
I want to add Variable resistor for adjust it.
I used PIC16F877A.PORTB,C,D ware dedicated to LED channels.
I have PORTA for connect VR.

Please,give me example code or learning source for do this.
thanks :)

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 5:15 pm
by SemiconductorCat
There are two methods to do this.
1. Saw tooth method , with a op-amp and count duty cycle. [analog jam , I love this believe me,I could help you
on this].
2. ADC way.

Choose the first method if your micro does not contain a ADC unit.
Which way you prefer.

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 5:47 pm
by Nandika
Thanks SemiconductorCat,
I like to learn both.
But,Now,I like to use 2nd one.because,i think,it's easy for this time.
My micro is PIC16F877A.it has ADC unit.
First, tell me ADC Way

After,if you can,if you have time, tell me OP-AMP,saw tooth method.really,i like it.because,i am also learning about OP-AMP. :clap:

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 5:50 pm
by SemiconductorCat
There is a example here :
http://www.mikroe.com/download/eng/docu ... ibrary.htm

as it sounds the first two methods is by using ADC.
and last one uses internal RC jam.

Re: Help My Project(12CH LED Driver)??

Posted: Mon May 07, 2012 6:07 pm
by Nandika
Nice.. Thank you SemiconductorCat,
I already have it in MiKroC user manual.I forgot that.
ADC system is easy,But, :x .We can't get more idea from it.

If u can Please,explain your OP-AMP system. :)
not now..