Serial input & encoding times

Status
Not open for further replies.

jakkeyboy

New Member
I am new to the world of electronics as I am in my 2nd year of my apprenticeship.
For my project I am modifying an RC car and need some help with programming. First I want to read the signal output of my encoder signal and hopefully communicate with my micro controller most likely atmega16 to switch LEDs on and off or typically I could do this on my reciever end. The encoder signal has a start code of 500Hz 75% duty cycle then followed by 1kHz 50% duty cycle.



The second part of the signal has the number of function codes (n) W1
4 - End code
10 - Forward (pulse)
16 - Forward (high lvl)
22 - Turbo
28 - Forward (high lvl) & Left
ect ect.

What would be the best way to read and transpose into my program?

Thanks in advance.
 
If you use the +ve edge to trigger an interrupt or timer you can count the time between edges to get your 500Hz. You then need to count the edges or the start period. Once that is completed a 500us clock will allow you to sample the data.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…