;-------------Divider-------------
DIV_START:
MOVR div_1, A
MOVAR div_temp ;div_temp = div_1
DIV_LOOP:
;-------------Divider-------------
DIV_START:
MOVR div_1, A
MOVAR div_temp ;div_temp = div_1
DIV_LOOP:
Bit banding
The Cortex™-M3 memory map includes two bit-band regions. These regions map each
word in an alias region of memory to a bit in a bit-band region of memory. Writing to a word
in the alias region has the same effect as a read-modify-write operation on the targeted bit in
the bit-band region.
Organized as 1 block of 256 bytes (1 x 256 x 8)
100 kHz (24AA02) and 400 kHz (24LC02B) compatibility
Device Address : Read = 0xA1, Write = 0xA0
這顆比較小, A0~A2接腳可以Don't care.
WP接地就可以正常寫入.
Code, RO-data, RW-data, ZI-data
Code爲Flash-ROM
RO-data = 固定的字串或是常數(const temp;)
RW-data = 有初始值得變數, 佔ROM, 執行的時候也佔RAM
ZI-data = 沒有初始值的變數, 只佔RAM
目前發現是因為 I2C_CheckEvent(I2C1, I2C_EVENT_xxxxxxxxxxx)
因為未知的原因, 某些flag是會跳起來的, 並不是完全按照範例所想的每個bit不差.
而這個function只要有一個bit不一樣他就判斷錯誤.
因此我把I2C_CheckEvent換成了I2C_GetStatus.
順便在發送過程中加入了Times counting機制. 讓他不容易卡死在回圈內.
本來在A project正常使用的I2C code, 移植到另一個程式之後就無法使用, 後來發現Start不會發送, 進而發現bus always BUSY.
查了些之後之後發現這是很多使用者常常遇到的問題, 有兩三種解決方式, 我直接採用SoftReset.
void I2C_Configuration(void)
{
I2C_InitTypeDef I2C_InitStructure;

USART_SR:
Bit 7 TXE: Transmit data register empty
This bit is set by hardware when the content of the TDR register has been transferred into
the shift register. An interrupt is generated if the TXEIE bit =1 in the USART_CR1 register. It
is cleared by a write to the USART_DR register.