Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[General] i want to vary the ultrasonic frequency with output of light sensor in pic16f887

Status
Not open for further replies.

jayaprakash jp

Newbie level 3
Joined
Jan 24, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
28
please help me i want a program in which i need to vary the frequency of ultrasonic sensor from the output of proximity or light sensor
 

please help me i want a program in which i need to vary the frequency of ultrasonic sensor from the output of proximity or light sensor
is this possible

char txt[6];
#define TRIG PORTB.F6
#define ECHO PORTB.F7


// LCD module connections
sbit LCD_RS at RA1_bit;
sbit LCD_EN at RA3_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 TRISA1_bit;
sbit LCD_EN_Direction at TRISA3_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;
// End LCD module connections
double distance;
void main() {
INTCON = 0x00; //turn off interrupts
ADRESH = 0x00;
ADRESL = 0x00;
ADCON1 = 0x06; //all inputs are digital
ADCON0 = 0x00;
ADCON1 = 0x06; //all inputs are digital
ADCON0 = 0x00;
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
TRISD = 0x00; //PORTD is output


PORTD = 0x00;

TRISA = 0x00;
PORTA = 0x00;
porta.f2=0;


Lcd_Init(); //Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off



PORTA.F2=0;






TRISB.F6 = 0;
TRISB.F7 = 1;


OPTION_REG.T0CS = 0;
OPTION_REG.PSA = 0;
OPTION_REG.PS0 = 1;
OPTION_REG.PS1 = 1;
OPTION_REG.PS2 = 1;

while(1){

TRIG = 0;
delay_us(10);
TRIG = 1;
delay_us(10);
TRIG = 0;

while(ECHO==0);
TMR0=0;

while(ECHO==1);
distance = (double)TMR0 * 4.352;
wordtostr(distance,txt);
lcd_out(1,6,txt) ;
Delay_ms(500);
Lcd_Cmd(_LCD_CLEAR); // Clear display


}






}
 

Don't see how the code is related to "output of proximity or light sensor" or "frequency of ultrasonic sensor".

What do you mean with "frequency of ultrasonic sensor". Ultrasonic carrier frequency or pulse repetition rate?
 
my aim to vary the frequency from 30khz to 60khz,im using here frequency generator that is crystall oscillator,,then im using colour sensor here if the colour intensity is dark my frequency hav to increse

- - - Updated - - -

my aim to vary the frequency from 30khz to 60khz,im using here frequency generator that is crystall oscillator,,then im using colour sensor here if the colour intensity is dark my frequency hav to increse
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top