Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f84A programming help !!!!!

Status
Not open for further replies.

mailus

Full Member level 4
Joined
Mar 6, 2012
Messages
234
Helped
7
Reputation
16
Reaction score
7
Trophy points
1,308
Location
-
Activity points
2,706
hello,
I started learning with pic microcontroller 16f84A with mikroC Software.but i don't know any language.Very basic knowledge in c only.
how to start using mikroC.there is no tutorial about how to start with mikroc.

is this mikroc is right choice for a beginner?

where i can find tutorial?
 

This blog was very nice..
Is there any tutorial for mikroc coading?
 

thank you for your support. I feel happy........




doubt in pic16f84

how to read a switch from port A.
how to set RB0 as input & RB1-7 as output.

give some examples.
 
Last edited:

To read switch from PORTA and RB0 as input and RB1-RB7 as outputs

If switch is connected to PORTA.F0 then


Code:
void main() {

TRISA = 0b00000001; // set PORTA pin RA0 as input all others as output
PORTA = 0x00;          // clear PORTA
TRISB = 0b00000001; // set RB0 as input, RB1 - RB7 as outputs
PORTB = 0x00;          // clear PORTB 
 
while(1) {

if (PORTA.F0 = 1) {
        // do something
}

}


}
 
  • Like
Reactions: mailus

    mailus

    Points: 2
    Helpful Answer Positive Rating
what is the meaning for this

"if (oldstate && Button(&PORTB, 0, 1, 0)) " and what is the "&"
represents here.

similarly "if (Button(&PORTB, 0, 1, 1))"
 

There is a double "&&" logical AND operator and a single "&" bitwise AND operator, both are binary operators requiring two operands.

The following is a logical AND operator:

Code:
if (oldstate [COLOR="#FF0000"]&&[/COLOR] Button(&PORTB, 0, 1, 0))



However, in the case of the following:

Code:
if (Button([COLOR="#FF0000"]&[/COLOR]PORTB, 0, 1, 1))

It is a single "&" "address of" operator in front of PORTB, a unary operator requiring a single operand.

Which returns the address of storage used for the variable PORTB.


BigDog
 
  • Like
Reactions: mailus

    mailus

    Points: 2
    Helpful Answer Positive Rating
I can't understand. I need more details...please

- - - Updated - - -

I CAN'T UNDERSTAND. I NEED MORE DETAILS...PLEASE
 

Check this tutorial for learning C language.
https://www.cprogramming.com/tutorial/c/lesson6.html
The single "&" sign before a variable indicates that you try to the "Address Of" the value in the memory, not the value stored in this variable.
Code:
For example:
Suppose we have an integer variable called "X" carrying the value "0xAA" and its location in the memory is "0xFE"
printf("Value of X = %d", X);  ---> Prints the "0xAA"
printf("Location of X = %d", &X);   ---> Prints the "0xFE"

Hope it is clear now.
 
  • Like
Reactions: mailus

    mailus

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top