1254936 玫、發明說明 領域、先前技術、內容、麵施圖式_明) 本發明係關於非揮發性記憶之技術領域,尤指一種非 揮發性記憶體存取系統及其存取方法。 二、先前技術BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to the field of non-volatile memory, and more particularly to a non-volatile memory access system and an access method thereof. Second, prior technology
Ik著可攜式電子產品之風行,快閃記憶體(Ik is popular with portable electronic products, flash memory (
Memory)已廣泛地應用在可攜式電子產品及其相關之微型 儲存裝置中。在現有之商用產品中,最常見的快閃記憶體 φ 主要為反及型(NANDType)快閃記憶體與反或型(Ν⑽ 15 20Memory) has been widely used in portable electronic products and related micro-storage devices. Among the existing commercial products, the most common flash memory φ is mainly reverse type (NANDType) flash memory and inverse type (Ν(10) 15 20
Type )快閃記憶體。反及型快閃記憶體其在進行讀取 (Read)、寫入(Write)以及抹除(E職)動作時,係 以區塊(B1〇ck)作為基本處理單位,且價格便宜,基於此 種特性,使得該類型快閃記憶體大量地應用在儲存媒體 曰(Storage Medium)上。反或型快閃記憶體之價格則較為 昂貴’其在進行寫入與讀取動作時係以位元組(b㈤為 基本處理單位,在進行抹除動作時則以區塊作為基本處理 早位,故反或型快閃記憶體較適合用來健存程式執行碼,· 而不適合應用於-般的可攜式儲存裝置(例如:隨身碟卜 然而,反或型快閃記憶體出廠時係具有一定的規柊, 例如:16百萬位元組(MB),32MB或64Μβ等,若欲存放 之程式執行碼僅需要25MB,則必須使用32mb的模组 此將會有麵的空間將無法有效利用。若反或 體剩餘的部分作為財媒體(即用來儲存-般性資料或; 案系統),則可有效地利用記憶體。但,反或型快閃記憶 6 25 1254936 體資料寫入時是以位元組為基本處理單位,而抹除動作是 =塊為基本處理單位,且不能同時對反或型快閃記憶體 ::進仃嗔取與寫入動作’使得反或型快閃記憶體同時用 來儲存程式碼與檔案线時’其運作效能將會很低。 三、發明内容 本發明之主要目的係在提供—種非揮發性記憶體存 系統及其存取方法,俾能使得非揮發性記憶體同時 儲存資料與程式碼。 本發明之另-目的係在提供—種非揮發性記憶體存 取系統及其存取方法,俾能提高同時用來儲存資料與 之非揮發性記憶體的存取效率。 15 /依據本發明之一特色,所提供之非揮發性記憶體存取 :統:係架構於一可攜式電子裝置中,該非揮發性記憶體 子取糸統主要包括:—非揮發性記憶裝置,其係以位元组 ,基本處理單位來進行讀取與寫人,並以區塊為基本處理 早位來進行抹除,#包括一第一區域與一第二區域,該第 一區域用以儲存程式碼,該第二區域用以存取資料,該第 二區域係經由-格式化處理,以形成複數儲存區塊,每一 儲存區塊具有複數頁次,每一頁次具有至少_位元組,俾 供f過該等儲存區塊之頁次存取該第二區域之資料;一記 隐單元4有複數暫存區段;以及一中央處理單元,其係 透過記憶單元的該等暫存區段讀寫非揮發性記憶體的該等 儲存區塊之頁次,其中,當寫入資料時,該中央處理單元 20 1254936 2並二“批依序地寫人資料於該等儲存區塊之頁 ’、’在母次寫入時關閉其中斷要求,每次寫入完成後打 開其中斷要求。 母人馬入兀成後打 依據本發明之# 4主Λ 5 15 ,時户“色,所提供之非揮發性記 = 係配合一具有在讀取與寫入動作時以位元 产^基本處理單位’且在進行抹除動作時以區塊為 :理早位之特性的非揮發性記憶裝置 式碑2 苐二區域,該第—區域用以儲存程 ::苐—區域用以存取資料,該非揮發性記憶體存取 第1區诚包括下述步驟:—格式化步驟,係用以格式化該 ’以形成複數儲存區塊,每_儲存區塊具有複數 =之二:頁ί具有至少一位元阻,俾供透過該等儲存 !塊之頁次存取資料;—資料寫人步驟,係以-中央處理 早70,由-記憶單元將資料寫入該等儲存區塊之頁次,其 :儲m入資料於該等儲存區塊之頁次’係依序寫入該 子“鬼之頁次,且該中央處理單元關閉所有中斷要 ,,以及-#料讀取步驟,係透過該記憶單元來讀取 儲存區塊之頁次中的資料。 μ寸 20 四、實施方式 有關本發明之較佳實施例,係以_可攜式電子裝 的非揮發性記憶體存取系統來舉例說明,於本實施例中, 可攜式電子裝置較佳為個人數位秘書(pda)或口 腦(Pocket PC)。 1254936 圖1顯示本發明之系統架構示意圖,其主要包含中 理單元(CPU)卜記憶單^以及非揮發性記㈣置3 中,中央處理單元1具有至少__暫存器u,其係用來暫存複 數個中斷要求(例如:可暫存32個中斷要求)以及一中斷 要求控制旗標111,非揮發性記憶裝置3至少被分為第一區 域31及第二區域32,第-區域31用以儲存可攜式電子褒置 之作業系統的執行程式碼,第二區域32用以作為儲^媒 體,以儲存-般的資料檔案。當然,非揮發性記憶裝置〗 更可包έ第—區域’以用來儲存系統開機程式或測試程式。 於本實施例中,非揮發性記憶裝置3為一種具有在讀取 與寫入時以位it組為基本處理單位,且在進行抹除(ε·) 15 時以區塊為基本處理單位之特性,非揮發性記憶裝置3較佳 為反或型(NOR Type)快閃記憶體,記憶單元2較佳為隨 機存取圮憶體(RAM )。上述之中央處理單元丨寫入資料 於非揮發性圮憶裝置3之第二區域32、或由非揮發性記憶裝 置3之第二區域32讀取資料時皆透過記憶單元2。 有關中央處理單元1寫入或讀取資料之詳細說明,敬請 一併參照圖1、圖2a與圖3顯示之流程圖以及示意圖。首先, 在非揮發性記憶裝置3之第二區域32作為儲存媒體之前(例 如pda第一次開機時),必須先對第二區域32進行格式化 處理(步驟S201),俾供在第二區域32形成複數儲存區塊 32卜其中,每一儲存區塊321皆具有複數個頁次(page), 且该等複數儲存區塊並規劃區分為一般存取區3 22以及備 援區323,存取區322與備援區323之區塊數量比較佳地為二 20 1254936 比’於本實施例中,每一區塊32 1的頁次之數目較佳為四 個(如圖3所示編號為3211,3212,3213,3214),當然每一頁次 係由複數位元組331組成。而中央處理單元丨讀取或寫入第 —區域32之資料時,係以頁次作為基本存取單位。 10 15 20 70成格式化之後,中央處理單元1便可對第二區域32 進行資料存取。中央處理單元1在存取第二區域32之前會先 判斷目前是進行讀取動作還是寫入動作,若為讀取動作, ^中央處理單元1將其暫存器丨丨之中斷要求控制旗標111設 定為高位狀態,以開啟中斷要求動作,亦即其他裝置可向 中央^理單元1發出中斷要求(步驟S2〇2),繼而,中央 處理單元旧始對第二區域32中的該等儲存區塊32ι進 料讀取(步驟S203 )。 、 ^若為寫入動作’則中央處理單元丨將待寫入資料暫時寫 入記憶單S2所包含之複數存取區段(SeetiQns) Η的盆中 2-區段(步驟2〇4)。於本實施例中,係依序地寫入資 於苐二區域32的頁次中,亦即每次 、 ^ ^ u ^ .、、、貝料之起始頁次係 寫入資料完成後之頁次,例如:前次寫入資料至 儲存區塊321之頁次3211及3212, 儲存卩撿百Am 下罵入貝枓時,便由 =„次3212的下—個頁次則開始寫人資 並*4個頁次資料寫入完成時, 寫入之方式將於下述說明。"-寫入貝枓。有關資料 在寫入資料前,中央處理單元丨會先 入新資料,若否則為修改資 Μ立寫 十勁作,有關其動作,容後說 10 1254936 明。若為建立寫入新資料,則再判斷欲寫入之目 5 10 15 否在,由於本實施射係採依序寫人的方式,因 此^頁次已有資料,則表示資料量已超過第二區域奴 。己憶體容量,停止寫人動作並警示制者(步驟勘)。 右4頁次並無資料存在,則中央處理單元丨將其暫存器 中HI要求控制旗標111設定為低位狀‘態,以關閉所有的 ’動作’亦即此時中央處理單元1不受理其他裝置之 中,要求(步驟S2G5),並開始將記憶單元2中的資 入第二區域32。 ..... 於寫人非揮發性記憶裝置3的速度比較慢,且又暫時 才央處理單凡i之中斷要求,因此若一次將所有資料寫 =揮發性記憶裝置3將使得整個系統資源降低,故中央處 早701每次寫入資料於非揮發性記憶體3係以記憶單元中 ^至區段21為主,來分批寫人資料於第二區域32之目 +ΐί人其中’δ己憶單元2之每一區段21的大小等於該等區 塊中的每一頁次大小。 「 、处里單元1並在寫入完成後,對該頁次予以註記為 使用中」(步驟S206)。 著中央處理單元1判斷待寫入資料是否已寫入完 =,若待寫人資料已寫人完成,則結束此次寫人動作。若 、:有夕筆貝料尚未寫人,則中央處理單元1打開中斷要求 字中斷要求控制旗標i i i設定為高位狀態)(步驟 =)以接收其他裝置之中斷要求,若其他裝置並無請 "斷要求則中央處理單元1繼續寫入下一筆資料(步驟 20 1254936 S208) ’並繼續重複執行步驟㈣、步驟讓、㈣撕 以及步驟S208,直到資料寫入完成。 有時候使用者會在讀取資料後,修改其所讀取之資 ^此時則發生資料修改之情形,有關中央處理單元i修改 貧=之詳細說明,敬請一併參照圖i、圖η及圖頂示之流 程,圖及不意圖,中央處理單元1將待寫人資料寫人記憶單元 後,係先判斷待寫入目標頁次是否有資料存在,其中,在 匕斤心之待寫人目標頁次係接續前次寫人資料動作之頁 :有=τ誤之情形產生,亦即,欲修改之資料並 二資料本的將待修改之資料依前述 馨示欠已有資料存在’則停止寫入動作並 者°己隐體空間不足(步驟S214)。若待窝入曰择 15 20 頁次無資料存在,則中央處理單元 要 _),以開始寫入資料於目標頁次,中 用中」,且對;目標1次註記為「使 驟8211)。 ^料存放之頁次註記為「不使用」(步 ^、之後中央處理單元i判斷修改之資料是否已入 :成’若已全部寫入完成’則完成此次修改資料::‘、’、t 尚有其他修改資料尚未寫人第二區域32,則^4<^。°若 打開中斷要東,、处里早元1 始進行寫入下發二斷要求之裳置,繼而開 聿貝枓於下一個目標頁次(步驟S213), 12 1254936 並繼續重複執行步驟S2 ! η μ 、ν驟S211、步驟S212以及+ _ S213,直到修改資料寫入完成。 夂夕驟 當待寫入資料開始宮 ^ , 馬入苐二區域之備援區塊323,亦gp 存取區塊321之最後一個百Α Γ δρ 進入備援區塊323時,將自s炊 ^ 第二區域32進行抹除。$ —抹除動作,該抹除動作係對Type ) Flash memory. The reverse flash memory uses the block (B1〇ck) as the basic processing unit for reading (Read), writing (Write), and erasing (E) operations, and is inexpensive, based on This feature makes this type of flash memory widely used in the storage medium. The price of the inverse or flash memory is more expensive. 'When the write and read operations are performed, the byte is used (b (f) is the basic processing unit, and when the erase operation is performed, the block is used as the basic processing early position. Therefore, the reverse flash memory is more suitable for storing program execution code, and is not suitable for use in a general portable storage device (for example, a flash drive, however, the reverse or flash memory is shipped from the factory). Have certain rules, such as: 16 million bytes (MB), 32MB or 64 Μβ, etc. If you want to store the program execution code only needs 25MB, you must use 32mb module. This will have no space. Effective use. If the remaining part of the object is used as a financial medium (that is, to store the general information or the system), the memory can be effectively utilized. However, the inverse type flash memory 6 25 1254936 The entry is based on the byte as the basic processing unit, and the erase action is = block is the basic processing unit, and can not simultaneously reverse or flash memory:: input and write action 'make anti-type Flash memory is also used to store code and At the time of the file line, its operational efficiency will be very low. III. SUMMARY OF THE INVENTION The main object of the present invention is to provide a non-volatile memory storage system and an access method thereof, which enable non-volatile memory to simultaneously store data. Another object of the present invention is to provide a non-volatile memory access system and an access method thereof, which can improve the access efficiency of simultaneously storing data and non-volatile memory. According to one feature of the present invention, the non-volatile memory access system is provided in a portable electronic device, and the non-volatile memory sub-system mainly includes: - a non-volatile memory device The reading and writing are performed by a byte, a basic processing unit, and the early processing is performed by using the block as a basic processing, and #includes a first area and a second area, and the first area uses To store the code, the second area is used to access data, and the second area is processed through a formatting process to form a plurality of storage blocks, each of the storage blocks having a plurality of pages, each page having at least _ Byte, Accessing the data of the second area by the pages of the storage blocks; a hidden unit 4 having a plurality of temporary storage sections; and a central processing unit passing through the temporary storage sections of the memory unit Reading and writing the pages of the storage blocks of the non-volatile memory, wherein when the data is written, the central processing unit 20 1254936 2 and the second batch of pages sequentially write the human data on the pages of the storage blocks ',' turns off the interrupt request when the parent writes, and opens the interrupt request after each write is completed. The mother and the horse enter the 兀 打 依据 according to the invention # 4主Λ 5 15 , the time "color, provided The non-volatile memory = a non-volatile memory device having the characteristics of a block-based basic processing unit in the reading and writing operations and a block-wise early position in the erasing operation The second area of the monument 2, the first area is used for storage: the area is used for accessing data, and the non-volatile memory accessing the first area includes the following steps: - formatting step, used Format the ' to form a complex storage block, each _ storage block has a complex number = The second page: page ί has at least one element resistance, for accessing the data through the pages of the storage block; the data writing step is performed by the central processing unit 70, and the data is written by the memory unit. Waiting for the page of the storage block, the page of the storage block is written in the page of the storage block, and the central processing unit closes all the interruptions, and - The material reading step is to read the data in the page of the storage block through the memory unit. The preferred embodiment of the present invention is exemplified by a non-volatile memory access system of a portable electronic device. In this embodiment, the portable electronic device is preferably used. For personal digital secretary (pda) or mouth (Pocket PC). 1254936 FIG. 1 is a schematic diagram showing the system architecture of the present invention, which mainly includes a middle unit (CPU) memory unit and a non-volatile memory unit (4). The central processing unit 1 has at least a __ register u, which is used by To temporarily store a plurality of interrupt requests (for example, 32 interrupt requests can be temporarily stored) and an interrupt request control flag 111, the non-volatile memory device 3 is at least divided into a first area 31 and a second area 32, a first area 31 is used to store the execution code of the operating system of the portable electronic device, and the second area 32 is used as a storage medium to store the general data file. Of course, the non-volatile memory device can include the first area to store the system boot program or test program. In the present embodiment, the non-volatile memory device 3 has a bit processing group as a basic processing unit during reading and writing, and a block as a basic processing unit when erasing (ε·) 15 is performed. The non-volatile memory device 3 is preferably a NOR type flash memory, and the memory unit 2 is preferably a random access memory (RAM). The central processing unit 透过 writes data to the second area 32 of the non-volatile memory device 3 or reads data from the second area 32 of the non-volatile memory device 3 through the memory unit 2. For a detailed description of the central processing unit 1 to write or read data, please refer to the flowcharts and schematic diagrams shown in FIG. 1, FIG. 2a and FIG. First, before the second area 32 of the non-volatile memory device 3 is used as the storage medium (for example, when the pda is turned on for the first time), the second area 32 must be formatted first (step S201), and the second area is provided in the second area. 32, forming a plurality of storage blocks 32, wherein each of the storage blocks 321 has a plurality of pages, and the plurality of storage blocks are planned to be divided into a general access area 3 22 and a backup area 323. The number of blocks in the area 322 and the backup area 323 is preferably two 20 1254936. In the present embodiment, the number of pages of each block 32 1 is preferably four (as shown in FIG. 3). It is 3211, 3212, 3213, 3214), of course, each page consists of a plurality of bytes 331. When the central processing unit reads or writes the data of the first area 32, the page is used as the basic access unit. After 10 15 20 70 is formatted, the central processing unit 1 can access the second area 32 for data access. Before accessing the second area 32, the central processing unit 1 first determines whether a read operation or a write operation is currently performed. If it is a read operation, the central processing unit 1 sets the interrupt request control flag of its temporary register. 111 is set to the high state to activate the interrupt request action, that is, the other device can issue an interrupt request to the central processing unit 1 (step S2〇2), and then the central processing unit searches for the storage in the second region 32. Block 32 ι feed reading (step S203). If it is a write operation, the central processing unit temporarily writes the data to be written into the 2-section of the plurality of access segments (SeetiQns) included in the memory list S2 (step 2〇4). In this embodiment, the information is sequentially written in the page of the second area 32, that is, each time, ^ ^ u ^ ., , , and the starting page of the bedding are written after the data is completed. Pages, for example, the last time data is written to the storage block 321 pages 3211 and 3212, when the storage of the hundred Am is entered into the bei, the next page of the next 3212 is written. When the registration of 4 pages of data is completed, the method of writing will be described below. "-Write to Bessie. Before the data is written, the central processing unit will first enter the new data, otherwise For the purpose of modifying the assets, write about the ten masterpieces, and regarding the movements, let's say 10 1254936. If you want to write new materials, then you can judge the purpose you want to write. 5 10 15 No, because this implementation is based on the shooting system. Preface the person's way, so ^ page has data, it means that the amount of data has exceeded the second area slave. Recall the body capacity, stop writing action and alert the system (step survey). Right 4 pages without data If there is, the central processing unit 设定 sets the HI requirement control flag 111 in its register to a low-level state to close the At this time, the central processing unit 1 does not accept other devices, and requests (step S2G5), and starts to input the second unit 32 into the memory unit 2. ..... The speed of the memory device 3 is relatively slow, and it temporarily handles the interrupt request of the single memory. Therefore, if all the data is written once = the volatile memory device 3 will reduce the overall system resources, the central office writes 701 every time. The data in the non-volatile memory 3 series is mainly in the memory unit ^ to the segment 21, and the human data is written in batches in the second region 32 + ΐί people, where each segment of the 'δ recall unit 2 The size of 21 is equal to the size of each page in the blocks. ", the unit 1 is inscribed, and after the writing is completed, the page is marked as in use" (step S206). The central processing unit 1 determines whether the data to be written has been written to =, and if the person to be written has completed writing, the end of the writing action is ended. If:: If the eve pen is not yet written, the central processing unit 1 opens the interrupt request word interrupt request control flag iii is set to the high state) (step =) to receive the interrupt request of other devices, if other devices do not have "Off request, the central processing unit 1 continues to write the next data (step 20 1254936 S208) 'and continues to repeat step (4), step let, (4) tear and step S208 until the data is written. Sometimes the user will modify the information read by the user after reading the data. At this time, the data modification will occur. For details about the modification of the central processing unit i, please refer to Figure i and Figure η. And the flow shown in the figure, the figure and the intention, after the central processing unit 1 writes the person to be written to the memory unit, it is first determined whether there is data in the target page to be written, wherein the data is to be written. The page of the person's target page is the page of the previous person's data action: there is a situation of =τ error, that is, the information to be modified and the data to be modified of the data book are in existence according to the above-mentioned scent. Then, the writing operation is stopped and the hidden space is insufficient (step S214). If there is no data available for 15 20 pages, the central processing unit should _) to start writing data to the target page, use medium, and correct; target 1 time note is "make order 8211" The page of the material storage is marked as "not used" (step ^, after the central processing unit i judges whether the modified data has been entered: "If all the writing is completed", the modification information is completed:: ', ' , t There are still other modified materials that have not yet been written in the second area 32, then ^4<^.° If the interruption is to be east, the beginning of the early 1st is written to write the second break request, and then open Stepping on the next target page (step S213), 12 1254936 and continuing to repeat steps S2! η μ, ν step S211, step S212, and + _ S213 until the modified data writing is completed. The data starts from the gate ^, the backup zone 323 of the Majinji area, and the last one of the gp access block 321 δ δρ enters the backup block 323, and is erased from the second region 32 of the s炊^ $ — erase action, the erase action is correct
有關抹除動作,敬請一併參照圖卜圖3及圖4顯示之示 w圖及机私圖’由於非揮發性記憶裝置3係為反或型快閃記 憶體:故其進行抹除動作時係以一個區塊為單位,然而°, 10在該等存取區塊321或料備援區塊323中,其部分頁次必 須保留(即該部分頁次係註記為「使用中」),有也頁次 貪料則可刪除(如前述目修改而被註記為不制的資料)。For the erasing action, please refer to the diagrams shown in Figure 3 and Figure 4 and the private diagram of the machine. 'Because the non-volatile memory device 3 is a reverse or flash memory: it is erased. The time is in units of one block. However, in the access block 321 or the spare spare block 323, part of the page must be reserved (that is, the part of the page is marked as "in use"). , if there are also pages of greed, you can delete (such as the above-mentioned items modified and noted as unmade data).
^因此在進行抹除動作時,係由第一個存取區塊321開始 碩取’以讀取該存取區塊321中註記為「使用中」的頁次, 15並將該頁次中的資料寫入記憶單元2(步_〇1),繼而 將該筆資料接續寫入上次寫入動作完成之頁次,其寫入方 式與上述修改資料方式相類似,係重覆執行步驟S402、步 驟S403、步驟S404以及步驟S4〇5或步驟S4〇6,直到將該欲 抹除區塊中註記為「使用中」的頁次搬移至其他無資料存 20在的頁次為止,且對搬移資料資頁次註記為「不使用」。 當該欲抹除區塊中的所有頁次皆註記為「不使用」時, 則開始對該區塊進行抹除,且在抹除後對該區塊之頁次註 a己為「空的」(步驟S407 ),繼而繼續進行下一個區塊的 13 1254936 :ΐ = ::用直到第二區域所有的區塊皆被抹除,,以回收 所有不使用的頁次。 队 :於抹除非揮發性記憶裝置3區塊中的資料需要比較 二吏0用:區因Λ中央處理單元1對上述該等頁次皆註記為 他運算或:二 =進仃-貝料讀寫)’同時對該區塊進行抹除,以回收該等區 10 15 20 儀"7人=Γ人^己可在d憶單S 2中建立—註記表4,其 數攔位4卜以用來註記不使用、使用中或空的, 田“、、、,亦可直接在非揮發性記憶體中註記。 中斷述可&本發明係利用分批寫入資料與暫時關閉 古π / t方法’來達朗時儲存資料與程式碼,以及提 厂時用來儲存資料與程式之非揮發性記憶體的存取效 =同時為有效利用反或型非揮發性記憶體及解決反或型 H己憶體以位元組為儲存單位、區塊為抹除單位的 :’卜於儲存資料檔案之空間係先經過格式化處理,首先, =頁次為存取單位,設計依序寫人模式,即便是修改資料 :亦不直接寫入覆蓋,因此可讀保非發揮性記憶體的第二 :域中的頁次不會被重複寫入資料,而造成資料錯誤的情 况產生’並且制註記方式來瞭解各頁次内資料的狀態; 再^,規劃有存取區與備援區,以寫入動作進入備援區作 為個啟動抹除回收資料狀態為不使用(無效)頁次的觸發 點’利用備援區作為-個緩衝空間,使可確保在無資料遺 14 1254936 時儲存資料與程 之非揮發性記憶 失的狀態下進行抹除回收區塊,來達成同 式碼’以及提高同時用來儲存資料與程式 體的存取效率。 ,本發明所 ’而非僅限 上述實施例僅係為了方便說明而舉例而已 主張之權利範圍自應以_請專利範圍所述 於上述實施例。 ”、、丰 五、圖式簡單說明 圖Η系本發明一較佳實施例之系統架構示意圖。 # 10圖2a係本發明—較佳實施例之讀取及寫人資料流程圖。 圖2b係本發明一較佳實施例之修改資料寫入流程圖。 圖3係本發明一較佳實施例之寫入示意圖。 圖4係本發明一較佳實施例之資料抹除流程圖。 15 六、圖號說明 中央處理單元 中斷要求控制旗標 區段 第一非揮發性記憶體3 1 存取區塊 頁次 位元組 1 暫存器 11 111 記憶單元 2 21,22 非揮發性記憶裝置 3 第二非揮發性記憶體32^ Therefore, when the erase operation is performed, the first access block 321 starts to make a 'make' to read the page in the access block 321 which is marked as "in use", 15 and the page is in the middle. The data is written into the memory unit 2 (step_〇1), and then the data is successively written to the page where the last write operation is completed, and the writing manner is similar to the modified data mode, and the step S402 is repeatedly executed. Step S403, step S404, and step S4〇5 or step S4〇6, until the page marked as "in use" in the block to be erased is moved to the page of other dataless storage 20, and The page of the moving information page is marked as "not used". When all the pages in the block to be erased are marked as "not used", the block is erased, and after the erase, the page of the block is marked as "empty". (Step S407), then proceed to the next block of 13 1254936: ΐ = :: until all the blocks in the second area are erased, to reclaim all unused pages. Team: In addition to the data in the block 3 of the volatile memory device, it is necessary to compare the data for the use of the area: the area is processed by the central processing unit 1 for the above-mentioned pages, or the second page is read as: Write) 'At the same time erase the block to recover the area 10 15 20 instrument " 7 people = Γ people ^ can be established in the d recall S 2 - note Table 4, the number of blocks 4 For the purpose of not being used, in use or in the air, the field ",,,, can also be directly recorded in the non-volatile memory. Interrupted description & The invention uses batch writing data and temporarily closes the ancient π /t method's access to data and code, and the accessibility of the non-volatile memory used to store data and programs at the time of the factory = simultaneous use of anti-type non-volatile memory and resolution of anti-or The H-recalling body uses the byte as the storage unit and the block as the erasing unit: 'The space in which the data file is stored is first formatted. First, the = page is the access unit, and the design is written in order. Human mode, even if the data is modified: it is not directly written to the overlay, so it can be read and protected. The second: the page number in the domain will not be repeatedly written to the data, but the data error will result in 'and the note mode to understand the status of the data within each page; then ^, planning access zone and backup In the area, the write operation enters the backup area as a trigger to erase the data status. The trigger point of the unused (invalid) page is used as a buffer space to ensure that there is no data 14 1454936. In the state of storing the data and the non-volatile memory loss of the process, the erased block is erased to achieve the same code' and the access efficiency for storing the data and the program is improved. The present invention is not limited to the above implementation. The scope of the claims is only for the convenience of the description, and the scope of the claims is as described in the above-mentioned embodiments. ",,,,,,,,,,,,,,,,,,,,,,,,,, schematic diagram. #10 Figure 2a is a flow chart of the reading and writing of the present invention - the preferred embodiment. Figure 2b is a flow chart of a modified data write in accordance with a preferred embodiment of the present invention. 3 is a schematic diagram of writing in accordance with a preferred embodiment of the present invention. 4 is a flow chart of data erasing in accordance with a preferred embodiment of the present invention. 15 VI. Graphic No. Description Central Processing Unit Interrupt Requirement Control Flag Section First Non-volatile Memory 3 1 Access Block Page Sub-Byte 1 Scratchpad 11 111 Memory Unit 2 21, 22 Non-volatile Memory Device 3 second non-volatile memory 32
321,322備援區塊 3211,3212,3213,3214 331 註記表 32: 41 欄位 15 4321,322 spare blocks 3211,3212,3213,3214 331 Annotation Table 32: 41 Fields 15 4