Libstock prefers package manager

Package Manager

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]

Sort By

USER REQUESTS

first | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 last
tashawar azraf
azraf

posted on 2013/01/16 02:32:57 AM CET

Measurement

ir interfacing with pic16 for rpm counter

i knw its amy b simple but i m new ! and i need a code in mikroc pro ..... for interfacing ir with pic !!

can any i help !!



tanx in advance !!! :)

amir padeshah
aryanaar

posted on 2012/12/14 01:03:59 PM CET

Measurement

ad7190 24-bit adc loadcell

i need a sample code to read loadcell from ad7190 (http://www.analog.com analog device)
i write this code but i dont give result

// LCD module connections
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
//unsigned short read_adc[3] = {0, 0, 0};
unsigned char read_adc[3] = {0, 0, 0}; //araye
char arr[11]={0,0,0,0,0,0,0,0,0} ;
char sum;
char avr;
char i=0 ;
char j=0 ;
char ddd[6];
char rdy ;
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// adc7190 module connections
//sbit Chip_Select at RB2_bit;
//sbit Chip_Select_Direction at TRISB2_bit;
sbit Chip_Select at LATB2_bit;
sbit Chip_Select_Direction at TRISB2_bit;
// End adc7190 module connections
//------------------------------------------------------------------------------
void reset7190(){
Chip_Select = 0 ;
Delay_ms(350);
SPI1_WRITE(0b11111111);
SPI1_WRITE(0b11111111);
SPI1_WRITE(0b11111111);
SPI1_WRITE(0b11111111);
Chip_Select = 1 ;
}
void configurationregister(){
Chip_Select = 0 ;
Delay_ms(350);
SPI1_WRITE(0b00010000) ;//configuration register
SPI1_WRITE(0b00000000) ;//Chop 00 { REFIN1(+) and REFIN1(-) } 0000
SPI1_WRITE(0b00000000) ;//Channel select bits 3taye akhar ya 000 ya 001 ya 010
SPI1_WRITE(0b00010111) ;//Burn REFDET 0 BUF U/B (111 ±39.06 mV )
Chip_Select = 1 ;
}

void moderegister(){
Chip_Select = 0 ;
Delay_ms(350);
SPI1_WRITE(0b00001000) ;// mode register
SPI1_WRITE(0b11101000) ;//(000 Continuous conversion mode / 110 System zero-scale calibration/ 111 full-scale calibration) DAT_STA (10 Internal 4.92 MHz clock ) 00 0b11001000
SPI1_WRITE(0b00000000) ;// SINC3 0 ENPAR 0 Single REJ60
SPI1_WRITE(0b00000000) ;// Filter output data rate select bits.
Chip_Select = 1 ;
}


void moderegister2(){
Chip_Select = 0 ;
Delay_ms(350);
SPI1_WRITE(0b00001000) ;// mode register
SPI1_WRITE(0b00001000) ;
SPI1_WRITE(0b00000000) ;
SPI1_WRITE(0b00000000) ;
Chip_Select = 1 ;
}


void rdy_dataready(){
Chip_Select = 0 ;
Delay_ms(350);
SPI1_WRITE(0b01000000); //status register error ham dare
rdy = SPI1_Read(0);
rdy= rdy & 0b10000000 ;
rdy=rdy>>7 ;
Chip_Select = 1 ;
}


void read7190(){
Chip_Select = 0 ;
Delay_ms(350);
spi1_write(0b01011000); // 01 (011 Data register/data register plus status information ) 0 00
read_adc[0] = SPI1_Read(0);
read_adc[1] = SPI1_Read(0);
read_adc[2] = SPI1_Read(0);
Chip_Select = 1 ;
LongWordToStrWithZeros(read_adc, ddd); //dd=0123456789
}

void bpdsw(){
Chip_Select = 0 ;
Delay_ms(350);
j=40 ; //0b00101000
SPI1_WRITE(j) ;
//j=64 ; //0b01000000
SPI1_WRITE(0b01000000) ;
Chip_Select = 1 ;
}

//------------------------------------------------------------------------------
void InitMain() {

Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"Loadcell test");
Lcd_Out(2,1,"starting...");

Chip_Select = 1; // Deselect DAC
Chip_Select_Direction = 0; // Set CS# pin as Output
//SPI1_Init(); // Initialize SPI module
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
Delay_ms(2000);
}
//------------------------------------------------------------------------------
void main() {

InitMain();

reset7190();
configurationregister();

moderegister();


while (1){

Lcd_Out(2,1,"amir ");

moderegister2();
rdy_dataready();



// if ( rdy=1) {
read7190();
Lcd_Out(1,1,rdy);
Lcd_Out(2,1,read_adc[0]);
Lcd_Out(3,1,read_adc[1]);
Lcd_Out(4,1,ddd);
// }




}
}

Rick O
ricao

posted on 2012/11/27 06:43:57 PM CET

Measurement

Mikromedia for 18FJ or STM32 M4 Wi-Fi projects

Does anyone knows a good project (measurement/wi-fi) to do with any mikromedia mentioned above?

Regards,

Nick Poduska
npoduska

posted on 2012/11/09 10:27:23 AM CET

Measurement

ADC measurement to my PC via UART communication

What I'd like to do is to get a potentiometer reading and look at it live and store it on my PC. I don't even know if this is possible using UART. I've been trying to do this on the EasyPIC7 prototype board with no luck. I'd be open to use another communication method so long as it gets the job done.

kevin lim
keverin

posted on 2012/09/22 07:19:04 AM CEST

Measurement

voltage and frequency

Hi

I need example for voltage , frequency detection example. The current board that i using is ready to go and the controller that i using is pic 16f887 ...

Can any one please help me and advice

first | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 last