Hello,
I'm building a IR remote control based on Bruce's information (http://www.rentron.com/Infrared_Communication.htm).
The IR link (hardware) works fine but I can't get the communication between both PICs working since I'm not familiar with the SERIN2 command.
To go on step-by-step, I don't use the IR system for the moment and "wired" both PICs together (via a 1k2 resistor).
The "emitter" PIC sends continuously this "ABCD1234efgh5678" string and this works fine. The (shortened) code in the "emitter" PIC is:
Code:
MAIN:
SEROUT2 D_Out, 49548, ["ABCD1234efgh5678", 13]
GOTO MAIN
END
The "receiver" PIC is setup to receive (
) the string and send it out to a Serial Terminal (currently for testing purpose).
Based on the PBP "SER2MOD" example, the "receiver" code looks like this and should make the program wait for the "A" character to be received and read the seven next characters:
Code:
' Fuses PIC12F675
@ DEVICE XT_OSC ;Xtal 4MHz
@ DEVICE WDT_OFF
@ DEVICE PWRT_OFF
@ DEVICE MCLR_OFF
@ DEVICE BOD_OFF
@ DEVICE PROTECT_OFF
@ DEVICE CPD_OFF
CMCON = %00000111 'Comparator is OFF
ANSEL = %00000000 'Disable analog inputs
OPTION_REG = %10000000 'GPIO Pull-Ups disabled
INTCON = %00000000 'All Interrupts disabled
GPIO = %00000000 'Ports Levels
TRISIO = %00001000 'Ports Directions
D_Out VAR GPIO.2 'Serial Data Out
D_In VAR GPIO.3 'Serial Data In
D_Data VAR byte[8]'Serial Data
MAIN:
SERIN2 D_In, 49548, [WAIT("A"), STR D_Data\7]
SEROUT2 D_Out, 49548,[STR D_Data\7, 13, 10]
GOTO MAIN
END
Problem: it seems I don't get anything into the receiver PIC or at least, this is what I feel since the Serial Terminal stays blank.
NB: 49548 is the data mode: 2400bauds, Open, Inverted, No Parity.
Bookmarks