prob w\ ping assm looping
ratronic
Posts: 1,451
I am trying to get this code to loop for my own assm knowledge. I can only make it ping one time. I have looked
through the forums, stickies, and prop manual for direction and have tryed everything I can think·of.
It doesn't have returning values yet, but I will put them in later. I would just like it to loop for now so·it continously pings.·Attached file is commented for what I am attempting. This routine can be called by itself or from a demo routine for now. Please help as I am completely brain dead! I have spent many hours trying to figure this thing out. Thanks Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Ratcliff· N6YEE
through the forums, stickies, and prop manual for direction and have tryed everything I can think·of.
It doesn't have returning values yet, but I will put them in later. I would just like it to loop for now so·it continously pings.·Attached file is commented for what I am attempting. This routine can be called by itself or from a demo routine for now. Please help as I am completely brain dead! I have spent many hours trying to figure this thing out. Thanks Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D RatFix it if ain't broke·
Dave Ratcliff· N6YEE
spin
1K
Comments
1) You don't set the clock mode anywhere or the crystal frequency (_CLKMODE, _XINFREQ). That means it's using RCFAST.
2) The WAITPNE is backwards. You probably mean "waitpne msk,#0" to test for a high and "waitpeq msk,#0" to test for a low.
3) On the WAITCNT, you don't need to put anything other than "#0" in the source field since you're recalculating the delay time each time.
example on the waitcnt, it really helps me to understand the waitcnt better now that I've have correct info from an expert that I trust! But it still doesn't loop. I have tryed it on the demo board and my own dip prop breadboard
using the parallax 7.5v 1amp supply and the power supplys are up to snuff. I have made code that toggles p16 with a waitcnt and it works. There must be one more thing I am missing. I have attached the recent corrected code using your advice.· If you could have one more look at it I would appreciate it!! I have tryed to figure it out before I responded back. It looks as if it should work. I am getting just one blink of the green lite on the ping and one blip on the scope. The green lite on the senor·changes intensity each time I run it depending how close my hand is to sensor. I just can't get it loop continuosly. This is for nothing in particular but for me to gain knowledge in assm and I did look at the code before·I·responded back but now my eyes are crossed!! Thanks for your help, Dave.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE
Instead of:
use this:
Andy
P.S. Thank you·Mike and Ariba for all your help so far! Attached is the latest code I am trying.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE
I guess I didn't really look at what you were trying to do. You're using P0 initially as an output, then looking at it as an input, but you're never switching it back to input mode. The "waitpxx" instructions are looking at the I/O pin, but it's an output and won't change. The waitpne never succeeds since the pin is always a low at that point.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ D Rat
Dave Ratcliff· N6YEE