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.

PIC 16F877A output_b() problem

Status
Not open for further replies.

John-Ove

Newbie level 4
Newbie level 4
Joined
Jul 26, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,310
Hi all,

I am having some issues with the output_b() function.

I program the PIC 16F877A with output_b(255) which should put all port b pins on high level.

I tried 3 different PIC 16f877A and all of them had B3/PGM at low level.

I also tried the set_tris_b(0x00) before the output_b() method.

I have not used #use_fast_io() --> Is that something I would need?

John-Ove
 

I also tried the set_tris_b(0x00) before the output_b() method.
Dear John
Hi
If you use set tris , method , it will set your pin ( or port ) as input or out put . if you set it as 0 it will be out put !
Follow below thing if you want that all of port B= out put and pin 3 at high level :
Set_tris_b(0)
out put _high ( pin_B3);
Best Wishes
Goldsmith
 

Dear John
Hi
If you use set tris , method , it will set your pin ( or port ) as input or out put . if you set it as 0 it will be out put !
Follow below thing if you want that all of port B= out put and pin 3 at high level :
Set_tris_b(0)
out put _high ( pin_B3);
Best Wishes
Goldsmith

Hi...

Well.. I need to use the output_b(value), where value is an 8bit integer (0-255). This should set all the pins on port B either high or low depending on the integer value.
The problem is that no matter what value (between 0 & 255) the RB3/PGM pin is always low.

So if I enter: output_b(255); the pins on port B should all be at high level.

John-Ove
 

from page 45 of the datasheet:
"Low-Voltage ICSP Programming (LVP) is enabled by default which disables the RB3 I/O function. LVP
must be disabled to enable RB3 as an I/O pin and allow maximum compatibility to the other 28-pin and
40-pin mid-range devices."

make sure you enabled RB3
 
from page 45 of the datasheet:
"Low-Voltage ICSP Programming (LVP) is enabled by default which disables the RB3 I/O function. LVP
must be disabled to enable RB3 as an I/O pin and allow maximum compatibility to the other 28-pin and
40-pin mid-range devices."

make sure you enabled RB3

Hi,

Thank you for your reply.
Is it enough to set the fuses to NOLVP to enable the RB3?

Anyway.. I will check up on this when I get home..

John-Ove
 

HI John
Better try to using this fuses in your program, this may help u...

#fuses HS,NOPROTECT,NOPUT,NOCPD,NOLVP,NOWDT,NOBROWNOUT
 

you will also need to set the pin to output in TRISB, as goldsmith said
 

Hi All,

Thank you for the answers..
I got it working now.

The fuse needed was the NOLVP.

John-Ove
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top