please dont rip this site

PIC Microcontoller Input / Ouput Method

SPI interface to AD7730

Tony Kübek, [tony.kubek at flintab.com] of Flintab AB says:

;*************** AnalogDevices AD7730 *******************

; for writing to registers
#define SELECT_WR_COMM          0x00    ; base adress for communication register
#define SELECT_WR_MODE          0x02    ; select mode reg write
#define SELECT_WR_FILTER        0x03    ; select filter reg write
#define SELECT_WR_DAC           0x04    ; select dac reg write
#define SELECT_WR_OFFSET        0x05    ; select offset reg write
#define SELECT_WR_GAIN          0x06    ; select gain reg write

; for reading registers
#define SELECT_RD_STATUS        0x10    ; read status reg once
        #define SELECT_RD_STATUS_CNT    0x20 ; continous read status cycle
        #define SELECT_RD_STATUS_END    0x30 ; returns to one write/read cycle

#define SELECT_RD_DATA          0x11    ; read data reg once
        #define SELECT_RD_DATA_CNT      0x21 ; continuos read data cycle
        #define SELECT_RD_DATA_END      0x30 ; returns to one write/read cycle

#define SELECT_RD_MODE          0x12    ; read mode reg once
        #define SELECT_RD_MODE_CNT      0x22 ; continous read mode cycle
        #define SELECT_RD_MODE_END      0x30 ; return to one write/read cycle

#define SELECT_RD_FILTER        0x13    ; read filter reg
#define SELECT_RD_DAC           0x14    ; read dac reg
#define SELECT_RD_OFFSET        0x15    ; read offset reg
#define SELECT_RD_GAIN          0x16    ; read gain reg

I use an pseudo SPI routine called AD_SEND_BYTE thats sends the byte in W to the AD7730 AND returns with the ( eventual ) byte from the AD in W. To read DATA reg:

        MOVLW   SELECT_RD_DATA
        CALL    AD_SEND_BYTE    ; send request
        
        MOVLW   0x00            ; dummy byte
        CALL    AD_SEND_BYTE    ; get top byte
        MOVWF   AD_NewValue     ; store it

        MOVLW   0x00            ; dummy byte
        CALL    AD_SEND_BYTE    ;
        MOVWF   AD_NewValue+1   ; store it
        
        MOVLW   0x00            ; dummy byte
        CALL    AD_SEND_BYTE    ;
        MOVWF   AD_NewValue+2   ; store it

Or to read status byte from AD:

        ; read AD status reg 
        MOVLW   SELECT_RD_STATUS
        CALL    AD_SEND_BYTE    ; send request
        
        MOVLW   0x00            ; dummy byte
        PCALL   AD_SEND_BYTE    ; get byte
        MOVWF   AD_Status

Interested:

Questions:

Questions:

See

See:


file: /Techref/microchip/spi-ad7730-tk.htm, 7KB, , updated: 2006/11/2 05:22, local time: 2024/12/21 09:08, owner: TK-FLINTAB-DA9,
TOP NEW HELP FIND: 
3.149.235.10:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/techref/microchip/spi-ad7730-tk.htm"> PIC Microcontoller Input / Ouput Method SPI interface to AD7730 </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .