This code is designed to read the status and settings of the AD5321 D/A. An= d write the two data bytes to DAC_RL,DAC_RH. The macro's and initialization= code come from the Tony K=FCbek full initialization code on the PIC list s= ite. This code is not reading back any values. The read process was describ= ed in my first email. What am I doing wrong in the implementation of the re= ad process? Chuck = READ_DAC_DIRECT DISABLE_IRQ ;MACRO to disable global interrupt BANK1 ;MACRO to change bank settings BSF SSPCON2,SEN ;set start bit = = BANK0 = BTFSS PIR1,SSPIF ; wait for interrupt flag to be set TEST!! GOTO $-1 = BCF PIR1,SSPIF = BANK0 = MOVLW DA_ADDRESS2 MOVWF SSPBUF ;send out the address = ; wait for the write to complete before we return BTFSS PIR1,SSPIF ; wait for interrupt flag to be set GOTO $-1 = BCF PIR1,SSPIF ;clear irq flag = = = BANK1 BSF SSPCON2,PEN ;set stop bit BANK0 = BTFSS PIR1,SSPIF ; wait for interrupt flag to be set TEST!! GOTO $-1 = BCF PIR1,SSPIF = ;******************************************************************* ;This portion of the code will read the data from the DAC ;will write data to DAC_RH and DAC_RL = ; = ; = BANK1 BSF SSPCON2,RCEN ;enables read BANK0 ; wait for the write to complete before we return BTFSS PIR1,SSPIF ; wait for interrupt flag to be set GOTO $-1 = BCF PIR1,SSPIF ;clear irq flag BANK1 BTFSS SSPSTAT,BF ;Checks if read buffer is full GOTO $-1 = BANK0 = MOVF SSPBUF,W ;reads contents of buffer MOVWF DAC_RH ;writes to register to pass out of routine ; wait for the write to complete before we return = BTFSS PIR1,SSPIF ; wait for interrupt flag to be set GOTO $-1 = BCF PIR1,SSPIF ;clear irq flag BANK1 BTFSS SSPSTAT,BF ;Checks if read buffer is full GOTO $-1 = BANK0 = MOVF SSPBUF,W ;reads contents of buffer MOVWF DAC_RL ;writes to register to pass out of routine = ENABLE_IRQ RETURN ; and return -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist