Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 30th May 2009, 01:19 PM   #16
Default

Thanks guys. Good info'.

Is it important to measure the actual active-low portion of the signal or could you simply measure the time between active-low leading edges?

Attached Thumbnails
Sony IR decode using hi-tech C for PIC16F877A-sony-sirc.png  

Last edited by Mike, K8LH; 30th May 2009 at 06:43 PM.
Mike, K8LH is offline  
Old 30th May 2009, 01:38 PM   #17
Default

Quote:
Originally Posted by Mike, K8LH View Post
Thanks guys. Good info'.

Is it important to measure the actual active-low portion of the signal or could you simply measure the time from active-low leading edge to active-low leading edge?
It's important to measure the actual active-low time of each pulse, bear in mind it's not just a question of reading SIRC's, it's a question of rejecting all other types of IR signal.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 30th May 2009, 01:54 PM   #18
Default

Knowing this info its real easy to create your own IR Protocol.

I think ill make one today. Ill call it AIRP or AIRC.

AtomSoft InfraRed Protocol
AtomSoft InfraRed Control

lol. Would be fun to do but would require a custom remote
AtomSoft is offline  
Old 30th May 2009, 03:11 PM   #19
Default

Jason,

I agree but one of the interesting aspects of this research is that I could use one of these very inexpensive "universal remotes" as the control head for some of my projects. There would be more unique key codes than I could ever possibly use.

Nigel,

Thank you for supplementing Pommie's and AtomSoft's excellent examples. I'd like to develop a simpler GetBit routine that qualifies each SIRC bit. Then I could decode the 12 bit style SIRC codes with a very simple routine like this;

Code:
;
;  the GetBit "blocking" sub' only returns on a valid SIRC bit
;
;    C = 1 for a valid <start> bit
;    C = 0 and Z = 1 for a '0' bit
;    C = 0 and Z = 0 for a '1' bit
;
GetSIRC
        call    GetBit          ; a qualified <start> bit?        |B0
        bnc     GetSIRC         ; no, branch, else                |B0
        clrf    irCmd           ; clear 'irCmd' variable          |B0
        bsf     irCmd,6         ; set counter bit for 7 bits      |B0
CmdLoop call    GetBit          ; get <data> bit in Z (C=0)       |B0
        skpz                    ; bit = 0? yes, skip, else        |B0
        bsf     irCmd,7         ; bit = 1                         |B0
        rrf     irCmd,F         ; collected all 7 'Cmd' bits?     |B0
        bnc     CmdLoop         ; no, branch, else                |B0
        clrf    irDev           ; clear 'irDev' variable          |B0
        bsf     irDev,4         ; set counter bit for 5 bits      |B0
DevLoop call    GetBit          ; get <data> bit in Z (C=0)       |B0
        skpz                    ; bit = 0? yes, skip, else        |B0
        bsf     irDev,5         ; bit = 1                         |B0
        rrf     irDev,F         ; collected all 5 'Dev' bits?     |B0
        bnc     DevLoop         ; no, branch, else                |B0
        return                  ;                                 |B0
I'm not sure a "blocking" type subsystem like this will work in most of my projects though so I think I might also research ways to make this a background task.

Thanks again for all the info' guys.

Mike

Last edited by Mike, K8LH; 30th May 2009 at 03:14 PM.
Mike, K8LH is offline  
Old 30th May 2009, 03:46 PM   #20
Default

A good while back someone emailed me an interrupt driven version of my original receiver code, I meant to add it to my tutorials, but forgot all about it - and can't seem to find it any more.

I'll keep looking.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 30th May 2009, 04:01 PM   #21
Default

GetBit command would be simple. I would do the same as i did in C which was just wait for a Low or TRIGGER on low then count up until its high then calculate how long it took by reading the count variable. You should know how to do this already lol
AtomSoft is offline  
Old 30th May 2009, 04:27 PM   #22
Default

My code is exactly the same as yours Jason. I'm just having fun trying to make it a bit tighter, cleaner, simpler, and more elegant using assembler (my specialty, grin)...
Mike, K8LH is offline  
Old 30th May 2009, 04:41 PM   #23
Default

heh cool! I would love to see it when your done.
AtomSoft is offline  
Old 30th May 2009, 06:38 PM   #24
Default

FYI, found a C project with interrupt driven SIRC decoder as a background task which seems reasonably well done (using Interrupt on Change);

PIC RGB Power board with Infrared remote control

Last edited by Mike, K8LH; 30th May 2009 at 07:54 PM.
Mike, K8LH is offline  
Old 30th May 2009, 07:26 PM   #25
Default

To do SIRC in as background wouldnt be hard with my code. All you have to do is setup a interrupt and have it do the same code as in my "GetSIRC" function. Once you copy my code to the interrupt then you should be able to collect data like that. Just remove the first wait for low. Since it will interrupt on low anyway.
AtomSoft is offline  
Old 30th May 2009, 07:27 PM   #26
Default

ill try to create it in a minute. With a RBG LED with PWM just like that link just my own code
AtomSoft is offline  
Old 30th May 2009, 07:38 PM   #27
Default

Oh don't worry, I know how to unroll functions to make them work as part of an ISR (LOL).
Mike, K8LH is offline  
Old 30th May 2009, 07:42 PM   #28
Default

heh, i know your one smart dude. You correct me on a daily basis and im grateful. LOL
AtomSoft is offline  
Reply

Tags
decode, hitech, pica, sony

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Which IR protocal is easier to decode, Sony SIRC or Philips RC5 blueroomelectronics Micro Controllers 5 14th January 2008 01:17 AM
How to decode.... arustu Electronic Projects Design/Ideas/Reviews 5 1st August 2006 10:44 AM
bs2pe read decode egg0900 Micro Controllers 3 20th June 2005 11:06 PM
IR (Encode and Decode signals) Bella Micro Controllers 0 27th October 2003 06:46 AM



All times are GMT. The time now is 04:58 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker