91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .c
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-10
  • 語言: 其他
  • 標(biāo)簽:

資源簡介

關(guān)于MSP430單片機內(nèi)部FLASH應(yīng)用例程(讀、寫、擦除和保存數(shù)據(jù)),自己已經(jīng)調(diào)試完成,希望可以幫到大家。

資源截圖

代碼片段和文件信息

//****************************************************************************
//??MSP-FET430P140?Demo?-?Flash?In-System?Programming?Copy?SegA?to?SegB
//
//??Description:?This?program?first?erases?flash?seg?A?then?it?increments?all
//??values?in?seg?A?then?it?erases?seg?B?then??copies?seg?A?to?seg?B.
//??Assumed?ACLK?3686400/10??kHz.
//??//*?Set?Breakpoint?on?NOP?in?the?Mainloop?to?avoid?Stressing?Flash?*//
//
//???????????????MSP430F149
//????????????-----------------
//????????/|\|??????????????XIN|-
//?????????|?|?????????????????|
//?????????--|RST??????????XOUT|-
//???????????|?????????????????|
//
//??M.?Mitchell
//??Texas?Instruments?Inc.
//??Feb?2005
//??Built?with?IAR?embedded?Workbench?Version:?3.21A
//******************************************************************************

#include??
typedef?unsigned?char?uchar;
typedef?unsigned?int??uint;

uchar??value;????????????????????????????????//?8-bit?value?to?write?to?segment?A
uchar??DataBuffer[128];

//?Function?prototypes
void??write_SegA?(uchar?value);
void??copy_A2B?(void);
void??send(void);
void??Com2_Init(void);
void?TA_Init(void);



void?main(void)
{
??WDTCTL?=?WDTPW?+?WDTHOLD;?????????????????//?Stop?watchdog?timer
??FCTL2?=?FWKEY?+?FSSEL_0?+?FN3?+?FN0;??????????????//?ACLK/10?for?Flash?Timing?Generator?(range?from?~?257?kHz?to?~?476?kHz)
??value?=?0;????????????????????????????????//?Initialize?value
??
??Com2_Init();
??TA_Init();
??_BIS_SR(LPM3_bits?+?GIE);???????//?LPM0?ADC12_ISR?will?force?exit??
}

//?Timer?A0?interrupt?service?routine
#pragma?vector=TIMERA0_VECTOR
__interrupt?void?Timer_A?(void)
{
????write_SegA(value++);????????????????????//?Write?segment?A?increment?value
????send();
????copy_A2B();?????????????????????????????//?Copy?segment?A?to?B
????_NOP();?????????????????????????????????//?SET?BREAKPOINT?HERE?
}



void?write_SegA?(uchar?value)
{
??uchar?*Flash_ptr;??????????????????????????//?Flash?pointer
??uint?i;

??Flash_ptr?=?(uchar?*)?0x1080;??????????????//?Initialize?Flash?pointer
??FCTL1?=?FWKEY?+?ERASE;????????????????????//?Set?Erase?bit
??FCTL3?=?FWKEY;????????????????????????????//?Clear?Lock?bit
??*Flash_ptr?=?0;???????????????????????????//?Dummy?write?to?erase?Flash?segment
??
??FCTL1?=?FWKEY?+?WRT;??????????????????????//?Set?WRT?bit?for?write?operation

??for?(i=0;?i<128;?i++)
??{
????*Flash_ptr++?=?value;???????????????????//?Write?value?to?flash
??}

??FCTL1?=?FW

評論

共有 條評論

相關(guān)資源