CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Decodeder to Remote with Manchester

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

Decodeder to Remote with Manchester
PostPosted: Fri Oct 06, 2006 5:58 am     Reply with quote

Decodeder to Remote with Manchester..
I have problems with my code..
decode a remote with HT6P20D...


My code to recive the codifier of remote control...
but have problems... i don t know why...
Code:


#include <16F628A.h>
#fuses NOWDT,INTRC_IO, NOPUT, NOPROTECT, NOBROWNOUT, NOMCLR, NOLVP, NOCPD
#use delay(clock=4000000)
//********************

#define CS_LCD PIN_B3
#define RS_LCD PIN_B2
#define D4_LCD PIN_B4
#define D5_LCD PIN_B5
#define D6_LCD PIN_B6
#define D7_LCD PIN_B7

#include <LCD_16x2LIB>
//********************
unsigned int time1,time2,i,tot,z,t2,t1;
byte cod1,cod2,cod3;
int32 codif;
float float_seconds;
byte edge_flag;

#INT_EXT      // inicio do interrupt ****************
void ext_isr()
{
  if (edge_flag==1)
  {            //do l_to_h things
    time2=get_timer0();                 //pega o tempo do nivel baixo , ou seja em 0 (time 2)
    set_timer0(0);
    i++;

tot=time1+time2;
    if (( tot <20 ) || ( tot >65 ))
   {

//zera variaveis!!
      codif=0;
      i=0;
      edge_flag = 3;         //set flag, so l_to_h code is executed in interrupt
      ext_int_edge(l_to_h);
    }
    else
    {

        edge_flag = 0;
    ext_int_edge(h_to_l);

    if (time1<time2)  //se verdadeiro , bit=1
    {

        codif = codif << 1;
        codif = codif + 1;
    }
    else
    {
        codif = codif << 1;
    }

      if (i==24)
      {

          printf(exibe_lcd,"\f codif%lu",codif);
//zera variaveis!!
          codif=0;
          i=0;
          edge_flag = 3;         //set flag, so l_to_h code is executed in interrupt
          ext_int_edge(l_to_h);
      }

  }
  }

  else
  if (edge_flag==0)        //TERCEIRO INTERRUPT

  {            //...do h_to_l things
      time1=get_timer0();                 //pega o tempo do nivel alto , ou seja em 1 (time 1)
      set_timer0(0);
      edge_flag = 1;
      ext_int_edge(l_to_h);



  }
  else  //if (edge_flag==3)   //PRIMEIRO INTERRUPT
  {
      set_timer0(0);
      edge_flag = 0;
      ext_int_edge(h_to_l);
  }
}


void main()
{
   codif=0;
   i=0;
   edge_flag = 3;

   ini_lcd_16x2();

   setup_timer_0(RTCC_INTERNAL | RTCC_DIV_32);

   output_low(PIN_a0);

   printf(exibe_lcd,"\f START..");   //exibe o texto na tela!
   delay_ms( 1000 );
   edge_flag = 3;         //set flag, so l_to_h code is executed in interrupt
   enable_interrupts(global);
   enable_interrupts(INT_EXT);
   ext_int_edge(l_to_h);
   set_timer0(0);


   while (TRUE)
   {

   }
}



_________________
Vlew
Charles Santos


Last edited by dos_santos_rj on Sat Oct 07, 2006 5:27 pm; edited 3 times in total
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Fri Oct 06, 2006 10:43 pm     Reply with quote

HELP

Please!
_________________
Vlew
Charles Santos
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Sat Oct 07, 2006 3:55 pm     Reply with quote

in this code have a delay in time..


but i dont know how to correct it

HELP!
_________________
Vlew
Charles Santos
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 07, 2006 5:12 pm     Reply with quote

Your code was not posted correctly. Notice the line shown in bold below.
Quote:
tot=time1+time2;
if (( tot <30>55 ))
{

This happened because HTML is enabled for your post.

You need to edit your post. Delete all the code in your original post.
Then post in the correct code from your program. But this time,
when you post it, make sure that you select the "Disable HTML" box.
It's just below the posting window. It looks like this:

Quote:
x Disable HTML in this post



Also, give a more detailed explanation of what you expect your code
to do, and then explain in detail what it's currently doing, and why it
is not correct.
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Sat Oct 07, 2006 5:26 pm     Reply with quote

i edit my first post....

The problem is:

The time T of my remote controle is = 45

But I need to put :
if (( tot <20>65 ))
//more then 10% of erro


if I put
if (( tot <35>55 ))
//don t works... doing this, don t recieve a valid bit

i think have a big delay in my code...
but i don t know where and why...

****
i'm a brazilian...
sorry for my mistakes in the english
_________________
Vlew
Charles Santos
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Mon Oct 09, 2006 6:01 am     Reply with quote

i edit my first post....

The problem is:

The time T of my remote controle is = 45
[code]
But I need to put :

if (( tot <20 ) || ( tot >65 ))
//more then 10% of erro


if I put

if (( tot <35 ) || ( tot >55))
//don t works... doing this, don t recieve a valid bit
[/code]
i think have a big delay in my code...
but i don t know where and why...

****
i'm a brazilian...
sorry for my mistakes in the english[/code]
_________________
Vlew
Charles Santos
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 09, 2006 1:16 pm     Reply with quote

Study the CCS driver for decoding a TV remote control.
Here is the file location:
c:\program files\picc\drivers\n9085ud.c
Quote:

// Library for the N9085UD VCR / TV remote
// Note: This driver uses timer one to decode a signal.
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 3:35 pm     Reply with quote

PCM programmer wrote:
Study the CCS driver for decoding a TV remote control.
Here is the file location:
c:\program files\picc\drivers\n9085ud.c
Quote:

// Library for the N9085UD VCR / TV remote
// Note: This driver uses timer one to decode a signal.


Thank for your help

I study this lib....

i need to modify some things in this lib.

i don t undestand , the part in the lib of width_buffer ....

what i need to put in width_buffer ? and in TIMER_RATE?
_________________
Vlew
Charles Santos
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 4:00 pm     Reply with quote

I think width_buffer is just an internal buffer used by the driver.

I don't know anything the N9085UD.C driver. CCS doesn't provide an
example program that shows how to use the driver. I did a search with
Google for some of the functions in the driver, and found this page in
the Google cache.
http://209.85.129.104/search?q=cache:_gsPjmdKRNoJ:www.datadynamics.co.jp/ccs/robotics_tutorial.pdf

Look about 2/3 of the way down that page, at Sections 14 and 15.
There is sample code that calls the driver.
dos_santos_rj



Joined: 19 Sep 2006
Posts: 10

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 4:11 pm     Reply with quote

PCM programmer wrote:
I think width_buffer is just an internal buffer used by the driver.

I don't know anything the N9085UD.C driver. CCS doesn't provide an
example program that shows how to use the driver. I did a search with
Google for some of the functions in the driver, and found this page in
the Google cache.
http://209.85.129.104/search?q=cache:_gsPjmdKRNoJ:www.datadynamics.co.jp/ccs/robotics_tutorial.pdf

Look about 2/3 of the way down that page, at Sections 14 and 15.
There is sample code that calls the driver.


I looked this sample code....

My code in my first post function, but little wrong ..
i think have a delay, and recieve a codifier erro!
_________________
Vlew
Charles Santos
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 10, 2006 4:35 pm     Reply with quote

I can't offer any more help, because I haven't done a remote control
project and I don't have any more time to spend on it.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group