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

Discussion in 'Embedded Systems and Microcontrollers' started by ambikaush, Jul 13, 2010.

  1. ambikaush

    Thread Starter New Member

    Jun 2, 2010
    2
    0
    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...
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,145
    1,791
    I believe that output compare will provide a more capable and flexible approach to generating a 40 kHz. excitation signal.
     
  3. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    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
     
  4. ambikaush

    Thread Starter New Member

    Jun 2, 2010
    2
    0
    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....
     
  5. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Here is a link to a fairly comprehensive treatise on HD44780 based LCD interfacing.

    hgmjr
     
  6. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    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
     
Loading...