I'm trying to control my sony TV with the IR Transmiter.
I Need to send signal for 2.4ms then pause for 0.6ms and then send 1.2ms for Binary-1 or 0.6ms for Binary-0 with a pause of 0.6ms between them.
http://www.zbasic.net/forum/about676.html
I found this topic where there is OutBurst subroutine that i can use as freqout.I searched in documents for a pause subroutine and i noticed that pause and delay subroutines use seconds.And the question is how can I use μS ? Also will OutBurst work for what I wanna do ?
Thanks In Advance
Remote Control Project
Re: Remote Control Project
I don't think that you're going to get the precise timing that you need using a pause/delay strategy. A better approach is to use an external oscillator running at the IR carrier frequency (typically 36KHz to 40KHz) and then use OutputCapture() to generate a pulse stream to modulate (i.e. turn on and off) the carrier frequency. Examples of gated IR oscillators can be found in many places on the Internet including this one.geocool wrote:how can I use μS ? Also will OutBurst work for what I wanna do ?
- Don Kinzer
Remote Control Project
Don-
Back in 2008 you helped me generate a 40Hz signal on pin D.7.
If it can make a 40KHz pulse, that might mean an external source may not be necessary for the IR signal.
Here is the code I used then. Can this method be used at 40KHz?
Tom
On 8/4/2011 12:14 PM, ZBasic wrote:
Back in 2008 you helped me generate a 40Hz signal on pin D.7.
If it can make a 40KHz pulse, that might mean an external source may not be necessary for the IR signal.
Here is the code I used then. Can this method be used at 40KHz?
Tom
Code: Select all
Sub Output40HzOn()
'Turns on 40Hz signal at pin D.7, Divided by 2 for 20Hz in PLD
'Used to pulse Ctone at 20Hz for incoming call ringing
Const T2mode As Byte = bx0001_1111
Register.TCCR2 = 0 'Stop Timer2
Register.TCNT2 = 0
Register.OCR2 = 180 '40Hz=(14745600/1024/20/2)=180
Register.TCCR2 = T2mode 'Start Timer2
End Sub
On 8/4/2011 12:14 PM, ZBasic wrote:
geocool wrote: how can I use μS ? Also will OutBurst work for what I wanna do ? I don't think that you're going to get the precise timing that you need using a pause/delay strategy. A better approach is to use an external oscillator running at the IR carrier frequency (typically 36KHz to 40KHz) and then use OutputCapture() to generate a pulse stream to modulate (i.e. turn on and off) the carrier frequency. Examples of gated IR oscillators can be found in many places on the Internet including this one.
- Don Kinzer
Re: Remote Control Project
Sure. The code below, adapted from yours, will generate a 38.4KHz signal on the OC2A pin. The physical pin corresponding to OC2A varies across devices. It corresponds to D.7 of mega644/mega1284-based devices and appears on pin 25 on the 24-pin ZX devices.twesthoff wrote:Can this method be used at 40KHz?
Code: Select all
Sub Output38KHz()
If Semaphore(Register.Timer2Busy) Then
'Turns on 38.4KHz signal at pin D.7
Const T2modeA As Byte = bx0100_0010 ' toggle OC2A on match
Const T2modeB As Byte = bx0000_0010 ' div by 8
Call PutPin(D.7, 0) ' make OC2A pin an output
Register.TCCR2B = 0 'Stop Timer2
Register.TCNT2 = 0
Register.OCR2A = CByte(14745600\8\38400\2-1)
Register.TCCR2A = T2modeA
Register.TCCR2B = T2modeB 'Start Timer2
End If
EndSub
- Don Kinzer