program code for ATMEGA 32 using ADC, COUNTER and LCD interfacing

edited July 2012 in Learn Vote Up0Vote Down
Hi
I need to make a tachometer displaying the speed of the motor in revolution per second on an LCD for my project. I am using an atmega 32 microcontroller but I am having trouble with the program. I want to program my micro controller using embedded C. Kindly help me out please.
Get the Opto coupler output to the microcontroller through PO1.
Convert analog signal to digital by ADC and count the pulses using COUNTER 0.
Generate 1 second pulse duration using internal TIMER 1.
Perform AND logic between PO1 inputs counted by the COUNTER and the TIMER 1 output.
Count the no. of pulses present in the output of this operation.
Give the digital output to the 8 bit port for the LCD.

Comments

  • 5 Comments sorted by Votes Date Added
  • edited June 2012 Posts: 0Vote Up0Vote Down
    Not saying you won't get any help here but this is a Parallax fourum and as far as I know they have no AVR products. You might have more luck with yor research on the avrfreaks forum or perhaps some Arduino site.
    It also helps if you can present even a small part of your coding attemps for others to comment on. You can't expect people to just do your project for you.
  • edited June 2012 Posts: 0Vote Up0Vote Down
    Well, you have a long way to go if you try to do what you actually propose. It would be a lot simpler to shape the pulses via a Schmitt trigger and avoid the ADC all together. With the ADC out of the way, you could do it all in a Basic Stamp in PBasic. Then, you might find some help in these forums.

    BTW, the Education Forum is about helping you to do your school projects (this is a correction of what I said before), but we really can only focus on so much.Try AVRFreaks as mentioned above.

    It might help to create a schematic and post that. People would easily see that you are making the circuitry right or too complex.

    Divide the program into a main loop that gets the data from the input, converts it into a number, then does the math to output the number. Finally create a sub-routine to start the LCD, and another one to update it about every 1/10 of a second.
    Hwang Xian Shen, Puddleby-on-the-marsh.
    WTF? --- means "Was That Fashion?" Heidi Klum
  • MJBMJB
    edited July 2012 Posts: 0Vote Up0Vote Down
    if you want to use AVR for this you can do it in a few lines of BASCOM Basic http://www.mcselec.com/ have a look at the forums there as well
    LCD-Routines are predefined and very simple.

    - and of course do it without ADC
    http://www.smmu.info (german) Source-Measure-Multiplex-Unit = professional test system for electronic components, sensors, assemblies
  • edited July 2012 Posts: 0Vote Up0Vote Down
    It has been done many times on many devices. The challenge is to clean up the signal from the spark plug coil and have a nice square ware for the microcontroller. I've found some people insert a small coil in line, nearly all use diodes, some DIY a Schmitt trigger from transistors. I'd just use an IC that provides a Schmitt trigger. Maybe a comparator is a better choice than a Schmitt trigger, not sure.

    In high school electronics, I too had to build an automotive tachometer. But in those days, it was all done with analog to be displayed on a milliamp meter calibrated to RPMs.

    Still, it was a similar problem. One had to clean up the 'blip' to use it.
    Hwang Xian Shen, Puddleby-on-the-marsh.
    WTF? --- means "Was That Fashion?" Heidi Klum
Sign In or Register to comment.