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.

fundamental questions

Status
Not open for further replies.

X4ROY

Newbie level 6
Joined
Jun 4, 2010
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Bangalore
Activity points
1,416
1. when i declare a pin of a port as an input port say rb0 then in my code i write something like :
if input port is high (rb0 is high)
set rb1 as high
else set rb2 as high .

electrically what voltage should i apply to rb0 to make it a high i am using pic 16f877a
what is the electrical meaning of a high .... say it is some 5 volts then if i connect one terminal of my battery eliminator(+ve one) to port rb0 will it sense a high or shud i also connect the (-ve of eliminator to gnd ) ???

2. i am using hitech c compiler could u please tell me the syntax to refer to a particular bit of a port ...
one book said
PORTbits.RB0 = 1 will set rb1 as high but the compiler is showing undefined symbol error for that
the only header file i have included is htc.h i tried P16F877A.h says it does not exist
 

Answer of Q1:
you have to give electrical voltage equals to Vcc of microcontroller (e.g 3.3v , 5v).

If you are giving voltage externaly (means from other power supply) then you have to connect gnd otherwise no need of gnd.

Answer of Q2:
I am not using hitech c compiler, so i can't answer this one.
 

hi

in hitech c you can directly address the port as RB0,RB1 so on
if you are including <htc.h>
actually it's defined in the header file.
the book in which you seen like that also can be happen when you create your own header file with such addressing types and include the same in your code.
best way to understand is that check the include file which comes with the compiler and you will find the way how they named all the hardwares

regards

ml
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top