PDA

View Full Version : Resolved! How to collect ir pulse streams in asm?



ratronic
09-18-2007, 03:30 AM
The code that is attached does work , but the seven bit·data stream, the way I am collecting it, is inverted and I have to·xor it for proper display. I have been looking in the prop manuel but I can't see any thing there that would let me·collect them non inverted in the first place.·Am I missing something? Could one of you look at the code and tell me if there is a better way to collect the stream? And also if there is something that I should be doing different? This is just for personal education!! Thanks Dave.·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Fix it if ain't broke·
D Rat


Dave Ratcliff· N6YEE

Post Edited (ratronic) : 9/18/2007 3:11:05 PM GMT

deSilva
09-18-2007, 04:24 AM
Some remarks:
(1) All special registers are zero when a COG starts, so you need not clear pin0.
If complex I/O settings must be used just define a LONG and move it onto DIRA. I suspect you do not want to disturb other COGs... Never mind! DIRA is your own personal copy! only a "1" is valid and "written through"

(2) You should write sub t2, t1 rather than subs t2, t1 to be more clear in what you do; however SUBS performs the same computation as SUB, just the carry is set differently and you do not use it...

(3) For the same reason CMPS is more confusing than CMP in this context, but will work of course..

(4)


if_c jmp #loop2
jmp #loop1
loop2

is generally coded as:


if_nc jmp #loop1



(4) This looks very strange:


if_c rcr rn, #1
if_nc rcr rn, #1



(5) You shift a bit (=carry) whenever a pulse is between 32_000 and 64_000 ticks. When you change the parameters of CMPS the carry will be set, when the pulse is >64_000 ticks - that simple! So just:


CMP d, t2 wc
RCR rn, #1


will do the trick - I think http://forums.parallax.com/images/smilies/smile.gif

Post Edited (deSilva) : 9/17/2007 8:29:33 PM GMT

ratronic
09-18-2007, 04:32 AM
That's what I did!! I had the compare backwards. I just went brain dead and could not see it!! Thank you very much for all of your help Desilva!!!

Dave.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Fix it if ain't broke·
D Rat


Dave Ratcliff· N6YEE

ratronic
09-18-2007, 05:40 AM
Here is the code with all of Desilva's points put in and taken out.·· Dave.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Fix it if ain't broke·
D Rat


Dave Ratcliff· N6YEE