Stingray 3 Ping Demo
In the Stingray Demo using the 3 pings I am curious to know which ping is in which part of the Distance variable. If I stand behind the stingray, facing the front of the robot, I identify Distance[noparse][[/noparse]0] as Right ping, 1 as Center, and 2 as Left. Is this correct?
As a learning exercise I have been converting what I figure I need of the ping object code and the demo ping code into asm. I realized my ping setup is 0-Right, 1-Left, 2-Center. I also don't understand some of the divisions for the ticks of the ping in the stingray demo and simply chose a >> 7 in place of them to see if it would still work. It does! If you notice any errors or bad habits please let me know. I'm really enjoying learning about the Propeller and playing with the Stingray!
As a learning exercise I have been converting what I figure I need of the ping object code and the demo ping code into asm. I realized my ping setup is 0-Right, 1-Left, 2-Center. I also don't understand some of the divisions for the ticks of the ping in the stingray demo and simply chose a >> 7 in place of them to see if it would still work. It does! If you notice any errors or bad habits please let me know. I'm really enjoying learning about the Propeller and playing with the Stingray!
DAT org pings mov t1,#1 ' Configure Pin right side pin 0 andn outa,t1 ' PreSet DataPin LOW or dira,t1 ' Set DataPin to an OUTPUT or outa,t1 ' set HIGH mov time,cnt ' need 2-5 us delay add time,delay waitcnt time,delay andn outa,t1 ' clear pin andn dira,t1 ' set pin to INPUT waitpne :null,t1 ' wait for pin to go HIGH mov cnt1,cnt ' store count waitpeq :null,t1 ' wait for pin to go LOW mov cnt2,cnt ' store count2 sub cnt1,cnt2 ' calculate ping time abs cnt2,cnt1 shr cnt2,#7 mov addr,par wrlong cnt2,addr 'second ping left side pin 1 shl t1,#1 andn outa,t1 or dira,t1 or outa,t1 mov time,cnt add time,delay waitcnt time,delay andn outa,t1 andn dira,t1 waitpne :null,t1 mov cnt1,cnt waitpeq :null,t1 mov cnt2,cnt sub cnt1,cnt2 abs cnt2,cnt1 shr cnt2,#7 add addr,#4 ' move to next long wrlong cnt2,addr 'third ping center pin 2 shl t1,#1 andn outa,t1 or dira,t1 or outa,t1 mov time,cnt ' add time,delay waitcnt time,delay andn outa,t1 andn dira,t1 waitpne :null,t1 mov cnt1,cnt waitpeq :null,t1 mov cnt2,cnt sub cnt1,cnt2 abs cnt2,cnt1 shr cnt2,#7 add addr,#4 ' move to next long wrlong cnt2,addr jmp #pings :null long 0 delay long 160 t1 res 1 cnt1 res 1 cnt2 res 1 addr res 1 time res 1
Comments
I just ran across your ping code in pasm. Looks good. I am going to go try it out. I do also like how fast asm runs.
You seem to have a good handle on it from what I see. Have you been programming in assembler long? I learned on the intel 8080 way back in the mid 1980s, and am just now relearning asm on the propeller. Are you using PASD for debugging or what do you use?
I don't have a stingray, but I am using the MRS1 board and have 3 pings, so the code applies.
Did you find a solution for your IRs? I am working on some for a look down/forward sensor to detect drop offs, curbs and such.
As a hobby, I programmed in x86 assembler for several years, but it has been a few years since I have coded anything, until I stumbled upon the Propeller chip. I always wanted to get into electronics, robotics, and microcontrollers, and this interesting chip gave me the excitement to get started. My programming is very rusty, and things take a while to sink in for me sometimes, but I prefer to program in assembler. It makes more sense to me and is easier for me than other languages. I learned what I know of pasm from the manual and DeSilva's excellent pasm tutorial. I'm still learning more every day.
I do use PASD for debugging and it is a fine tool.
As for the IR, I realized I will have to solder the expensive board to bypass the level translators and I am uncomfortable with this task. When I am more confident in my soldering skills I will give it a go. Hopefully I will get some time for practice this weekend since my XBee's arrived.
This is all new to me but lots of fun!
To test you IR (just be sure that this is what you really need to do if you are going to bypass)·you could bypass the level translators with a small piece of jumper wire. I know this is not a permanent solution, but it should work okay for a test.
A better solution would be to get header (see here - http://www.parallax.com/Store/Components/WireConnection/tabid/151/CategoryID/29/List/0/SortField/0/Level/a/ProductID/487/Default.aspx ) Break off two pins (they are made to do this - notched at each pin). Put it in the place for the holes at the bypass on one or all of the sets. On the underside of the board you could splay (push out) the pins so that it holds nicely in place. On the top side you could use a slide on jumper. All this could be easily removed. When you are more confident, you can permenantly attach it. See pics attached.
Hope this helps!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Whit+
"We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
Post Edited (Whit) : 2/6/2010 2:08:25 PM GMT
I reckon this is what someone, CannibalRobotics I think, did in the IR thread to verify it worked correctly that way.
Thanks for the explanation, pics, and details! I'll add some headers with my next order and try it out.
I picked up a pair of IR detectors last week as well as some emitters. I want to make a small board with some headers for easy connections with one mounting hole. I got access to a circuit board mill, but have to work out the schematics --> drawings -->routing --> dxf.file --> ISOPro --> for milling etc. and the mechanical mounting to allow adjustments. I would like to make something standard that all could use. Any input from all is welcome. If the proto type has support I would get them printed and divide the cost. What Ir detectors emitters do you have and Specs? I'll compare to what I have.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out the Propeller Wiki·and contribute if you can.
Roy, I am not sure really. Then best I could gather is that there may be too much resistance in the translators for the IR to work. I don't think Parallax chimed in, but I know this is an intermediate level bot, and my skills are not at that level, so I don't bother them. You and the other forum members have helped me tremendously with my beginner questions and I am thankful for that!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Check out the new Savage Circuits TV!
·
Do you have a copy of the code that was for the HB25s before it was modified?