can we create 40 kHz with help of atmega 16....

Thread Starter

ambikaush

Joined Jun 2, 2010
2
although i hv been working with controllers since a year but ol was at very small level...such at basic level...its only now i hv got in touch wid concepts of interrupt, timer and pwm....so i may be wrong somewhere and obviously 'll appreciate any help into this....

i want to operate ultrasound transducers for distance measurement purpose...as i got to know dat they work at only 40 kHz...now my problem is dat can v produce this frequency wid the help of atmega16PU...as frequency produced depends on prescaler settings...either u consider overflow operation or compare operation...i m not able to decide dat which way i shall produce this frequency with this microcntrllr...

pls reply as soon as u can...
 

Papabravo

Joined Feb 24, 2006
21,159
although i hv been working with controllers since a year but ol was at very small level...such at basic level...its only now i hv got in touch wid concepts of interrupt, timer and pwm....so i may be wrong somewhere and obviously 'll appreciate any help into this....

i want to operate ultrasound transducers for distance measurement purpose...as i got to know dat they work at only 40 kHz...now my problem is dat can v produce this frequency wid the help of atmega16PU...as frequency produced depends on prescaler settings...either u consider overflow operation or compare operation...i m not able to decide dat which way i shall produce this frequency with this microcntrllr...

pls reply as soon as u can...
I believe that output compare will provide a more capable and flexible approach to generating a 40 kHz. excitation signal.
 

debjit625

Joined Apr 17, 2010
790
You said you know about PWM so go for it only if your MCU have PWM module ,why PWM ? because while the PWM generates the frequency you could work on other stuffs at the same time i.e.. your logical program will executes parallel with PWM.

Good Luck
 

Thread Starter

ambikaush

Joined Jun 2, 2010
2
thanks dear...i hv tried in compare mode and succesfully produced 38 kHz and 40 kHz...(38.6 kHz and 40.1 kHz precisely)
now i have one more problem..it is related to interfacing 16x2 Lcd module with my atmega 16....the development board i m using has following settings for Lcd...
RS->PC0
R/W->PIN31(GND)
E->PC2
DB4-DB7->PC4-PC7
as most of libraries use rw port in dere functn,m in dilemma coz i dunnu have any port to mention for r/w....i have made many chnges in flurry's library but failed in producing some text on ma lcd screen....:(
please help me out with this problem....
 

hgmjr

Joined Jan 28, 2005
9,027
If you are using avrstudio4 and WINAVR as your software development tools then you can use the canned LCD.c, and LCD.h library function it contains.

hgmjr
 
Top