c code for pic16f877a

Thread Starter

shicibukai

Joined Feb 21, 2013
6
i have a project to design a automatic switching capacitor for power factor correction system.. the pic will eventually detect an input from current transducer. the current transducer will detect current value n convert to number(0-255) i think... if value is from 0-100... o/p A will trigger... if value from 101-150, o/p B will trigger and if value from 150-255, o/p C will trigger.. A,B,C is refer to different output from the pic16f877a. these 3 output then will be connected to capacitor.. the problem is, i don't know how to assign those output to specific input current value. im a newbie here and im just starting to study the microC. can anyone help me with the C code? thanks..
 

ErnieM

Joined Apr 24, 2011
8,377
You should start by getting the cart behind the horse.

You should not start to automate a process you do not yet understand. Power factor involves the phase delay between the voltage and the current, not the absolute value of either. That is a time measurement, not voltage.

Once you understand THAT a good thing to do is to breadboard your solution with mechanical switches and caps to see if you truly do have a fix.

Also understand that your algorithm should be advancing to caps, since once a particular cap is in circuit a factor change means you need switch to the next cap, not any particular cap.

THEN... learn the language to program the controller. C is a good choice and is freely available.

Finally... you can start on some hardware and software planning.
 

Thread Starter

shicibukai

Joined Feb 21, 2013
6
ok i understand that.. i would like to know is the input of pic is digital number between 0-255? which mean i can separate the number to trigger several output port? just like i explain before.
 

tshuck

Joined Oct 18, 2012
3,534
You would need to evaluate the input and take action accordingly.

As ErnieM has already stated: you need to start at the beginning. learn the concepts, then apply them. You'll get nowhere otherwise...
 

t06afre

Joined May 11, 2009
5,934
Yes you can work on a single bit level on a PIC I/O port. You can also use bit twiddling methods to some extent modify several bits simultaneously on a port. I do not know which C compiler you use so I can not be more specific. If you want to know more about bit twiddling. Just Google bit twiddling
 

ErnieM

Joined Apr 24, 2011
8,377
ok i understand that.. i would like to know is the input of pic is digital number between 0-255? which mean i can separate the number to trigger several output port? just like i explain before.
Digital or analog input?

Each digital I/O pin could represent a single binary digit, jam 8 inputs together and you can get it to mean a number from 0 to 255.

Each analog input can be sent to an analog to digital (A2D) converter. The A2D on this device can give you a conversion of either 8 bits (0-255) or 10 bits (1-1023).

But as I said before, power factor is best measured by a time measurement.
 

Thread Starter

shicibukai

Joined Feb 21, 2013
6
anyone can provide me c programming and circuit for automatic capacitor switching of power factor correction system using pic16f877a?. im really new into this.thank you. im willing to pay but not so much :(
 

bertus

Joined Apr 5, 2008
22,277
Hello,

We are not an answering service.
When we would give you a complete solution, you would have learned nothing.
So, show us how you would approach the problem.

Bertus
 

ErnieM

Joined Apr 24, 2011
8,377
anyone can provide me c programming and circuit for automatic capacitor switching of power factor correction system using pic16f877a?. im really new into this.thank you. im willing to pay but not so much :(
Nope, sorry, but nice try. :p

You have the barest of ideas here, which while it is a start is just right at the starting line, and no where near the "begin writing code" stage. So you are asking someone to flesh out the concept (how to measure power factor and how to change it), design all the hardware for you, select the components, then to write the code for it.

After all that you are willing to pay them "but not so much."

You need to pick a new direction with this project.
 

takao21203

Joined Apr 28, 2012
3,702
There are special briefings from Microchip, also run by a few independent organisations.

Usually not free, but the independent one's normally don't cost so much.

That is what OP should attend, if he's any serious.

Otherwise, there is no way around to study and examine how the fundamentals work. Reading datasheets, and doing tutorials, getting PICs, and all that.

Giving some C code could do more damage than any helping.

Once OP has a circuit and a working program, forum members can assist to look at the code, and add things, and improve it.

If OP wants to hire a programmer to produce a C code, this won't be cheap, $50/hour is on the downend. It needs to be a professional, if it is an amateur, maybe the work will leave OP with more questions and problems than before.

From many PIC related forum posts, I really must believe these people never seriously examined the Microchip website. There are many things to discover.
 
Top