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

Configuration Memory from C

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







Configuration Memory from C
PostPosted: Fri Sep 19, 2008 3:42 pm     Reply with quote

hello,
Using PCH Ver 4.073 in MPLAB Ver 8.10, would like to set Brown Out Detect to "Enabled in hardware, SBOREN Disabled" and would like to set Brown Out voltage to "4.3V" The CReferenceManual.pdf refers to function "write_configuration_memory()" but am not sure how to use it.
Any tips really apprec.

169: void main()
170: {
043E 6AF8 CLRF 0xff8, ACCESS
0440 9ED0 BCF 0xfd0, 0x7, ACCESS
0442 8E0D BSF 0xd, 0x7, ACCESS
0444 6AEA CLRF 0xfea, ACCESS
0446 6AE9 CLRF 0xfe9, ACCESS
0448 50C1 MOVF 0xfc1, W, ACCESS
044A 0BC0 ANDLW 0xc0
044C 090F IORLW 0xf
044E 6EC1 MOVWF 0xfc1, ACCESS
0450 0E07 MOVLW 0x7
0452 6EB4 MOVWF 0xfb4, ACCESS
171:
172: unsigned long work_buffer[2];
173: unsigned char spi_buffer[2],val;
174:
175: int16 config_data;
176:
177:
178: work_buffer[0] = 0x04;
0454 6BA8 CLRF 0xa8, BANKED
0456 0E04 MOVLW 0x4
0458 6FA7 MOVWF 0xa7, BANKED
179: work_buffer[1] = 0x0f;
045A 6BAA CLRF 0xaa, BANKED
045C 0E0F MOVLW 0xf
045E 6FA9 MOVWF 0xa9, BANKED
180: write_configuration_memory(work_buffer[0],2);
0460 0E30 MOVLW 0x30
0462 6EF8 MOVWF 0xff8, ACCESS
0464 6AF6 CLRF 0xff6, ACCESS
0466 6AF7 CLRF 0xff7, ACCESS
0468 0EC0 MOVLW 0xc0
046A 6EA6 MOVWF 0xfa6, ACCESS
046C C0A8 MOVFF 0xa8, 0xfea
0470 C0A7 MOVFF 0xa7, 0xfe9
0474 0E02 MOVLW 0x2
0476 6E01 MOVWF 0x1, ACCESS
0478 CFEE MOVFF 0xfee, 0xff5
047C 000C TBLWT*
047E D640 BRA 0x100
0480 28F6 INCF 0xff6, W, ACCESS
0482 6EF6 MOVWF 0xff6, ACCESS
0484 2E01 DECFSZ 0x1, F, ACCESS
0486 D7F8 BRA 0x478
0488 9CA6 BCF 0xfa6, 0x6, ACCESS
048A 6AF8 CLRF 0xff8, ACCESS
181:
182:
183:
Ttelmah
Guest







PostPosted: Fri Sep 19, 2008 4:01 pm     Reply with quote

What chip?...
Remember, that changing the configuration memory, in general _does not_ change the feature, till the chip is next reset.
Generally, except for writing things like bootloaders, there should be little reason to change the memory inside the code.
All you would normally do, is select the BORV43 fuse, and the BROWNOUT fuse, and the right values wll be put into the registers, along with your code....

Best Wishes
yuru
Guest







thanks
PostPosted: Mon Sep 22, 2008 6:14 am     Reply with quote

thanks for the tip
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