Clarify pulsein please

bluejets

Senior Member
In the example code I found, does the W1 register become over written on each loop..??
Code:
main:	pulsin C.3,1,w1		; record the length of a pulse on C.3 into w1
	debug			; report the result
	goto main		; and repeat
 

MartinM57

Moderator
Yes, but it may be overwritten with the same value of course. It would be really odd if it didn't

Why do you ask?
 

Goeytex

Senior Member
W1 will indeed be overwritten on each loop. To see it work, have a second Picaxe send incrementing value pulses to the first.

Code:
[FONT=Courier New]Do 
     for w0 = 1000 to 10000  step 100
     pulsout  c.1,w0
     pause 200
     next
loop   [/FONT]
The pulsin / pulsout values should match assuming both Picaxe's are operating at the same frequency.
 

bluejets

Senior Member
Ok...thanks.....wasn't sure if it needed to be reset.
I couldn't find anything about the need to reset but thought I'd ask just in case.
Thanks again.
 
Top