View previous topic :: View next topic |
Author |
Message |
jamalavedra
Joined: 25 Oct 2016 Posts: 62
|
pin RB5 output problem |
Posted: Fri Mar 03, 2017 12:31 pm |
|
|
Hi,
I am using a 18LF2685 PIC and recently I have tried to turn on some LEDs with the pin RB5 with pin number 26. When trying with some other pins I get no problems but with this one I can't get it to high level. I have checked in the datasheet and it should apparently work because it is a TTL I/O digital pin. Any idea on what should I do to fix this?
thanks
jaume |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Mar 03, 2017 12:39 pm |
|
|
I checked the datasheet..
RB5, 26, is also used for programming so if you have the PIC still connected to your programmer, it won't operate properly.
Jay |
|
|
jamalavedra
Joined: 25 Oct 2016 Posts: 62
|
|
Posted: Fri Mar 03, 2017 12:56 pm |
|
|
I've tried by disconnecting the programmer and still doesn't get to the high level. Other pins do work. I also tried by changing to some other 18LF2685 so the error is not in the PIC.
thanks
jaume |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Mar 03, 2017 1:36 pm |
|
|
time to show us your test program.
it might be you have LVP fuse enabled and that will override RB5 to become an output.
Jay |
|
|
jamalavedra
Joined: 25 Oct 2016 Posts: 62
|
|
Posted: Fri Mar 03, 2017 1:40 pm |
|
|
this is how my fuses are defined
Code: |
#include <18F2685.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Low power osc < 200 khz
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //Reset when brownout detected
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES BBSIZ4K //4K words Boot Block size
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOMCLR //Master Clear pin enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode enabled
#use delay(internal=8M)
|
regarding the void main there's only the output_high(pin_B5); so no much to be shown .
thanks
jaume |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Fri Mar 03, 2017 2:22 pm |
|
|
this is probably the problem...
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
Please check table 10-3 port b I/O summary, page 135. It says that enabling LVP disables digital output.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Sat Mar 04, 2017 1:38 am |
|
|
and understand that you almost certainly do not want LVP.
All normal programmers do not use this. Pretty much the only time you use LVP is if you have some other chip on the board that directly programs the PIC. |
|
|
jamalavedra
Joined: 25 Oct 2016 Posts: 62
|
|
Posted: Sat Mar 04, 2017 6:22 am |
|
|
Thanks,
By disabling the fuse LVP works perfectly
jaume |
|
|
|