PIC JAL IO Routine

MAX520/MAX521 ( 8 bits, 8 channels D/A converter) control routines

by  Alessandro Zummo

--
-- file      : max520.jal
-- author    : Alessandro Zummo <azummo@ita.flashnet.it>
-- date      : 04.07.2000
-- purpose   : MAX520/MAX521 ( 8 bits, 8 channels D/A converter) control routines
-- requires  : i2c
-- pins      : see i2cp
--
-- Copyright (C) 2000 Alessandro Zummo
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Library General Public
-- License as published by the Free Software Foundation; either
-- version 2 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-- Library General Public License for more details.
-- 
-- You should have received a copy of the GNU Library General Public
-- License along with this library; if not, write to the
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- Boston, MA  02111-1307, USA.
--

-- This library has not (yet) been tested by the author. If it works
-- for you, please drop me a note.


-- include the required libraries
include i2c



-- Write <value> to <channel> of the MAX520/MAX521 located at <address>
--
-- Please check the datasheet for further explanations. 


procedure max520_write( byte in address, byte in channel, byte in value ) is

	var byte control = value & 0b_0000_0111 

	i2c_write_2( address, control, value )

end procedure



-- power down

procedure max520_powerdown( byte in address ) is

	i2c_write_1( address, 0b_0000_1000 )

end procedure



-- reset

procedure max520_reset( byte in address ) is

	i2c_write_1( address, 0b_0001_0000 )

end procedure



See: