im new here. i would like to ask for programing a PIC16F877A for rpm measurement. the input is from the hall effect sensor which giving a pulse once for each rev. the output is on 16x2 characters LCD display.
the hall effect sensor
the output is a pulse (high to low) once for each rev.
connected on PORTB.0(int/RB0)
the PIC16F877A
using 20MHz crystal.
the LCD
16x2 characters.
data register on PORTD
control register on PORTB.5,6,7
rotary encoder
absolute type
127 position
i write the program in BASIC. now, im stuck on the RPM measurement. i refered on a site that measure RPM using interrupt here. btw, he is using PIC 16f84 and the program writen in C language.
i having difficulties on translate it to BASIC esp on the interrupt part. if u look at the site, the project giving an option to run in 1 ppr(pulse per rev), 6ppr and 60ppr. for my project there is no option for that. only 1ppr.
please give me suggestion or guide especially on the interrupt part.
now, i dont have any idea on the direction detection part.
im using absolute rotary encoder for direction detection. it is a 128 resolution. meaning that it have 128 position detection. each position giving an 8-bit binary.
question is how to scan an 8-bit port and compare it on a 128 data and then, display the output in degree?
now, i dont have any idea on the direction detection part.
im using absolute rotary encoder for direction detection. it is a 128 resolution. meaning that it have 128 position detection. each position giving an 8-bit binary.
question is how to scan an 8-bit port and compare it on a 128 data and then, display the output in degree?
hi,
The table you have posted shows the decimal value for the code converted from binary.
The position is the step by step position from zero of the encoder shaft.
Remember, you have 0 thru 127 steps of the shaft, ie; 128 positions.
The angular measurement you trying to determine is in 360 degrees.
So, 360/128 = 2.8125 degrees per shaft step, as you know the decimal value
of the gray code for each step, multiply by 2.8125 to give the [360] angular position.
OR use a calculator and create a TABLE for the 128 discrete code positions and use the encoder output
as an address to read the Table value from within the PIC program.
the 1st idea might not working bcoz the decimal numbers is not in normal order. i dont see any relation between position 0 and 1, and position 1 and 2, for example.
for the 2nd idea, i dont really get it. but i think creating a table in PIC might work. problem is, i dont know how to write a table of 128 positions in PIC.
i did som reading on it but mostly they show for litle row of data. for 2 bits only. for 8 bits, never seen it on books.