Xin chào các bạn, tôi đang cố gắng giao tiếp hx711 adc với pi16f877a.. Tôi đã tìm thấy chương trình C tham chiếu trong biểu dữ liệu cho hx711.. từ đó tôi có thể nhận được các bài đọc thô từ hx711, tôi đang sử dụng trình biên dịch mikroC. câu hỏi của tôi là làm cách nào tôi có thể lấy số đọc này để biểu thị trọng lượng.. có công thức nào không..? và tôi đoán số đọc thô ban đầu khi không tải là giá trị OFFSET mà bạn trừ đi từ các lần đọc tiếp theo để cân bằng vị trí 0.. nhưng khi tôi làm điều đó thì số đọc dao động ở đây và ở đó và sẽ không bằng 0 số đọc.. nhưng khi tôi kết nối thiết lập tương tự với arduino.. số đọc là bình thường và quan trọng nhất là giá trị không tải vẫn ở mức 0 mà không dao động... tôi đang thiếu gì?
Moderation: You must use English text.
Mod:Translated.
Hello guys, I am trying to interface hx711 adc with pi16f877a.. I found the reference C program in the datasheet for the hx711.. from there I can get the raw readings from the hx711, I am Use mikroC compiler. my question is how can i take this reading to represent the weight.. is there any formula..? and I guess the initial raw reading at idle is the OFFSET value that you subtract from subsequent readings to equalize the zero position.. but when I do that the reading fluctuates here and there and there will be zero readings.. but when i connect the same setup to arduino.. the readings are normal and most importantly the no load value stays at zero without fluctuating... what am i missing ?
Moderation: You must use English text.
Mod:Translated.
Hello guys, I am trying to interface hx711 adc with pi16f877a.. I found the reference C program in the datasheet for the hx711.. from there I can get the raw readings from the hx711, I am Use mikroC compiler. my question is how can i take this reading to represent the weight.. is there any formula..? and I guess the initial raw reading at idle is the OFFSET value that you subtract from subsequent readings to equalize the zero position.. but when I do that the reading fluctuates here and there and there will be zero readings.. but when i connect the same setup to arduino.. the readings are normal and most importantly the no load value stays at zero without fluctuating... what am i missing ?
C:
#define THẤP 0
#xác định CAO 1
#xác định ĐẦU VÀO 1
#xác định ĐẦU RA 0
sbit HX711_SCLK tại RB5_bit;
sbit HX711_DOUT tại RB4_bit;
sbit HX711_SCLK_Direction tại TRISB5_bit;
sbit HX711_DOUT_Direction tại TRISB4_bit;
sbit LCD_RS tại RD2_bit;
sbit LCD_EN tại RD3_bit;
sbit LCD_D4 tại RD4_bit;
sbit LCD_D5 tại RD5_bit;
sbit LCD_D6 tại RD6_bit;
sbit LCD_D7 tại RD7_bit;
sbit LCD_RS_Direction tại TRISD2_bit;
sbit LCD_EN_Direction tại TRISD3_bit;
sbit LCD_D4_Direction tại TRISD4_bit;
sbit LCD_D5_Direction tại TRISD5_bit;
sbit LCD_D6_Direction tại TRISD6_bit;
sbit LCD_D7_Direction tại TRISD7_bit;
char txt[10];
nổi read1 = 0;
độ lệch nổi = 0;
phao gram = 0;
phao val1;
phao val2;
int k;
dài không dấu Read_HX711() {
số lượng dài không dấu = 0;
ký tự không dấu i; //, cao nhất = 0, cao hơn = 0, hi = 0, lo = 0;
HX711_DOUT_Direction = ĐẦU RA;
HX711_SCLK_Direction = ĐẦU RA;
HX711_DOUT = 1;
HX711_SCLK = 0;
HX711_DOUT_Direction = ĐẦU VÀO;
while(HX711_DOUT);
for(i = 0; i < 24; i++) { // tăng 128
HX711_SCLK = 1;
đếm <<= 1;
HX711_SCLK = 0;
if(HX711_DOUT)count++;
}
HX711_SCLK = 1;
đếm ^= 0x800000;
HX711_SCLK = 0;
trở lại (đếm);
}
unsigned long readAverage(void) {
tổng gấp đôi = 0;
vì (k = 0; k < 10; k++) {
tổng = tổng + Read_HX711();
}
tổng = tổng /10;
trả lại số tiền;
}
khoảng trống chính(void) {
LCD_Init();
LCD_Cmd(_LCD_CURSOR_OFF);
LCD_Cmd(_LCD_CLEAR);
offset = readAverage();
trong khi (1) {
read1 = readAverage(); // đây là nỗ lực của tôi để số đọc ban đầu ở mức 0
if (bù >= read1) {
val1 = (bù - read1);
gram = val1;
} khác {
val2 = (read1 - offset);
gram = val2;
}///////////////////////////////////////////////// /////////////////////////////
floatToStr_FixLen(gram, txt,6);
LCD_Out(1,4,txt);
//giá trị gram đang dao động
}
}[/MÃ SỐ]
[/TRÍCH DẪN]
Last edited by a moderator: