I haven't been working on this project for months so sorry for not answering earlier.

I have updated my webpage because there were still pieces of code or comments that I left during the developpement phase; they have been now removed. Current REMI version is v2-1-2-5.


As already answered
Quote Originally Posted by scalerobotics
It looks like he named it IRM_out, because it is the output of the infra red sensor, so an input on the PIC.
So correct reading is:
IRM_VDD VAR PORTA.0 'IR RX Module's VDD
IRM_Out VAR PORTA.1 'IR RX Module's OUT



Quote Originally Posted by Megahertz
Why in this code IRM_OUT is an output but being used as an input?
For any (to me) unknown reason, there is no need to declare this port as an Input... and it works. I'm always taking care not set ports as inputs to avoid any external noise and while doing this project, I accidentaly noticed that it works like this so I didn't change it up to now.

The port IRM_Out = 1 because the IR Module idles HIGH. Not setting this port to HIGH will make the LEARN: routine start immediately - not waiting for a real incomming signal.



Quote Originally Posted by Megahertz
It is declared that 'factor is a constant =0', then what does this routine do?
"Factorise (time compensation due to BASIC operations latency)". Before using TIMER method to count the elapsed time within a pulse, I used PUSLIN & RCTIME. But PULSIN & RCTIME have a lower accuracy than counting cycles like I do it now.

Previous LEARN routine using PULSIN & RCTIME:
Code:
LEARN:
PULSIN IRM_Out, 0, l_Bit[0]        'wait for first Low pulse to start recording
TOGGLE led0
IF l_Bit[0] = 0 THEN LEARN:
Led0 = 1
RCTIME IRM_Out, 1, h_Bit[0]        'get first High pulse from IR Module
FOR Ctr_A = 1 TO (Max_Bit - 1)
   RCTIME IRM_Out, 0, l_Bit[Ctr_A] 'get Low pulse (1 to 38) from IR Module
   RCTIME IRM_Out, 1, h_Bit[Ctr_A] 'get High pulse (1 to 38) from IR Module
NEXT Ctr_A
RCTIME IRM_Out, 0, l_bit[Max_Bit]  'get last Low pulse from IR Module
RCTIME IRM_Out, 1, H_bit[Max_Bit]  'get last High pulse from IR Module
Led0 = 0
PAUSE 1000                         'wait before continue


Quote Originally Posted by Megahertz
Also it will be much appreciated if someone can explain the following three routines as well, as this purpose is not clear to me
"Rescale values" is ment to make the the result stored in the L_Bit and H_Bit variables equal to real time according to the oscillator used (4, 8 or 20MHz).

"Find the longest H_Bit" is ment to make the full signal pattern repeatable (next version of REMI) but also to cleanup and trim the freshly learned pattern. In LEARNING mode, one sends the command from the original remote continiously until REMI has stored 40 bits. I admit that REMI will always start learning the very first bit of the transmitted pattern. Since the original remote may send the command repetitively, REMI needs to find whitch bit is the longest that this could be most likely the "separator" of a pattern.

"Replace all 'after pattern' bits with value 'zero'" is an optional routine to check the µC's memory. It helped me to have a better view of what had been programmed in the PIC during debug. This routine can be omitted.

HTH