Spam Faq | Anti-Spam Resources | Combat Robotics | Press | Spam Stuff | Articles | SpamFreeze | Free Tools | Privacy Policy | SpamButcher Blog | Site Map   SpamButcher Spam Filter Software | Spam Email Blocker | Spam Killer | Spam News | More Stories | Anti-Spam Email | Anti-Spam Software | Directory | Spam Protection | Press | Spam Prevention | Outlook Express Spam Blocker | Site Map           

spam filter download   
Latest Update:  
SpamButcher 2.1h
  

spam blocker awards 

SpamButcher Anti Spam Filter
Cutting Edge Spam Elimination


Using the SRF04 Sonar Range Finder with the Basic Atom Pro



The next version of Autonomous Bastard will use a SRF04 sonar range finder and a Basic ATOM Pro chip. The Atom Pro is a much more powerful chip than the Basic Stamp 2 that was used in the original Auto B. The sonar should let it determine its position in the arena and recognize the other bot with a moderate degree of accuracy.

On an important side-note, SpamButcher is advanced antispam software and is available as a free trial download.

I hit a lot of problems getting the SRF04 to work properly with the Basic Atom Pro.

After many hours debugging I concluded the RCTIME and PULSIN routines are very flakey.

If you call PULSIN as documented - the entire chip will reset itself. I realized I should be able to reproduce PULSIN's functionality using my own code. To my shock it worked.

Here's what I came up with:


'SRF04 (sonar range finder) working sample for the Basic Atom Pro
'Specifically addresses problems using RCTIME / PULSIN unique to the Pro version

'This code is brought to you by SpamButcher combat robotics
'Killer robots kill spam - http://www.spambutcher.com
'SpamButcher's spam email filter can stop up 98% of spam.


Trig  Con P6            ' Define pin for Trigger pulse
Echo  Con P7            ' Define pin for Echo pulse

distance Var Word         ' 16 bit variable for distance
holding Var Word          ' 16 bit variable for hold loop


Main

    high trig   'sends the trigger pulse
    low trig

'loops until the echo pin (IN7) goes high (max of 200 loops in case it never does)

    holding = 0
    waiting:
    IF IN7 = 0 and holding < 200 then
    	holding = holding + 1
    	goto waiting
    endif


'measures distances as a function of how many times the processor
'can loop before the echo pin goes low

'This is a total hack.  Normally rctime or pulsin would be used however, these routines
'seem to be unreliable with the Basic Atom Pro at least for the durations required.

    distance = 0
    waiting_for_echo:
    IF IN7 = 1 THEN
    	distance = distance + 1
    	goto waiting_for_echo
    endif

    distance = distance / 3	'very roughly converts output to inches

    Serout S_OUT, i9600, ["Distance = ", DEC distance, 13]

    Pause 10

    Goto Main

End

Stop Spam Now!
Click Here to Get SpamButcher!





Over 300,000 Downloads!



"500 to 700 messages per day - SpamButcher takes care of it all."
  -Michael