CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

hx-711 driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
scanan



Joined: 13 Aug 2004
Posts: 59
Location: Turkey

View user's profile Send private message Visit poster's website

hx-711 driver
PostPosted: Tue Mar 24, 2015 2:49 pm     Reply with quote

Hi guies
Any CCS driver for the hx-711 weight sensor module?

thanks
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
necati



Joined: 12 Sep 2003
Posts: 37
Location: istanbul

View user's profile Send private message

hx711
PostPosted: Tue Mar 24, 2015 4:43 pm     Reply with quote

Code:
#include <main.h>
#include <stdio.h>
#ZERO_RAM

#define HX711_DO  PIN_B15
#define HX711_CLK PIN_B14

int32 measurement(void);

void main()
{
int1 test=0;
unsigned int32 Count,BUFFER[30],offseeet=0,mied=0;
unsigned int8 i=0;


while(TRUE){

while(i<10){
Count=measurement();
BUFFER[i]=Count;
mied+=BUFFER[i];
i++;
}
i=0;
mied/=11;

if(test==0){
offseeet=mied;
test=1;
}
//Count=measurement();
mied-=offseeet;
//printf("data=%lu \n\r",Count);
printf("mied=%lu \n\r",mied);
//delay_ms(1);
//printf("\f");
}
}
//********************************************
int32 measurement(void){
unsigned int32 Count;
unsigned int8 i,A_1,A_2,A_3;


output_bit( HX711_DO, 1);
output_bit( HX711_CLK, 0);
Count=0;

while(input(HX711_DO));

for (i=0;i<24;i++){// gain 128
output_bit( HX711_CLK, 1);
Count=Count<<1;
output_bit( HX711_CLK, 0);
if(input(HX711_DO)) Count++;
}
output_bit( HX711_CLK, 1);
Count=Count^0x800000;
output_bit( HX711_CLK, 0);
//************************
A_1=MAKE8(Count, 0);
A_2=MAKE8(Count, 1);
A_3=MAKE8(Count, 2);
A_2=(A_2 & 0b11111000);
Count= MAKE16(A_3, A_2);
return(Count);

}


/*http://www.ebay.com/itm/New-Weighing-Sensor-AD-Module-Dual-channel-24-bit-A-D-Conversion-HX711-Shieding-/400567204760?pt=LH_DefaultDomain_0&hash=item5d43aa7b98

http://www.ebay.com/itm/Electronic-Scale-Sensor-HX711-ADC-Bridge-Weighing-Anti-Jamming-For-Arduino-AVR-/171217937819?pt=LH_DefaultDomain_0&hash=item27dd62659b
*/
scanan



Joined: 13 Aug 2004
Posts: 59
Location: Turkey

View user's profile Send private message Visit poster's website

Re: hx711
PostPosted: Wed Mar 25, 2015 3:02 am     Reply with quote

Many thanks Necati,
Cheers
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group