Increase your Embedded skills with our new online classes (from Just Rs750/-) for details click here

Archive

Posts Tagged ‘load cell interface with microcontroller c code’

LOAD CELL BASED PRODUCT CHEKING SYSTEM

May 12th, 2010 Comments off

DSC00095DSC00097PIC16F877A C CODE:
DSC00096op07 Amplifier Circuit


#include<pic16f877a.h>
 #fuses HS,NOWDT,NOLVP,NOPROTECT
 #use delay(clock=20000000)
 #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)

void main()
 {
 unsigned char load_cell_var;

setup_port_A(ALL_ANALOG);
 setup_adc(ADC_CLOCK_INTERNAL);
 output_c(0x01);
 // printf("Welcome To PC based Weight Scale System \n");
 // delay_ms(1000);

while(TRUE)
 {

set_adc_channel(0);
 delay_us(100);
 load_cell_var=READ_ADC();
 printf("\r Digital value=%u\r\n",load_cell_var);

if((load_cell_var>=76)&&(load_cell_var<=77))
 {
 output_c(0x01);
 printf("PRODUCT IS GOOD");
 delay_ms(1500);

}

else
 {
 output_c(0x00);
 printf("PRODUCT IS DEFECT ");
 delay_ms(1500);
 output_c(0x01);
 }
 }
 }