CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

pin RB5 output problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jamalavedra



Joined: 25 Oct 2016
Posts: 62

View user's profile Send private message

pin RB5 output problem
PostPosted: Fri Mar 03, 2017 12:31 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 03, 2017 12:39 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 03, 2017 12:56 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 03, 2017 1:36 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 03, 2017 1:40 pm     Reply with quote

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 Laughing .

thanks

jaume
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 03, 2017 2:22 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Mar 04, 2017 1:38 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Mar 04, 2017 6:22 am     Reply with quote

Thanks,

By disabling the fuse LVP works perfectly
jaume
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group