please dont rip this site

PIC JAL IO Routine

MAX127/MAX128 ( 12 bits, 8 channels A/D converter) control routines

by  Alessandro Zummo

--
-- file      : max127.jal
-- author    : Alessandro Zummo <azummo at ita.flashnet.it>
-- date      : 03.07.2000
-- purpose   : MAX127/MAX128 ( 12 bits, 8 channels A/D 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


-- Convert and read <channel> from the MAX127/MAX128 located at <address>
--
-- rng_in and bip_in will be copied to the RNG and BIP bits of the transferred
-- control byte. 
--
-- Result will be pacled in msb and lsb
--
-- Please check the datasheet for further explanations. 


procedure max127_read( byte in address, byte in channel, bit in rng_in, bit in bip_in, byte out msb, byte out lsb ) is

	var byte cnt = 4

	var byte control = 0b_1000_0000

	var bit rng at control : 3
	var bit bip at control : 2

	rng = rng_in
	bip = bip_in
	
	control = control | ( channel << 4)


	i2c_write_1( address, control )

	i2c_read_2( address, msb, lsb )


	-- shift the result right by 4 bits

	lsb = ( msb << 4 ) + ( lsb >> 4 )
	msb = ( msb >> 4 )

end procedure



-- Power down modes, to wake up the chip a call to max127_read should be enough.


-- standby power down

procedure max127_standby( byte in address ) is

	i2c_write_1( address, 0b_1000_0010 )

end procedure


-- full power down

procedure max127_powerdown( byte in address ) is

	i2c_write_1( address, 0b_1000_0011 )

end procedure



See


file: /Techref/piclist/jal/max127128-az.htm, 3KB, , updated: 2003/9/29 23:32, local time: 2024/11/22 01:57,
TOP NEW HELP FIND: 
3.15.186.56:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/piclist/jal/max127128-az.htm"> PIC JAL IO Routine MAX127/MAX128 ( 12 bits, 8 channels A/D converter) control routines</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .