• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic 16f877

Status
Not open for further replies.

hawk

New Member
can anyone help me?, i am using hitech c complier for pic16f877

i want to wirte one equation using c language .

plz give details how can i write the equation using c complier

give some examples program

below i mentioned the equation

out=a*b+c/d
 

Exo

Active Member
Assuming a, b, c and d and out are just integer variables:

Code:
main()
{
int a;
int b;
int c;
int d;
int out;

     //Get values for a,b,c,d
     out = (a * b) + (c / d);
     //Do something with out
}
the ( ) around a * b and c / d should not be nessecairy as multiply and divide have a higher priority then add, but it doesn't hurt to put them there
 

hawk

New Member
Exo said:
Assuming a, b, c and d and out are just integer variables:

Code:
main()
{
int a;
int b;
int c;
int d;
int out;

     //Get values for a,b,c,d
     out = (a * b) + (c / d);
     //Do something with out
}



thanks for your reply
the ( ) around a * b and c / d should not be nessecairy as multiply and divide have a higher priority then add, but it doesn't hurt to put them there
 

hgoh2

New Member
Hi!
i using 16F877 in my project also.
Can you please share your porgarm with me.
I currently just start to write my progarm using MPLAB.
What is the deferance with C++???
 

Exo

Active Member
C++ is a object oriented language (OOP) where C is in 'old' style, just using functions (subroutines).

It's rather hard to explain the concept so maybe you should search a bit on google aubout OOP languages.

I don't think a c++ compiler for a pic is really neccesairy, and if you have one, i doubt it will support the full ansi C++ standard as some of those things are impossible to implement on a pic.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top