Arduino and max531

Hello, first of all I am not a progammer, but I want to control a 12 bit DAC with arduino uno, and don’t understand how to use SPI comunication…i never used before. This is a code that i write so far for now… if anyone have some ideas os code sample, please do youre magic.

// inslude the SPI library:
#include <SPI.h>

const int slaveSelectPin = 10;  // set pin 10 as the slave select
const int clearpin=9;          //set pin 9   for  clear DAC >> optional
int max_value=4095;             // max  value   for DAC
int min_value=0;                //min value dor DAC
int value;
int AByte = 0;
void setup() {
// set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT); 
  // initialize SPI:
void loop() {
  digitalWrite(clearpin, LOW);
   AByte =;
   if ((AByte == 'W' ) && (value < max_value)) {     //increment DAC
    AByte =;
   if ((AByte == 'S')  && (value >min_value)) {      //decrement DAC
void increment(){
void decrement(){