View previous topic :: View next topic |
Author |
Message |
Joy
Joined: 28 Feb 2009 Posts: 23
|
Posted: Sat May 08, 2010 11:18 am Post subject: getrc5 & sendrc5 |
|
|
Hello Freaks,
i want to send a rc5 code using send rc5 command and receive the same code (retro-reflect) .. that is my application ..
Now, i have successfully sent rc5 code using sendrc5 command & it worked perfectly also i have successfully decoded rc5 command of remote and displayed it on lcd .. (both independently)
so both the things are working perfectly independently, but it doesn't work when i use both togather ..
Connections of my board are
pb0-sensor
pb1-emitter
pc4 & pc5 - active low led
my bascom program is as bwlow :
$regfile = "m8def.dat"
$crystal = 12000000
$lib "mcsbyte.lbx"
'Config Porta = Output
'Config Portb = Output
'Config Portd = Input
'Config Porta.7 = Input
Config Portc = Output
Config Portb.0 = Input
Config Portb.1 = Output
'Config Lcd = 16 * 2
'Config Lcdpin = Pin , Db4 = Pinb.2 , Db5 = Pinb.3 , Db6 = Pinb.4 , Db7 = Pinb.5 , E = Pinb.1 , Rs = Pinb.0
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
Dim S1 As Word
Dim S2 As Word
Dim S3 As Word
'Config Timer1 = Timer , Prescale = 1024
'On Ovf1 Timer1_isr
'Enable Timer1
'Timer1 = &HC2F7
Config Rc5 = Pinb.0
Dim Address As Byte , Command As Byte , Togbit As Byte , Address_send As Byte , Command_send As Byte
Enable Interrupts
Address_send = 0
Command_send = 12
Togbit = 0
Set Portc.4
Set Portc.5
Do
Rc5send Togbit , Address_send , Command_send
Getrc5(address , Command)
Command = Command And &B01111111
If Command = 12 Then
Reset Portc.5
Else
Set Portc.5
End If
Loop
End
so my led(pc5) blinks when i send power button(12) from remote
(so receiver working )
and also , another board of sensor receives command 12 when put ir in front of sensor .. (so ir working)
hope u could understand my problem
Pls reply ..
Thank you |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Sun May 09, 2010 11:56 pm Post subject: |
|
|
What practical purpose does it serve to do this ? After all the processor 'knows' what it sent, so receiving it is redundant.
You must understand that the processor has to take time to generate the pulses to output the Send command. And it also has to take time to receive those pulses with the Get command. Even though processors are fast, they cannot really do two completely separate operations simultaenously. And a retro-reflector is almost instant - how far from receiver to transmitter ? - in time its 3 ns per meter.
If you just want to detect whether the beam is there or not, switch on the transmitter, and then read the detector to see if it detects the IR beam. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
Joy
Joined: 28 Feb 2009 Posts: 23
|
Posted: Mon May 10, 2010 4:12 am Post subject: obstecle detector |
|
|
Thanks for your reply .. actually i want to make modulated high range obstacle detector .. i saw a device working on these project .. for considering time, what should i change in the program ..? |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Mon May 10, 2010 5:32 am Post subject: |
|
|
If you want to use the existing IR transmitter/receiver, then you will need some way of sending and receiving which are totally independent. Two AVR processors, one for each would do this, but it might seem like overkill, unless you used something like ATTiny devices.
Alternately you will have to give up on using modulated devices like the sender/receiver you are using, and just use 'bare' sensors, setting up the modulation yourself using one port pin of a processor, and receiving direct on another port pin. This takes away all the advantage of using the existing sensors, with their built-in modulators and demodulators.
Yet another possibility would be to rewrite either the Send or Get routines to use interrupts and ( probably ) a timer, so the two functions could be done 'at the same time' - actually not quite, but you could achieve that, with a bit of work. I cant help you there, it would be fairly tricky, and depends on knowing how to handle the processor resources exactly. If you are not an expert in tight timing and ASM coding, I would not recommend this. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
Joy
Joined: 28 Feb 2009 Posts: 23
|
Posted: Mon May 10, 2010 6:35 am Post subject: |
|
|
i tried to to use getrc5 command using external interrupt .. it goes to isr when i give input from remote, it doesent decode the code anymore .. |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Mon May 10, 2010 11:58 pm Post subject: |
|
|
No, you cannot just do that.
Since its much easier to write a transmit routine than a receive routine, why dont you try to write a transmit routine which uses interrupts and the timer hardware. Then you have some hope of getting that to work, and also having the existing GETRC routine work together with it.
Personally, I think I would use something like an ATTiny processor to do the transmit, and your main processor to do the receive. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
luizabbadia
Joined: 11 Dec 2007 Posts: 112 Location: rio de janeiro
|
Posted: Fri May 14, 2010 3:06 pm Post subject: |
|
|
Ah , I think I know what you´re talking about!
If I recall there was an old Parallax app that used 555 ci to drive an infrared led aroun 37Khz and receive the signal on the IR receiver because it is calibrated to respond near to this frequency. Upon a variation of the modulation frequency by the 555 to the IR Led a Basic Stamp could reach the distance of an object, but I don´t remember how.
Go to Parallax and do a search on apps. |
|
Back to top |
|
|
|
|
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 You cannot attach files in this forum You cannot download files in this forum
|
|