SX/B pulsin command
Rsadeika
Posts: 3,837
Not sure how to ask this question.
Example:
· pulsin irpin, 0, irpulse
· if irpulse > 240
····· ' do something
· endif
In this case, at SX28 freq 4_000_000, the 240 value is 2.4 ms (?). Now, will this be affected by a freq change, and if so, does anybody have a handy-dandy formula for comming up with the correct numbers when the freq is changed.
Thanks
Example:
· pulsin irpin, 0, irpulse
· if irpulse > 240
····· ' do something
· endif
In this case, at SX28 freq 4_000_000, the 240 value is 2.4 ms (?). Now, will this be affected by a freq change, and if so, does anybody have a handy-dandy formula for comming up with the correct numbers when the freq is changed.
Thanks
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
In the code below, what I am expecting is, goes to pulsin command sub, times out, turns the LED on and off, and keeps repeating. Now, what is ocurring is that the LED does not turn on, means it never got out of the pulsin sub? I tried it with temp1 = 0, that did not do anything for me. So, I tried pushing a button on the remote, and the LED did turn on. My question is, when the program gets to a pulsin, does the program just hang there until it times itself out, or does it just wait until something occurs on the pin (IR demodulator in this case). I thought I read that their is supposed to be a 50 ms time out.·In my program did I insert something weird.
I just tried it in a stand-alone, and the program works as expected. As soon as I give it power the LED starts to go on and off. Something weird is going on, in stand-alone it works as expected, with SX-key it just hangs there (I hope I did not mess up my board).
Any comments will be appreciated.
Thanks
******code
' =========================================================================
'
'·· File...... Test4.sxb
'·· Purpose... SX/B Programming Template
'·· Author....· Ray Sadeika
'·· E-mail....·
'·· Started...
'·· Updated...
'
' =========================================================================
'
' Program Description
'
'
' Device Settings
'
DEVICE········· SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
'
' IO Pins
'
· irpin var rc.0
· led1 var rb.0
'
' Constants
'
'
' Variables
'
·· temp1 var byte
' =========================================================================
· PROGRAM Start
' =========================================================================
'
' Subroutine declarations
'
·ledon sub
·getsome sub
'
' Program Code
'
Start:
·' PLP_A = %0000
· 'PLP_b = %00000000
· 'PLP_c = %00000000
·' temp1 = 0
Main:
·do
·getsome·· 'Get a pulse reading
·ledon···· 'Turn the LED on/off
·loop
END
GetSome:
·pulsin irpin, 0, temp1
return
ledon:
·TRIS_b = 0
·led1 = 0
·pause 1000
·led1 = 1
·pause 1000
return
The way I have my program setup, the PULSIN command is supposed to time out and move on to the next step, which it does not. Anybody else run into a problem like this.
Any comments will be appreciated.
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax