I think recording and comparing will work. BUT... here is the catch.. you have to either setup a appropriate timeout time or know the protocol so you can know how long is a signal. Because if you try to just record the data you wont know when it ends since a remote sends HIGH and LOW pulses...
So something like:
TIMER2 = 20ms TIMEOUT
TIMER1 = 10uS time base
You have to start and reset the timer1 for each low and high point.
Make a 2 dimension array like:
HL[2][100];
char count = 0;
#define LOW 0
#define HIGH 1
This will allow you to keep track of HIGHs and LOWs easy...
The main code could be something like
LOOP UNTIL TIMER2 says we hit 20ms
{
reset timer1 and count HIGH portion
HL[LOW][count] = TIMER1 VALUE;
reset timer1 and count HIGH portion
HL[HIGH][count++] = TIMER1 VALUE
}
Well you can see what i mean. This isnt exactly what i would do but its how i would think then refine the final
Its easier to learn the protocol and make a receiver... also will require less RAM and ROM/EEPROM... since you will most likely use ROM or EEPROM to store saved codes..
BTW... Im Jason