94 Ohms coil resistance
5K Ohm resistor @ 5V = 1mA
Pin No. | Symbol | Function |
---|---|---|
1 | Vdd | Supply (2.7 to 5.5V) |
2 | CS | Chip Select |
3 | SCK | Serial Clock Input |
4 | SDI | Serial Data Input |
5 | LDAC | Sync input |
6 | SHDN | Hardware shutdown |
7 | AVss | Analog ground |
8 | VoutA | DACa Output |
PIC Assembly Code
SPIclk macro BSF PORTC,SCK BCF PORTC,SCK endm ;Setup direction BCF TRISB,RB1 ; RB1 as Output BCF TRISC,SCL ; SDO as Output BCF TRISC,SDA ; SCK as Output ;Set initial pin states BSF PORTB,RB1 ;Chip Select, active low BCF PORTC,SCK BCF PORTC,SDO myloop movlw 0xF0 movwf DAC,A movlw 0x00 movwf DAC+1,A CALL SPIclkout CALL Delay goto myloop ; ================= ; === Functions === ; ================= SPIclkout BCF PORTB,RB1 ; Clear CS (Active low) BCF PORTC,SDO ; 0 SPIclk SPIclk SPIclk BSF PORTC,SDO ; 1 SPIclk MOVLW 0x08 MOVWF Temp,A SPIloop BTFSS DAC,7 BCF PORTC,SDO ; 0 BTFSC DAC,7 BSF PORTC,SDO ; 1 SPIclk RLNCF DAC,F,A DECFSZ Temp,F,A goto SPIloop MOVLW 0x04 SPIloop2 BTFSS DAC+1,7 BCF PORTC,SDO ; 0 BTFSC DAC+1,7 BSF PORTC,SDO ; 1 SPIclk RLNCF DAC+1,F,A DECFSZ Temp,F,A goto SPIloop2 RLNCF DAC+1,F,A RLNCF DAC+1,F,A RLNCF DAC+1,F,A RLNCF DAC+1,F,A BSF PORTB,RB1 ; Set CS high return