This is file HX711HAL.h
This file is part of HX711 routines
/*======================================================================================*/ /* Copyright (c) 2016-2019, Isaac Marino Bavaresco All rights reserved. isaacbavaresco@yahoo.com.br Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*============================================================================*/ /*############################################################################*/ /*############################################################################*/ /* This file is the "Hardware Abstraction Layer" for the HX711 routines. Here you must implement the routines specific for your particular hardware/microcontroller, used by the hardware-independent routines in HX711.c This example file is tailored for Microchip's PIC16Fxxx family using XC8, with pin PDSCK connected to RB4 and pin DOUT connected to RB2. */ /*############################################################################*/ /*############################################################################*/ /*============================================================================*/ #if !defined __HX711HAL_H__ #define __HX711HAL_H__ /*============================================================================*/ #include "htc.h" #include "Delay.h" /*============================================================================*/ /*============================================================================*/ /*============================================================================*/ /*============================================================================*/ #define PDSCK_PORT B #define PDSCK_BIT 4 #define DOUT_PORT B #define DOUT_BIT 2 /*============================================================================*/ /*============================================================================*/ /*============================================================================*/ /*============================================================================*/ #define PASTE2B(a,b) a##b #define PASTE2(a,b) PASTE2B(a,b) #define PASTE3B(a,b,c) a##b##c #define PASTE3(a,b,c) PASTE3B(a,b,c) #define PASTE4B(a,b,c,d) a##b##c##d #define PASTE4(a,b,c,d) PASTE4B(a,b,c,d) #define PASTE5B(a,b,c,d,e) a##b##c##d##e #define PASTE5(a,b,c,d,e) PASTE5B(a,b,c,d,e) /*============================================================================*/ /* This macro creates the expression to access register "TRIS<x>bits.TRIS<x><y>" used below */ #define PDSCK_TRIS PASTE5( TRIS, PDSCK_PORT, bits.TRIS, PDSCK_PORT, PDSCK_BIT ) /* This macro creates the expression to access register "PORT<x>bits.R<x><y>" used below */ #define PDSCK_PIN PASTE5( PORT, PDSCK_PORT, bits.R, PDSCK_PORT, PDSCK_BIT ) #define DOUT_TRIS PASTE5( TRIS, DOUT_PORT, bits.TRIS, DOUT_PORT, DOUT_BIT ) #define DOUT_PIN PASTE5( PORT, DOUT_PORT, bits.R, DOUT_PORT, DOUT_BIT ) /*============================================================================*/ #define SystemYield() (0) #define SystemEnterCritical() (0) #define SystemExitCritical() (0) #define DelayAtLeast100ns() asm( "nop" ) #define DelayAtLeast200ns() asm( "nop" ) #define DelayAtLeast60us() Delay_us( 60 ) #define PDSCKSetAsOutput() (PDSCK_TRIS=0) #define PDSCKSetPin() (PDSCK_PIN=1) #define PDSCKClearPin() (PDSCK_PIN=0) #define PDSCKQueryPin() (PDSCK_PIN) #define DOUTSetAsInput() (DOUT_TRIS=1) #define DOUTQueryPin() (DOUT_PIN) /*============================================================================*/ #endif /* !defined __HX711HAL_H__ */ /*============================================================================*/
file: /Techref/member/IMB-yahoo-J86/HX711HAL.h.htm, 5KB, , updated: 2019/8/19 05:24, local time: 2024/11/22 13:30,
owner: IMB-yahoo-J86,
3.15.31.27: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? <A HREF="http://massmind.org/Techref/member/IMB-yahoo-J86/HX711HAL.h.htm"> <PRE></PRE></A> |
Did you find what you needed? |