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 support@ccsinfo.com

Port bit RB3 with bootloader

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







Port bit RB3 with bootloader
PostPosted: Mon Jun 23, 2003 8:12 pm     Reply with quote

I am using the bootloader/downloader by Petr K/Shane Tolmie on a 16F876 at 4MHz, with CCS C compiler v3.158.

Am I correct in saying it is not possible to use port bit RB3 as an input in my application if I'm using the bootloader?

From the F876 datasheet, my understanding is that the LVP bit must be set to "1" in the config word to enable the bootloader to function. Also, to prevent the device entering LV programming mode when running my application, I must not let port RB3 float high. When I load the downloader hex file into my high voltage programmer, the LVP bit is set.

I want to use RB3 as an input, is there any work around for this, apart from changing my hardware to use another port bit?

Regards,
Patrick Felstead
Melbourne Australia
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515500
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Port bit RB3 with bootloader
PostPosted: Mon Jun 23, 2003 9:11 pm     Reply with quote

:=I am using the bootloader/downloader by Petr K/Shane Tolmie on a 16F876 at 4MHz, with CCS C compiler v3.158.
:=
:=Am I correct in saying it is not possible to use port bit RB3 as an input in my application if I'm using the bootloader?
-----------------------------------------------------------

You can definitely use it. Shane and Petr's bootloader
comes with an assembly language source file, that you can
compile with MPLAB. In that file, there is a line that sets
the config bits. Here it is:

__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON &
_MYCRYSTAL & _WRT_ENABLE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF

Notice that they have LVP enabled ?
You need to change it to: _LVP_OFF
Then you can use Pin B3.

After you make that change, use MPLAB to assemble the file,
and create the Hex file. Then program it into your PIC, by
using PicStart-Plus or a similar programmer.

Then you can download your development programs by using Petr's
small Windows downloader program. But remember, you cannot
set any config bits (fuses) with that downloader. You can only
set them initially, when you burn the Bootloader into your PIC.
But that's not normally a problem. I use the bootloader every
day, and I never feel a need to change the fuses.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515501
Patrick Felstead
Guest







Re: Port bit RB3 with bootloader
PostPosted: Tue Jun 24, 2003 9:22 pm     Reply with quote

Thanks PCM Prog. You are correct, problem solved. Instead of recompiling the assembly language file, I just loaded the hex file in my PIC programmer (incidentally its a USB programmer k149B by [url] <a href="http://www.kitsrus.com" TARGET="_blank">http://www.kitsrus.com</a>[/url]), and changed the LVP fuse to disable before programming, then I saved the file (which also saves the config word) back to the original hex filename.

Somehow, the bootloader by these guys programs the PIC program memory without using the low voltage programming mode...I'm not sure.

Anyway, I can now use RB3 as an IO pin without any problems, so thanks.

Cheers,
Pat

:=:=I am using the bootloader/downloader by Petr K/Shane Tolmie on a 16F876 at 4MHz, with CCS C compiler v3.158.
:=:=
:=:=Am I correct in saying it is not possible to use port bit RB3 as an input in my application if I'm using the bootloader?
:=-----------------------------------------------------------
:=
:=You can definitely use it. Shane and Petr's bootloader
:=comes with an assembly language source file, that you can
:=compile with MPLAB. In that file, there is a line that sets
:=the config bits. Here it is:
:=
:=__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON &
:=_MYCRYSTAL & _WRT_ENABLE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF
:=
:=Notice that they have LVP enabled ?
:=You need to change it to: _LVP_OFF
:=Then you can use Pin B3.
:=
:=After you make that change, use MPLAB to assemble the file,
:=and create the Hex file. Then program it into your PIC, by
:=using PicStart-Plus or a similar programmer.
:=
:=Then you can download your development programs by using Petr's
:=small Windows downloader program. But remember, you cannot
:=set any config bits (fuses) with that downloader. You can only
:=set them initially, when you burn the Bootloader into your PIC.
:=But that's not normally a problem. I use the bootloader every
:=day, and I never feel a need to change the fuses.
:=
:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515543
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Port bit RB3 with bootloader
PostPosted: Tue Jun 24, 2003 11:21 pm     Reply with quote

:=
:=Somehow, the bootloader by these guys programs the PIC program memory without using the low voltage programming mode...I'm not sure.
----------------------------------------------------------

There are 3 ways to program a PIC's program memory:

1. High Voltage programming, via an external programmer.
ie., PicStart-Plus, Warp-13a, etc.

2. Low Voltage programming, via an external programmer.
ie., TLVP programmer, etc.

3. Writing to program memory, under internal program control.
This is done by writing to the EECON2, EEDATH, EEDATA
registers, etc. The setting of the LVP fuse does not
affect this method. The bootloader uses this 3rd method.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515545
patrickfelstead
Guest







Re: Port bit RB3 with bootloader
PostPosted: Wed Jun 25, 2003 3:54 am     Reply with quote

Brilliant, now I get it, thanks PCM. I'd better keep reading the F876 data sheet ;)

Patrick

:=:=
:=:=Somehow, the bootloader by these guys programs the PIC program memory without using the low voltage programming mode...I'm not sure.
:=----------------------------------------------------------
:=
:=There are 3 ways to program a PIC's program memory:
:=
:=1. High Voltage programming, via an external programmer.
:= ie., PicStart-Plus, Warp-13a, etc.
:=
:=2. Low Voltage programming, via an external programmer.
:= ie., TLVP programmer, etc.
:=
:=3. Writing to program memory, under internal program control.
:= This is done by writing to the EECON2, EEDATH, EEDATA
:= registers, etc. The setting of the LVP fuse does not
:= affect this method. The bootloader uses this 3rd method.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515554
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