Jump to content
Sign in to follow this  
jack

pic processor

Recommended Posts

I just wounder  i am going to by a pic 16f84 or some other that can work with irda  but i do not have  time to  do the hack in assambler  and wounder if there is a list over which pic's i can use a c++ and c  kompiler to. And  what the cost is.

and allso some book rekomendationer for a beginer in this field

sorry  maby wrong forum for this questions.

best regards

Jack/sweden

Share this post


Link to post
Share on other sites
Guest Dave

Jack,

supported targets:

 

SX18AC     SX28AC     SX18       SX28       SX48BD     SX52BD     PIC12C508

PIC12C508A PIC12C509  PIC12C509A PIC12CR509APIC12CE518 PIC12CE519 PIC12F629

PIC12C671  PIC12C672  PIC12CE673 PIC12CE674 PIC12F675  PIC16C52   PIC16C54

PIC16CR54  PIC16C55   PIC16C56   PIC16CR56  PIC16C57   PIC16CR57  PIC16C58

PIC16CR58  PIC16C61   PIC16C62   PIC16C62A  PIC16C62B  PIC16CR62  PIC16C63

PIC16C63A  PIC16CR63  PIC16C64   PIC16C64A  PIC16CR64  PIC16C65   PIC16C65A

PIC16C65B  PIC16CR65  PIC16C66   PIC16C67   PIC16C71   PIC16C72   PIC16C72A

PIC16CR72  PIC16F72   PIC16C73   PIC16F73   PIC16C73A  PIC16C73B  PIC16C74

PIC16F74   PIC16C74A  PIC16C74B  PIC16C76   PIC16F76   PIC16C77   PIC16F77

PIC16F83   PIC16CR83  PIC16C84   PIC16F84   PIC16F84A  PIC16CR84  PIC16F87

PIC16F88   PIC16C505  PIC16C620  PIC16C620A PIC16CR620APIC16C621  PIC16C621A

PIC16C622  PIC16C622A PIC16CE623 PIC16CE624 PIC16CE625 PIC16F627  PIC16F627A

PIC16F628  PIC16F628A PIC16F630  PIC16C641  PIC16C642  PIC16F648A PIC16C661

PIC16C662  PIC16F676  PIC16C710  PIC16C711  PIC16C712  PIC16C715  PIC16C716

PIC16C717  PIC16F737  PIC16C745  PIC16F747  PIC16C765  PIC16F767  PIC16C770

PIC16C771  PIC16C773  PIC16C774  PIC16F777  PIC16F818  PIC16F819  PIC16F870

PIC16F871  PIC16F872  PIC16F873  PIC16F873A PIC16F874  PIC16F874A PIC16F876

PIC16F876A PIC16F877  PIC16F877A PIC16C923  PIC16C924

 

Cost is available from the registration page:

http://www.picant.com/c2c/register.html

 

Regards

Dave

Share this post


Link to post
Share on other sites

Hi Jack,

 

Snatched the following from my hd - it should decode ir remote controls - not what you're after and indeed c2c doesn't support unions and structures but you may be able to get it working.

 

If not I'm sure someone else will...

 

 

>>snip

 

Re: RC5 Code to ascii

 

 

--------------------------------------------------------------------------------

 

This is full code to reactive all of IR codes.

 

#include <16F84A.H>

#fuses HS,NOPROTECT,NOWDT

#use delay(clock=12000000)

#include

#define BUT PIN_A2

#DEFINE RED_LED PIN_A0

#define IR_SENSOR PIN_B0

#define RED_ON output_high(RED_LED)

#define RED_OFF output_low(RED_LED)

#define IR (!input(IR_SENSOR))

 

typedef struct

{

int8 bajt[6];

int8 std;

} int48;

 

int48 code;

 

pulse()

{

output_high(RED_LED);

delay_ms(200);

output_low(RED_LED);

}

 

int1 get_ir(void)

{

int16 tmp;

int t,t4,j,i,k,ofset;

short bit;

set_timer0(0);

while(IR==1);

t=get_timer0(); //RC-5 -> t=30-60

//Sony -> t=98-128

//NEC80 & REC80 -> t=155-185

tmp=0;

//NEC80 & REC80

if (code.std<2)

{

if (t>155) if (t<185);

else return (0);

if (code.std==0) ofset=5;

else ofset=3;

while(IR==0);

set_timer0(0);

while(IR==1);

t=get_timer0();

t=t*2;

t4=t*2;

for (i=0;i<((code.std==0) ? 48 : 32);i++)

{

set_timer0(0);

while(IR==0)

{

j=get_timer0();

if (j>t4) return (0);

}

k=ofset-(i/8);

code.bajt[k]<<=1;

if (j>t) code.bajt[k]++;

while(IR==1);

}

}

else

//RC-5

if (code.std==2)

{

if (t>30) if (t<60);

else return;

for (i=0;i<13;i++)

{

bit=IR;

set_timer0(0);

while (IR==bit)

{

j=get_timer0();

if (j>60) return (0);

}

tmp<<=1;

if (bit==0) tmp++;

set_timer0(0);

while (get_timer0()<53);

}

tmp=tmp | 0x3000; // add start bits

tmp=tmp & 0x37ff; // cut togle bit

}

//Sony-12 Sony-15

else

{

if (t>98) if (t<128);

else return;

for (i=0;i<((code.std==3) ? 15 : 12);i++)

{

set_timer0(0);

while(IR==0)

{

t=get_timer0();

if (t>100) return (0);

}

t=t+15;

set_timer0(0);

while(IR==1)

{

j=get_timer0();

if (t>100) return (0);

}

tmp<<=1;

if (j>t) tmp++;

}

}

 

if (code.std>1)

{

code.bajt[0]=tmp & 0xff;

tmp>>=8;

code.bajt[1]=tmp & 0xff;

}

 

//display code

lcd_putc("\f");

if (code.std<2)

{

if (code.std==0) printf(lcd_putc,"R80:\%X\%X",code.bajt[5],code.bajt[4]);

else lcd_putc("N80:");

printf(lcd_putc,"\%X\%X",code.bajt[3],code.bajt[2]);

}

else if (code.std==2) lcd_putc("RC5:");

else if (code.std==3) lcd_putc("S15:");

else lcd_putc("S12:");

printf(lcd_putc,"\%X\%X",code.bajt[1],code.bajt[0]);

pulse();

return (1);

}

 

 

#int_ext

interrupt()

{

get_ir();

}

 

recognize_code()

{

pulse();

disable_interrupts(int_ext);

code.std=0;

while(get_ir()==0)

{

delay_ms(100);

code.std++;

if (code.std>4) code.std=0;

while (IR==0);

}

pulse();

enable_interrupts(int_ext);

}

 

main()

{

lcd_init();

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_64);

enable_interrupts(global|int_ext);

ext_int_edge(H_TO_L);

printf(lcd_putc,"\fOK");

while(1) if (input(BUT)==0) {pulse();recognize_code();}

}

 

Device: SFH506XX or TSOP17XX

where xx-frequency (recommended 38)

You must connect out pin from IR device to PIN_B0.

Share this post


Link to post
Share on other sites
Guest Jack

:) Thank  you for a quick replay  then i know what i can by probably i will com back with more question when i started my project

Thanks alot

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...