At 08:48 AM 3/5/97 +1000, you wrote: > Has anyone written code for the MAXIM 186 8-channel serial A/D converter > (or any of the MAX serial A/Ds? If no-one has, I'll have to, and will Attached below is the Parallax assembler (Microchip mnemonics) for a '71 to use the MAX147, which is same communication as the 186. The program is intended to be run from my Mathias, hence the lack of other I/O. Andy device PIC16C71, XT_OSC, WDT_OFF, PROTECT_OFF ; Pinout ; equ RA.2 ; 1 ; equ RA.3 ; 2 ; equ RA.4 ; 3 ; MCLR ; 4 ; Vss ; 5 ; equ RB.0 ; 6 ; equ RB.1 ; 7 ; equ RB.2 ; 8 SCLK equ RB.3 ; 9 CS equ RB.4 ; 10 DIN equ RB.5 ; 11 SSTRB equ RB.6 ; 12 DOUT equ RB.7 ; 13 ; Vdd ; 14 ; OSC2 ; 15 ; OSC1 ; 16 ; equ RA.0 ; 17 ; equ RA.1 ; 18 TRIS_A equ 00000000b TRIS_B equ 11000000b DEFAULT_RB equ 11111111b TB1 equ 10000011b org 20h RxBuf ds 6 Receive ds 1 Transmit ds 1 Dflt_Transmit ds 1 STARTBIT equ Dflt_Transmit.7 SEL2 equ Dflt_Transmit.6 SEL1 equ Dflt_Transmit.5 SEL0 equ Dflt_Transmit.4 UNI_BIP equ Dflt_Transmit.3 SGL_DIF equ Dflt_Transmit.2 PD1 equ Dflt_Transmit.1 PD0 equ Dflt_Transmit.0 org 0 RESET bcf RP0 movlw DEFAULT_RB movwf RB bcf SCLK bsf CS bcf DIN bsf RP0 movlw TRIS_A movwf TRISA movlw TRIS_B movwf TRISB bcf RP0 clrf Transmit ; Initialize MAX147 in power-down mode call TransmitByte call TransmitByte call TransmitByte bsf STARTBIT bcf SEL2 ; Selects channel 0 bcf SEL1 bcf SEL0 bcf UNI_BIP ; Selects bipolar operation bcf SGL_DIF ; Selects differential operation bsf PD1 ; Selects internal clock mode bcf PD0 :Loop bcf SEL2 bcf CS movf Dflt_Transmit,W movwf Transmit call TransmitByte :Wait1 btfss SSTRB goto :Wait1 clrf Transmit ; Transmit 0 while receiving data call TransmitByte movwf RxBuf+0 call TransmitByte movwf RxBuf+1 bsf SEL2 movf Dflt_Transmit,W movwf Transmit call TransmitByte :Wait2 btfss SSTRB goto :Wait2 clrf Transmit ; Transmit 0 while receiving data call TransmitByte movwf RxBuf+2 call TransmitByte movwf RxBuf+3 bsf CS rlf RxBuf+1,F rlf RxBuf+0,F rlf RxBuf+3,F rlf RxBuf+2,F movlw 0f0h andwf RxBuf+1,F andwf RxBuf+3,F movf RxBuf+1,W ; Store sum at RxBuf+4:5 addwf RxBuf+3,W movwf RxBuf+5 movf RxBuf+0,W btfsc C incf RxBuf+0,W addwf RxBuf+2,W movwf RxBuf+4 goto :Loop TransmitByte clrf Receive ; Zero out the receive buffer bcf DIN btfsc Transmit.7 bsf DIN bsf SCLK btfsc DOUT bsf Receive.7 nop bcf SCLK bcf DIN btfsc Transmit.6 bsf DIN bsf SCLK btfsc DOUT bsf Receive.6 nop bcf SCLK bcf DIN btfsc Transmit.5 bsf DIN bsf SCLK btfsc DOUT bsf Receive.5 nop bcf SCLK bcf DIN btfsc Transmit.4 bsf DIN bsf SCLK btfsc DOUT bsf Receive.4 nop bcf SCLK bcf DIN btfsc Transmit.3 bsf DIN bsf SCLK btfsc DOUT bsf Receive.3 nop bcf SCLK bcf DIN btfsc Transmit.2 bsf DIN bsf SCLK btfsc DOUT bsf Receive.2 nop bcf SCLK bcf DIN btfsc Transmit.1 bsf DIN bsf SCLK btfsc DOUT bsf Receive.1 nop bcf SCLK bcf DIN btfsc Transmit.0 bsf DIN bsf SCLK btfsc DOUT bsf Receive.0 nop bcf SCLK movf Receive,W return ================================================================== Andy Kunz - Montana Design - 409 S 6th St - Phillipsburg, NJ 08865 Hardware & Software for Industry & R/C Hobbies "Go fast, turn right, and keep the wet side down!" ==================================================================