Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IR LIBRARY
07-01-2014, 10:07 AM,
#21
RE: IR LIBRARY
Quote:dkmorb
i will try the files your have attached.
thank you
fred

Hey derf158,
In detail I have:
1) Removed the use of classes (IRemote.h);
2) Renamed the methods of the classes according to the naming convention you used in IRemote.c (IRemote.h);
3) Correct functions names (IRemote.c);
4) Fixed errors compilations of data from variable "i" in "for" loops (IRemote.c)

I got closer to the problems caused by interrupts...

Bye.
Reply
08-01-2014, 03:39 AM, (This post was last modified: 08-01-2014, 03:44 AM by derf158.)
#22
RE: IR LIBRARY
(07-01-2014, 10:07 AM)dkmorb Wrote:
Quote:dkmorb
i will try the files your have attached.
thank you
fred

Hey derf158,
In detail I have:
1) Removed the use of classes (IRemote.h);
2) Renamed the methods of the classes according to the naming convention you used in IRemote.c (IRemote.h);
3) Correct functions names (IRemote.c);
4) Fixed errors compilations of data from variable "i" in "for" loops (IRemote.c)

I got closer to the problems caused by interrupts...

Bye.
dkmorb
have you looked at the IRremoteint.h file i attached previously. i do not know how to change this into pinguino form
// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define IR_USE_TIMER1 // tx = pin 11
//define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
//#define IR_USE_TIMER5 // tx = pin 46

thanks
fred


Attached Files
.h   IRremoteInt.h (Size: 14.04 KB / Downloads: 2)
Reply
08-01-2014, 01:05 PM,
#23
RE: IR LIBRARY
Quote:dkmorb
have you looked at the IRremoteint.h file i attached previously. i do not know how to change this into pinguino form
// Arduino Mega
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define IR_USE_TIMER1 // tx = pin 11
//define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
//#define IR_USE_TIMER5 // tx = pin 46

thanks
fred

Uuu-laa-laa...we need to study ATmega models pins cofiguration and map it to picXXXXXX configuration, according to model we want to use.

I would start from base line pic18fxxxx...
Bye.
Reply
08-01-2014, 03:45 PM,
#24
RE: IR LIBRARY
All supported PIC18F have at least Timer 0, 1, 2 and 3.
So you can use one of them but have in mind that :
- Timer 0 is used by the millis library
- Timer 1 is used by the servo library
- Timer 2 is used by the PWM library
- Timer 3 is used by the DCF77 and the (new) stepper library.
As far as I understand the IRremote library, it uses Timer to output a PWM signal so you don't have to worry about Timers, just include the PWM library : #include <pwm.c> and use :
- PWM_setFrequency(u32 freq) to set the signal's frequency
- PWM_setDutyCycle(u8 pin, u16 duty) or PWM_setPercentDutyCycle(u8 pin, u8 percent) to set the duty cycle. pin can be defined as CCP1 or CCP2 (CCP4 to CCP10 on 47J53 based Pinguino). See pin.h for all Pinguino pin definition.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
08-01-2014, 09:46 PM,
#25
RE: IR LIBRARY
(08-01-2014, 03:45 PM)regis Wrote: All supported PIC18F have at least Timer 0, 1, 2 and 3.
So you can use one of them but have in mind that :
- Timer 0 is used by the millis library
- Timer 1 is used by the servo library
- Timer 2 is used by the PWM library
- Timer 3 is used by the DCF77 and the (new) stepper library.
As far as I understand the IRremote library, it uses Timer to output a PWM signal so you don't have to worry about Timers, just include the PWM library : #include <pwm.c> and use :
- PWM_setFrequency(u32 freq) to set the signal's frequency
- PWM_setDutyCycle(u8 pin, u16 duty) or PWM_setPercentDutyCycle(u8 pin, u8 percent) to set the duty cycle. pin can be defined as CCP1 or CCP2 (CCP4 to CCP10 on 47J53 based Pinguino). See pin.h for all Pinguino pin definition.
REGIS,
I will try that.thank you
Reply
15-01-2014, 04:16 AM,
#26
RE: IR LIBRARY
(08-01-2014, 09:46 PM)derf158 Wrote:
(08-01-2014, 03:45 PM)regis Wrote: All supported PIC18F have at least Timer 0, 1, 2 and 3.
So you can use one of them but have in mind that :
- Timer 0 is used by the millis library
- Timer 1 is used by the servo library
- Timer 2 is used by the PWM library
- Timer 3 is used by the DCF77 and the (new) stepper library.
As far as I understand the IRremote library, it uses Timer to output a PWM signal so you don't have to worry about Timers, just include the PWM library : #include <pwm.c> and use :
- PWM_setFrequency(u32 freq) to set the signal's frequency
- PWM_setDutyCycle(u8 pin, u16 duty) or PWM_setPercentDutyCycle(u8 pin, u8 percent) to set the duty cycle. pin can be defined as CCP1 or CCP2 (CCP4 to CCP10 on 47J53 based Pinguino). See pin.h for all Pinguino pin definition.
REGIS,
I will try that.thank you

regis
where would i put this #include <pwm.c>
PWM_setFrequency(u32 freq) to set the signal's frequency
- PWM_setDutyCycle(u8 pin, u16 duty) or PWM_setPercentDutyCycle(u8 pin, u8 percent) in IRremote.h?
thanks
fred
Reply
15-01-2014, 09:50 AM,
#27
RE: IR LIBRARY
(15-01-2014, 04:16 AM)derf158 Wrote: where would i put this #include <pwm.c>
in IRremote.c with other includes.

(15-01-2014, 04:16 AM)derf158 Wrote: - PWM_setFrequency(u32 freq) to set the signal's frequency
- PWM_setDutyCycle(u8 pin, u16 duty) or PWM_setPercentDutyCycle(u8 pin, u8 percent)
If I'm right, theses PWM functions should replace the whole interrupt code but let us see your work first.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
17-01-2014, 01:11 AM, (This post was last modified: 17-01-2014, 01:13 AM by derf158.)
#28
RE: IR LIBRARY
(15-01-2014, 09:50 AM)regis Wrote:
(15-01-2014, 04:16 AM)derf158 Wrote: where would i put this #include <pwm.c>
in IRremote.c with other includes.

(15-01-2014, 04:16 AM)derf158 Wrote: - PWM_setFrequency(u32 freq) to set the signal's frequency
- PWM_setDutyCycle(u8 pin, u16 duty) or PWM_setPercentDutyCycle(u8 pin, u8 percent)
If I'm right, theses PWM functions should replace the whole interrupt code but let us see your work first.

regis
attached is the IRremoteInt.h file highlighted in PDF MS word would not attach . i believe the highlighted areas should be deleted and insert pwm.c

would this be changed - #if defined(arduino) && arduino >= 100
#include <arduino.h>

to this- #if defined(pinguino) && pinguino >= 100
#include <pinguino.h>

thank in advance

fred


Attached Files
.pdf   IRremoteInthighlighted.pdf (Size: 82.92 KB / Downloads: 5)
Reply
17-01-2014, 09:20 AM,
#29
RE: IR LIBRARY
You can delete most of the lines in this file :
- all the lines about timers
- all the lines about the led
Send me your files (.h but also .c) and I will clean them for you.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
18-01-2014, 02:53 AM, (This post was last modified: 18-01-2014, 02:06 PM by derf158.)
#30
RE: IR LIBRARY
(17-01-2014, 09:20 AM)regis Wrote: You can delete most of the lines in this file :
- all the lines about timers
- all the lines about the led
Send me your files (.h but also .c) and I will clean them for you.
Regis,
i have attached the IRremote.c and IRremote.h files
i will begin the cleanup on the IRremoteInt.h
thank you
fred

(18-01-2014, 02:53 AM)derf158 Wrote:
(17-01-2014, 09:20 AM)regis Wrote: You can delete most of the lines in this file :
- all the lines about timers
- all the lines about the led
Send me your files (.h but also .c) and I will clean them for you.
Regis,
i have attached the IRremote.c and IRremote.h files
i will begin the cleanup on the IRremoteInt.h
thank you
fred

regis,
i deleted the timers and led lines of code. also i modified a few lines as you will see in the PDF file.

thank you

fred


Attached Files
.c   IRremote.c (Size: 29.01 KB / Downloads: 7)
.h   IRremote.h (Size: 4.02 KB / Downloads: 5)
.pdf   IRremoteInt.h marked up.pdf (Size: 5.6 KB / Downloads: 6)
.h   IRremoteInt.h (Size: 5.03 KB / Downloads: 4)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)