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

How to access register at 0X300005

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



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

How to access register at 0X300005
PostPosted: Thu Dec 18, 2003 8:32 pm     Reply with quote

PIC18F252
I need to set bit 0 of 0X300005 to 0

CONFIGURATION REGISTER 3 HIGH (CONFIG3H: BYTE ADDRESS 300005h)
Bit 0 is CCP2MX when set to 0 make Port B3 the output pin.

I seem to remember there is a way to do this with PCH

Data sheet implies it's the similar to writing eeprom... Either I made a mistake or it's lying to me...
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Dec 18, 2003 8:53 pm     Reply with quote

It should be writing to program memory. I've never done it with CCS's function but it should do the trick. Try the write_program_memory() function.

Mark
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Chip no longer programs after using write_program_memory()
PostPosted: Thu Dec 18, 2003 9:52 pm     Reply with quote

OK that compiled, and I ran it... it did not work as expected...but else something strange happened...

ICD-2 now reports this error !

ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0xEFE9, Val Read = 0x0)
ICD0275: Programming failed.

This is strange. I've been using this prototype for about 3 weeks and programmed it about 20 time today alone.

Is this a coincidence or what !
Did the write_program_memory() clobber something !

I tired programming a second prototype and did not try to run the code.
It still programs !

It's a SMD chip so not so easy to swap out... Arrrgh!

Just in case anyone is interested here is the code that I used.

int i;

Read_Program_Memory(0X300005,&i,1); // one byte at a time
bit_clear( i, 0 ); // 0 then RB3 is PWM o/p
Write_Program_Memory(0X300005,&i,1);

Sad
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

More info
PostPosted: Thu Dec 18, 2003 9:56 pm     Reply with quote

I programmed the configuration bits only and here's the error messge.

ICD0161: Verify failed (MemType = Config, Address = 0x300001, Expected Val = 0x26, Val Read = 0x0)
ICD0275: Programming failed.


Looks like the chip got clobbered...
Tom-H-PIC



Joined: 08 Sep 2003
Posts: 105
Location: New Castle, DE

View user's profile Send private message

FUSE setting?
PostPosted: Thu Dec 18, 2003 9:58 pm     Reply with quote

Hello Hans
I think what you are looking for is a FUSE setting.

I’m using the 18F452 and in checking the valid #Fuse keywords.
This is what I found.

Code:
CCP2C1      CCP2 input/output multiplexed with RC1
CCP2B3      CCP2 input/output multiplexed with RB3


If these are the right fuses options CCS will set the configuration register for you.

Tom
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Write_Program_Memory destroyed the chip !
PostPosted: Thu Dec 18, 2003 10:05 pm     Reply with quote

I disconnected ICD-2 and cycled the power retsarted MPLAB and got this message when I tried to connect to the Debugger (ICD-2)

ICDWarn0020: Invalid target device id(expected-0x20, read=0x0)

The ICD-2 settings are correct. Connecting the the second protoype and MPLAB find the device no problem...

Whatever Wrtie_Program_memory() did it looks to me like it clobbered the chip ID location !

Anyone know a way to reset that !

I expect I'll have to change the chip.
Sad
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Changed chip
PostPosted: Thu Dec 18, 2003 10:54 pm     Reply with quote

Removed the SMD chip and soldered in a new one...
everything works....
Guest








Re: FUSE setting?
PostPosted: Fri Dec 19, 2003 7:37 am     Reply with quote

Tom-H-PIC wrote:
Hello Hans
I think what you are looking for is a FUSE setting.

I’m using the 18F452 and in checking the valid #Fuse keywords.
This is what I found.

Code:
CCP2C1      CCP2 input/output multiplexed with RC1
CCP2B3      CCP2 input/output multiplexed with RB3


If these are the right fuses options CCS will set the configuration register for you.

Tom


Tom,
Yes and it's also possible to set them in the configuration dialog of MPLAB.

However it's supposed to be "ok" to do it on the fly.... !
Tom-H-PIC



Joined: 08 Sep 2003
Posts: 105
Location: New Castle, DE

View user's profile Send private message

ICD settings
PostPosted: Fri Dec 19, 2003 8:15 am     Reply with quote

Yes I agree that this option would be able to be changed on the fly.
But there must be an issues with changing the configuration register at 0x30000x address.
Hans now has a chip that is junk.
I do know one think that is that if you don’t have the ICD-UXX setup for “Bulk erase on wirte “ under the advanced settings. That the ID address at 0x200000 etc. will not get set to 0xFFFF.
I’m think that maybe that the configuration registers will not get reset 100% if ICD not set to “Bulk erase on wirte “.
Hans if you want to save that other chip check your ICD setting under advanced.

Tom
Guest








Re: ICD settings
PostPosted: Fri Dec 19, 2003 8:34 am     Reply with quote

Tom-H-PIC wrote:
Yes I agree that this option would be able to be changed on the fly.
But there must be an issues with changing the configuration register at 0x30000x address.
Hans now has a chip that is junk.
I do know one think that is that if you don’t have the ICD-UXX setup for “Bulk erase on wirte “ under the advanced settings. That the ID address at 0x200000 etc. will not get set to 0xFFFF.
I’m think that maybe that the configuration registers will not get reset 100% if ICD not set to “Bulk erase on wirte “.
Hans if you want to save that other chip check your ICD setting under advanced.

Tom


Thanks I'll look at the bulk erase.

In the mentime I talked with Mark at CCS....
He thinks it may be an issue with the odd address. the pic18 needs to be read/written on even boundries. !

CCS is investigating, I post an update when I get one.
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