• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::

論壇索引


Board index » All Posts (rogers)




請問各位大大 要寫出外部EEPROM 24LCXX 的問題
#1
新會員
新會員


我是使用MICROCHIP放在網路上的程式
寫入時可以確定是我寫入的DATA
我是用示波器測量出波型
在讀取時我發現讀出的數值也正確
可是我不知道它將讀出的值放在哪裡

由程式的語法得知,他把資料放在datai 的位置
可是我把datai位置的資料叫出來,發現是不對的

想請問是否讀取錯誤

以下是MICROCHIP的程式
PIC10F202 and
;   
the PIC12F675 are supported by this code.
    LIST 
P=12F675       This can be either 10F202 or 12F675

;   GPIO pin descriptions
;   SDA                 bit 0
;   SCL                 bit 1
;
;   
4MHz internal oscillator is being usedthus each instruction
;   cycle 1000 ns
;
;*******************Include 
file**********************************
;   Include 
the appropriate header fileonly one will be selected
  IFDEF __10F202
    
include "p10f202.inc"       This is the include file for a PIC10F202
    __CONFIG  _MCLRE_OFF 
_CP_OFF _WDT_OFF
  
ENDIF

  
IFDEF __12F675
      
include "p12f675.inc"     This is the include file for a PIC12F675
    __CONFIG  _INTRC_OSC_NOCLKOUT 
_WDT_OFF _PWRTE_OFF _MCLRE_OFF _BODEN_OFF _CP_OFF _CPD_OFF
  
ENDIF
  
errorlevel  -302              Suppress message 302 from list file
;*****************************************************************
    
org     0x000               Set the reset vector
    
goto    start               Go to the beginning of main
;*******************Macro definitions*****************************
  
IFDEF __10F202
SETTRIS macro                   
Macro to set TRIS regon PIC10F202
    tris    GPIO                
Copy value to TRIS reg.
    
endm
  
ENDIF

  
IFDEF __12F675
SETTRIS macro                   
Macro to set TRISIO regon PIC12F675
    banksel TRISIO              
Select Bank 1
    movwf   TRISIO              
Copy value to TRISIO reg.
    
banksel GPIO                Select Bank 0
    endm
  
ENDIF
;*******************
Begin Main Program****************************
  include 
"i2c_routines.inc"    This is the I2C code
start
    bsf     GPIO
,SCL            Set SCL high
    movlw   SDA_IN              
Configure SDA to be an input
    SETTRIS                     
Copy value to TRISB register
    
goto    BYTEREAD            Call byte read routine    

;*******************Byte read test subroutine*********************
;           
This routine tests the byte read feature
;           of the serial EEPROM device.  It will read
;           16 bytes of data from the device starting at
;           address 0x501 byte at a time.
;*****************************************************************
BYTEREAD
    movlw   .16
    movwf   bytecount           
Initialize counter to 16 bytes

    movlw   0x50
    movwf   address             
Initialize byte address to 0x50
rxbyte
    call    BSTART              
Generate start bit
                                
Now send the control byte
                                
; for a writeto set address
    movlw   WRITE_ADDR
    movwf   datao               
Copy control byte to buffer
    call    TX                  
Output control byte to device

                                
Nextthe address pointer
    movf    address
,W           Copy address to WREG
    movwf   datao               
Copy address to buffer
    call    TX                  
Output address to device

    call    BSTART              
Generate another start bit
                                
to switch to read mode
    movlw   READ_ADDR
    movwf   datao               
Copy control byte to buffer
    call    TX                  
Output control byte to device

                                
; Finally, read the data byte
    bcf     buffer
,ACKB         Select to send NO ACK bit
    call    RX                  
Input data from device

    call    BSTOP               
Generate stop bit
    incf    address
,F           Increment address pointer
    decfsz  bytecount
,F         Check if finished looping
    
goto    rxbyte              ; Continue looping
    
goto    BYTEREAD

    END


發表於: 2006/4/19 15:27
頂部


新手問題,請教有關EEPROM與FLASH Memory
#2
新會員
新會員


我知道PROGRAM Memory 用的是FLASH Memory的方式

SRAM與EEPROM是屬於DATA MEMORY ,

我可以再Register File Map看出SRAM的數目

以PIC16F877A為例子有368個Data Memory

但是我要從哪張圖(MAP)得知,EEPROM就如同Data Sheet

所說有256個

發表於: 2006/3/22 13:38
頂部


新手問題 請問有關CALL的問題
#3
新會員
新會員


當我在程式的某行的時候,我是用CALL的方式
Build ALL的時候會出現下面幾行

MPLINK 3.94, Linker
Copyright (c) 2005 Microchip Technology Inc.
Error - file 'C:\PIC ASM\TEST\PIC202.o', section '.org_0', performs a call to
symbol 'DELAYMAIN' which is not in the lower half of a page.
Errors : 1

可是我把CALL取消
Build ALL 又會正常,想請教一下是什麼原因

發表於: 2006/2/24 14:23
頂部


Re: 請問大大有關ICD2 Build All 時出現的錯誤
#4
新會員
新會員


大大英明。您說沒錯,我查了機械碼果然是0XFF為我的最後一行,我再往下寫就會出現同樣的錯誤

但是您的副程式放在前面,我就不懂了

發表於: 2005/12/19 17:58
頂部


請問大大有關ICD2 Build All 時出現的錯誤
#5
新會員
新會員


我BUILD ALL時會出現這個錯誤

Error - file 'C:\PIC202.o',
section '.org_0', performs a call to
symbol 'delay23' which is not in the lower half of a page.
Errors : 1

就算我用 NOP這個指令也會出現
這樣我程式就不能在往下寫了
是程式太多嗎
可是我看PROGRAM MEMORY ADDRESS也只有到11E而已
這顆不是可以到1FF的容量嗎??


發表於: 2005/12/19 15:04
頂部






:::

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... ]

教育訓練中心

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