# a remote control using a pic

Last edited:

#### tumbleweed

##### Active Member
At this point I don't think the language is the problem.

We still haven't heard what the real goal is...
"I want to use a model xxxx remote to control a pic to do yyyy"
or
"I want to turn a pic into a remote control for a model xxxx TV"

The stated goal of "reading the hex values from a tv remote then using an IR led output the same"
doesn't make any sense unless all you're trying to do is make some sort of repeater.

We still don't know the remote type...

#### MrDEB

##### Well-Known Member
the goal is to point the remote control towards the ir receiver then have the pic save it in memory for later use.
that's way I want to extract the hex code from the remote.
I received the Arduino uno as well as two ir key pads and ir receivers.
just waiting for the book on C/C++.
meanwhile searching for examples to decide my next coarse of action.
I wish Swordfish had better support. The old DDIY site had a lot of great information.

#### Pommie

##### Well-Known Member
Other than that, it's WAY beyond your level of expertise
How can you say such a thing, MrDEB has been programming for over 10 years that I know of!

Mike.

#### Visitor

##### Well-Known Member
Descriptions
reading the hex values from a tv remote then using an IR led output the same

the goal is to point the remote control towards the ir receiver then have the pic save it in memory for later use.

You have managed to explain nothing twice using the same words. If you can't explain in simple terms what you are actually trying to accomplish, why should anybody attempt to help you?

I hope your copy&paste programming style will be more useful with the Arduino. But be advised – dumb questions on Arduino forums typically receive the response "RTFM".

#### MrDEB

##### Well-Known Member
off and on but trying to learn by reading this forum. Swordfish is not real descriptive. Hopefully Ardunio is better?
At least I ordered a book to help me understand what I am doing.
As far as what I am trying to do is understand how IR signals work. I want to point the remote at the micro circuit and the pic or amtel circuit will store the hex values in memory for later use

##### Active Member
Exactly which remote are you using ?

#### tumbleweed

##### Active Member
He's already answered that. He's using "the" remote control.

I've only been asking that since post #5 and this is only post#28, so don't get too impatient.

#### Pommie

##### Well-Known Member
This will likely become my new favourite soap.

Mike.

#### Visitor

##### Well-Known Member
...I want to point the remote at the micro circuit and the pic or amtel circuit will store the hex values in memory for later use...

He's already answered that. He's using "the" remote control.

I've only been asking that since post #5 and this is only post#28, so don't get too impatient.

He's already explained exactly what he wants to do three times, using the same mishmash of words. This is about as clear as it ever gets for MrDEB before page 5 of posts, when you finally realize what he's trying to do.

#### Dr_Doggy

##### Well-Known Member
i switched from sword fish to arduino, i find c better since you can get in better with the wrench,

but i wonder Mr , do you ever use serial dumps, i enjoy pc programming most cos i can put breakpoint and add watch anywhere to see where the vars are messin up.
more to the point of having a serial output its not as good but its great to have a serial msg pop up to ensure a sub is being called or to spit out values that need to be watched.

#### ClydeCrashKop

##### Well-Known Member
You will need IRremote.h

C:
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
delay(100);
}

#### MrDEB

##### Well-Known Member
I think I already found that "irremote.h" but thanks.
As for the remote being used, ANY remote can be used. The Adrunio or ?? deciphers the signal and stores it in memory for later use.

#### tumbleweed

##### Active Member
There's a github page that covers a lot of different IR projects at https://github.com/Arduino-IRremote/Arduino-IRremote
Keep us posted on how it goes.

i switched from sword fish to arduino, i find c better since you can get in better with the wrench,
I switched from C to Swordfish. I find Swordfish better since you can get in better with the wrench.

##### Well-Known Member
I have done C code with PIC and IR, from scratch even with examples , data sheets, debug, scope and logic analyiser it took some time . If MrDEB wants to know whats being transmitted from a remote , then use a cheap 8 channel logic analyzer ,with PulseView (SW) it has IR NEC , IR RC-5 and IR RC-6 Protocol decoders.

#### Visitor

##### Well-Known Member
I think I already found that "irremote.h" but thanks.
As for the remote being used, ANY remote can be used. The Adrunio or ?? deciphers the signal and stores it in memory for later use.

Not to flog a dead horse, but no. ANY remote cannot be used. Most IR remotes will work easily, but some have wildly different and unsupported protocols.

The whole question could have easily been settled by a simple statement:

"I want to clone the codes from my LG TV remote so I can create a custom remote that's easier to use." Or whatever. A simple statement that shows you have thought the project through from one end to the other and haven't failed to mention some crucial detail that you'll only reveal after people have wasted hours trying to help you.

Whatever you're attempting to create, I'm pretty sure it's not your ticket to fame and fortune, and there's not somebody in the shadows who is going to steal your brilliant idea.

#### MrDEB

##### Well-Known Member
am I to understand that Swordfish has a module for reading / outputting IR signal?
have searched but zip

#### tumbleweed

##### Active Member
No, not that I'm aware of.

#### Visitor

##### Well-Known Member
Getting Help on a Forum

1. Poster asks a question, preferably with clear, concise details of what he needs help with.

2. People take their own time to respond. Perhaps with some suggestions but often with requests for clarification and more details.

3. Poster is respectful of the time people have spent attempting to help, carefully reads the replies received and provides additional requested information to clarify the ask. Poster does not simply repeat information again that was unclear. Poster should acknowledge replies that people have made, even when they don't fit the narrative he wants to hear.

4. If a large number of replies from people who presumably know more about the subject than the poster are in good agreement, the poster should carefully consider the well-intentioned replies that people have taken their time to write.

5. If people are asking for additional information, don't just regurgitate the same information again and again. If the poster doesn't understand the need for more details, ask why they are needed.

##### Active Member
It might be possible to do what you want (if I am guessing correctly at what you want) using Swordfish.

There is a fundamental issue with measuring raw timing from IR receiver, as the received signal is a slightly distorted reproduction of the original waveform sent by IR remote. Space times are shortened a little and mark times are lengthened a little. If you are lucky, then the distortion will be small enough that you may acheive re-transmission that is good enough.

The first thing to do is prove that your hardware works using the simplest possible test - such as this one:

Code:
// amateur code - use at own risk - author accepts no responsibility for anything, anywhere, ever
// I have used direct-register programming, as it is what I am more familiar with - you may use BASIC style code if you wish
// tested on EasyPIC v7 development board with IR click inserted into mikroBUS 2 socket

Device = 18F43K22
Clock = 8                                 // adjust to suit your setup

// simple IR receiver test - PORTD LEDs reflect IR input status from RA3

// IR input is on RA3 - from 3-pin 38 KHz IR receiver module such as TSOP38338
// IR output is on RC1 - not used here
// LEDs on PORTD.0 and PORTD.1 where D0 mirrors input, D1 is inverted compared to IR input

ANSELA = 0                                // all digital
TRISA = \$ff                               // all input for IR and switches
LATA = 0                                  // all low
ANSELD = 0                                // all digital
TRISD = 0                                 // all output for LEDs
LATD = 1                                  // LED pattern 0x01

Repeat
If PORTA.3 = 1 Then                   // test IR input on RA3
LATD = 1                          // LED on D0 lit if IR input is high (normal state)  , LED on D1 off
Else
LATD = 2                          // LED on D1 lit, LED on D0 off
EndIf
Until false
Let me know when you have this simple test working, and when you fully understand how the code works, and I will explain the next stage of the project.

Last edited:

Replies
1
Views
2K
Replies
0
Views
2K
Replies
2
Views
1K
Replies
9
Views
3K
Replies
4
Views
3K