Denis Jatsiv

Help with project. How to input IR into HCS12

Discussion created by Denis Jatsiv on Apr 27, 2008
Latest reply on Apr 28, 2008 by Jim Donelson
Hello guys,

I've been working on a project involving a 16 bit hcs12 family chip. I'm still at the early stages and i'm already having problems. The goal of the project is to use a signal from a tv remote to control a PC.

Well, i cant even figure out a way to input the IR signal from the remote into the chip. I initially wanted to make my own circuit, but now i'm using the Dragon12 evaluation board. the remote transmits a serial signal, so i tried using the SCI on the chip. I tried using an external IR receiver and the one on the board. it didnt work. I think the problem is that its made to accept 8 or 9 bits of data plus start, stop bit, but the remote outsputs much more. Not exactly sure how many cause i cant find any specs for it, i think its 12.

does anyone have any ideas or experience doing something like this? my next idea is to try and use an external 16-bit shift register and input that input port A and port B. i'm attaching a code i used to test the signal  using the SCI.

#include "c:\egnu110\include\hcs12.h"
#include "c:\egnu110\include\stdio.c"
#include "c:\egnu110\include\vectors12.h"
#define INTERRUPT __attribute__((interrupt))

void INTERRUPT SCI1_ISR (void);  //SCI1_ISR is a name i made up. not sure
                                 //if i can do that. the examples of other
                                 //interrupts had names like irq_isr, tov_isr,
                                 //tco_isr, paov_isr, etc. i didnt see these
                                 //names in the vertors file, or the hcs12 file
                                 //so i assume you can use any name....
void SCI_initialize ();

unsigned char datalow[20]; //stores 20 bytes of data
unsigned char datahigh[20];
const char *msg = "data read\r";
const char *msg1 = "idle detected\r";
const char *msg2 = "overflow\r";
const char *msg3 = "frame error\r";
int i;

int main (void)
    SCI_initialize ();
    while(1);    //wait for interrupt
    return 0;

void SCI_initialize ()
    UserSCI1 = (unsigned short)&SCI1_ISR;  //used same name as in prototype
    SCI1CR1=0x10;    //9-bit (0x00 for 8-bit), Idle wake (dontcare)
    SCI1CR2=0x34;    //RDRF & IDLE interrupts enabled 0011
                     //TE dis; RE en; Wake-up dis 0100
    SCI1BDH=0x00;    //Select 9600 Baud or dec=163(25mhz)
    SCI1BDL=0x9C;    //0x04 0xE2 for 1200 or dec=1302 (25mhz)

void INTERRUPT SCI1_ISR(void)  //again, same name as prototype

    //while(!(SCI1SR1 & RDRF));
    //while(SCI1SR1_RDRF == 0);

    if (SCI1SR1 & 0x20)     //is RDRF set?
        puts (msg);
    if (SCI1SR1 & 0x10)     //is IDLE set?
        puts (msg1);
    if (SCI1SR1 & 0x08)     //is OR set?
        puts (msg2);
    if (SCI1SR1 & 0x02)     //is FE set?
        puts (msg3);
    puts (datahigh[i]);    //print data & clear flags
    puts (datalow[i]);