We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
posted on 2014/04/27 07:50:59 PM CEST
Hello to all,
I need on to build a thermo-hygrometer with Sensor AM2321 using the I2C bus with a pic 16f876 using mikroBasic. The datasheet is only in Chinese (?) And trying again and again even though I can not receive data from the sensor. Anyone used it?
Thank you all,
Stefano.
posted on 2014/04/16 05:52:19 PM CEST
In my program I can able to read 3 adc ports simultaneously
but when i read 5 ports simultaneously it does not reads it freezes.in proteous simulation
my code is below............ please help i need it to read 5 ports simultaneously ...
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
char look(int a)
{
switch(a)
{
case 0:
return '0';
case 1:
return '1';
case 2:
return '2';
case 3:
return '3';
case 4:
return '4';
case 5:
return '5';
case 6:
return '6';
case 7:
return '7';
case 8:
return '8';
case 9:
return '9';
default:
return '.';
}
}
unsigned long int vr,vy,vb;
unsigned long int cr,cy;
//unsigned long int j;
char voltr[] = "000";
char volty[] = "000";
char voltb[] = "000";
char curtr[] = "00";
char curty[] = "00";
void get()
{
vr=adc_read(0);
vy=adc_read(1);
vb=adc_read(2);
cr=adc_read(6);
cy=adc_read(7);
}
// End LCD module connections
void calculate_curr()
{
cr=((cr*4.89)*12);
curtr[0] = look(cr/10000);
curtr[1] = look((cr/1000)%10);
}
void calculate_cury()
{
cy=((cy*4.89)*12);
curty[0] = look(cy/10000);
curty[1] = look((cy/1000)%10);
}
void cal_voltr()
{
vr=((vr*4.89)/20)*2020;
voltr[0] = look((vr/100000));
voltr[1] = look((vr/10000)%10);
voltr[2] = look((vr/1000)%10);
}
void cal_volty()
{
vy=((vy*4.89)/20)*2020;
volty[0] = look((vy/100000));
volty[1] = look((vy/10000)%10);
volty[2] = look((vy/1000)%10);
}
void cal_voltb()
{
vb=((vb*4.89)/20)*2020;
voltb[0] = look((vb/100000));
voltb[1] = look((vb/10000)%10);
voltb[2] = look((vb/1000)%10);
}
void dis_volt1()
{
//Lcd_Out_Cp("THREE PHASE VOLT");
Lcd_Out(1,1,"R");
Lcd_Out(1,2,voltr);
}
void dis_volt2()
{
Lcd_Out(1,7,"Y");
Lcd_Out(1,8,volty);
}
void dis_volt3()
{
Lcd_Out(1,13,"B");
Lcd_Out(1,14,voltb);
}
void dis_cur1()
{
//Lcd_Out(1,1,"CURRENT APMS");
Lcd_Out(2,1,"CR=");
Lcd_Out(2,5,curtr);
}
void dis_cur2()
{
Lcd_Out(2,8,"CY=");
Lcd_Out(2,11,curty);
}
void main()
{
TRISA = 0xFF; // ' set PORTA as input
TRISE = 0x07; // ' set RE0 (AN5), RE0 (AN6) and RE2(AN7) as input //' Turn off comparators
TRISD.f0=0xFF;
TRISD.f1=0xFF;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
get();
cal_voltr();
dis_volt1();
cal_volty();
dis_volt2();
cal_voltb();
dis_volt3();
//calculate_curr();
//dis_cur1();
//calculate_cury();
//dis_cur2();
}
}
posted on 2014/02/27 10:52:08 PM CET
posted on 2014/02/24 12:32:14 PM CET
hello,
i want to develop this project with pic18f4550 and MPXV5050GP i facing the problem on programming on i.e. calibrating the sensor so can anyone help me
I used PIN AN0 and AN1 as input signal and LCD pins are connected to D port
posted on 2014/02/23 04:21:06 AM CET
Hello,
I am new to Libstock and the MikroC... I started using it for my senior design project ... my project is about Automatic Irrigation Systems where I use the PIC16877A to control the whole process. I am using the DS18B20 Temperature sensor and the SEN0114 Moisture sensor (http://www.dfrobot.com/wiki/index.php/Moisture_Sensor_(SKU:SEN0114))... There is a problem in the moisture sensor.. it is arduino compatible and I dont know what is arduino... I want some one to help me in creating the the libraries as in how to read and write from the DS18B20 ... also if someone can help me in the SEN0114 problem i would be greatful.
Thanks All,
Hamzah Ghanem