program code for ATMEGA 32 using ADC, COUNTER and LCD interfacing
kilmont
Posts: 1
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.
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
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.
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.
LCD-Routines are predefined and very simple.
- and of course do it without ADC
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.