• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   4 Anonymous Users






Re: 關於16F676 內含 EEPROM????
#6
資深會員
資深會員


查看用戶資訊
素醬子呦 ? 讓偶好好酌模酌模 消化一下嚕;
好難耶?? 頭壳不輪轉啦 !! 哈..哈...

3Q,謝謝啦!大鍋....

發表於: 2008/10/8 2:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F676 內含 EEPROM????
#5
版主
版主


查看用戶資訊
底下所附檔案為 PIC16F EEPROM 的 Code Example。
建議用 MPASM SIM 執行一下程式,打開 EEPROM Window 後再組譯程式,看看 EEPROM WIndow 是有有將初始 Table 放進去? 在執行程式看看 EEPROM 內容是否改變,在執行一次在看看 EEPROM 的值與初始設定的關係。

Attach file:


Link only for registered users

發表於: 2008/10/7 8:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F676 內含 EEPROM????
#4
版主
版主


查看用戶資訊
鴨先生,

這個你就錯了,這不是宣告,也不會每次開機時會把使用者存入的值, 給覆蓋過去了。
[color=ff0000]        org    0x2100        Set EEDATA location at 0x00
;
        
DE    "Microchip Technology"0x00
        DE    
"Firmware Version V2.30"0x00
;
        
org    0x2180        Set EEDATA location at 0x80
;
        
DE    'a','b','c','d'0x0A0x0D0x00,0x00
[/color]

以上的程式經 Assembler 後會在 EEPROM 的位址 0x2100 產生一組 ROM Data 的 Table,該Table 會以 Hex 檔的方式存在。所以燒錄時就會將此資料燒到 EEPROM 裡,這時開機就會有初始參數可以使用。以後修改 EEPROM 的Table 後,在開機也是你最後所修改的值而不再會是程式的原始設定值。

發表於: 2008/10/7 8:17
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F676 內含 EEPROM????
#3
資深會員
資深會員


查看用戶資訊
3Q...Ryang 版主!
可是好像不是偶要的....我再詳細說明一下嚕!!!

偶在設計一個 Flat TV lifts ,
基本上就是控制一個DC Motor up and down,
所以 EEPROM 裡面要存幾個資料...
Position_temp -->目前位置;
Position_Memory -->使用者儲存位置;
Current_H--->Motor 最大電流;;(防止過載).
Current_L--->Motor 最小電流;
問題是? 出廠時 ,Current_H,Current_L,要預先放入一個值,
例如Current_H=200, Current_L=50.
那第一次開機時可以Load進入程式, 讓使用者來控制DC Motor up and down,
使用者再用校正鍵存入新的值.
如果用宣告, 那每次開機不是會把使用者存入的值, 給覆蓋過去了?

所以想如何出廠時,預先放入一個出廠值在EEPROM裡面.

3Q lor...

發表於: 2008/10/7 3:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於16F676 內含 EEPROM????
#2
版主
版主


查看用戶資訊
可以的。

1. 使用 Hi-Tech PICC 用_ _ EEPROM_DATA ( ) 得方式宣告,
//**********************************
//* Function Prototype Declaration
//**********************************


// ================================================================
// ****     The Configuration was defined in the pic168xa.h    ****
//
// **** Establish PIC16F877A Configuration Word
// **** == HS Oscillator Mode
// **** == Watch-Dog Timer Off
// **** == Brown-Out Detect Enabled
// **** == Low Voltage Programming Off
// **** == Code Protect Off
//

__CONFIG  HS WDTDIS PWRTEN BOREN LVPDIS UNPROTECT ); 

// =================================================================

//   Hi-Tech PICC had provided the macro for define bytes data
//                     into Internal EEPROM.
//
//     __EEPROM_DATA() macro can be used to place the inital EEPROM 
//     data values into the HEX file ready for programming. The macro
//     accepts eight parameters, being eight data values. Each value 
//     should be a byte in size. 
//
//     Hi-Tech PICC also provided both macros EEPROM_READ()and EEPROM_WRITE()
//     and the function versions of these macros, can be called to read from,
//     and write to, the EEPROM during program execution.
//
//     To write a byte-size in EEPROM memory: EEPROM_WRITE(address,value)
//     To read a byte of data from EEPROM memory: variable = EEPROM_READ(address)

// *****     Define byte data into the Internal EEPROM    *****
//
__EEPROM_DATA     (0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07);
__EEPROM_DATA    (0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f);
__EEPROM_DATA    ('H','i','-','T','e','c','h',0x00,);


2. 使用組語宣告:
;*************     Declare EEPROM Data Byte   ********************
;
Syntax:     [<label>] de <expr> [, <expr>, ..., <expr>]
;
Reserve memory words with 8-bit dataEach <exprmust evaluate
to an 8-bit valueThe upper bits of the program word are zeroes
Each character in a string is stored in a separate word.
Although designed for initializing EEPROM data on the PIC16F877A,
;
; As 
following example code will generated the EEDATA into the Hex file
;
        
org    0x2100        Set EEDATA location at 0x00
;
        
DE    "Microchip Technology"0x00
        DE    
"Firmware Version V2.30"0x00
;
        
org    0x2180        Set EEDATA location at 0x80
;
        
DE    'a','b','c','d'0x0A0x0D0x00,0x00

發表於: 2008/10/2 13:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於16F676 內含 EEPROM????
#1
資深會員
資深會員


查看用戶資訊
Dear All;

請教是否可以在燒錄16F676PIC時, 放入一些預設值到EEPROM去?
就是在開機時, 程式可以去EEPROM 把預設值拿出來用呢?

3Q lor .....

發表於: 2008/10/2 5:49
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------