Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

anyone played with ultrasound before?

Status
Not open for further replies.

hobby_85

Junior Member level 2
Joined
Aug 17, 2009
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,586
ultrasonic pwm

Hey, hope everyones good.

I am currently playing around with some ultrasound transmitters and receivers. Just some basic stuff for now before I attempt a project of mine.

I have no used micro controllers before, so Im still pretty fresh in the area. However, I am willing to learn, and I am currently going through a couple of online tutorials.

For now, I would like to somehow configure the MC (Im using PIC 16f690) to send a PWM signal of 40 KHz to the ultrasonic transmitter. Ive come across this website which does the code for you if you type in the requirements, but I rather start from scratch and understand everything.

This is what the website says:

/*
* PWM registers configuration
* Fosc = 4000000 Hz
* Fpwm = 40000.00 Hz (Requested : 40000 Hz)
* Duty Cycle = 50 %
* Resolution is 6 bits
* Prescaler is 1
* Ensure that your PWM pin is configured as digital output
* see more details on http://www.micro-examples.com/
* this source code is provided 'as is',
* use it at your own risks
*/
PR2 = 0b00011000 ;
T2CON = 0b00000100 ;
CCPR1L = 0b00001100 ;
CCP1CON = 0b00011100 ;

And then I suppose you can use the following commands:

* Pwm_Init()
* Pwm_Change_Duty()
* Pwm_Start()
* Pwm_Stop()

So is this how you go about it? Set your frequency, duty cycle and your off? Can somebody please explain why the website comes up with the above values for PR2,T2CON and so on. And what are they?

Im sorry if this has been posted before, but ive been serching forums for hours on end without luck.

Any help would be appreciated. Just want to send a PWM signal o a ultrasonic transmitter.

Thanks!!!
 

pakitos

Advanced Member level 1
Joined
Nov 14, 2005
Messages
457
Helped
77
Reputation
154
Reaction score
35
Trophy points
1,308
Activity points
3,639
pic ultrasound pwm

why are you using the pic to send the 40 khz?
you can just use a 555 timer to do the job
 

hobby_85

Junior Member level 2
Joined
Aug 17, 2009
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,586
Yes im aware of that. However, creating a 40khz wave using a pic is only a small part of what im trying to do.

Im trying to send RF and ultrasonic pulses together at the same time, and then measure the difference it takes for the two signals to arrive on the other side.

So a 555 wont be able to do this accurately.

From what ive read, I need to use the pwm function of a microcontroller. theres hardly any tutes on this topic, and im finding it extremely difficult to write code for this. Any ideas?
 

pakitos

Advanced Member level 1
Joined
Nov 14, 2005
Messages
457
Helped
77
Reputation
154
Reaction score
35
Trophy points
1,308
Activity points
3,639
are you making your search using that pic no?
 

hobby_85

Junior Member level 2
Joined
Aug 17, 2009
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,586
sorry, what do you mean by pic no?

if you mean how im seperating incoming signals, its through the use of RF. Each rf transmitter will have its unique ID, and my receiver will be talking to one at a time.

is that what you mean?

thanks bud
 

vsmGuy

Advanced Member level 2
Joined
Jun 26, 2006
Messages
503
Helped
44
Reputation
88
Reaction score
15
Trophy points
1,298
Location
VddVss
Activity points
3,888
I just can't see an end to such questions!

Go over to the CCS forum, download the PWMWizard (or even here) and copy paste into CCS IDE and you will be set.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top