Author Topic: programming with BASIC ATOM software?  (Read 10096 times)

0 Members and 1 Guest are viewing this topic.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
programming with BASIC ATOM software?
« on: February 04, 2008, 12:07:56 PM »
does anybody have any experice with this software http://www.basicmicro.com/ViewPage.aspx?ContentCode=d_basicatom?

I just got the Atom Bot Board II from Lynxmotion and this is the software.
I have experiance with Parallax software, but can't seem to simply program a few servos :-[.

Bane
« Last Edit: February 04, 2008, 12:09:03 PM by BANE »

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #1 on: February 04, 2008, 12:32:37 PM »
The programming language looks pretty much the same.
But what is your actual problem?

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #2 on: February 05, 2008, 05:04:14 PM »
I tried coping the code straight in and it didn't recognize it.  It says ' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM5} at the beginning.  I have the Bot Board II with the BASIC ABB 28 pin.
I can seem to find out what the right "beginning thing" (very technical term ;D) that  will work with the chip

bane

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #3 on: February 05, 2008, 05:09:34 PM »
if by "basic ABB 28 pin" you mean basic atom (pro), then of course your code isn't a BASIC Stamp code!
These directives: {$STAMP BS2}, {$PBASIC 2.5} are all for BS2 programs: they tell the Basic stamp compiler what kind of language to compile.

Try to compile after removing these, then check your settings for the communication with the MCU.

Please post your code here, so we can all see.

Also, you should probably ask on lynxmotion forum about that stuff, because that's where the experts on the topic are ;)

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #4 on: February 06, 2008, 06:31:18 PM »
Hows this, i got it from the forum but it still has the "BS2". ???
will this work?  Im going to try it right now
' {$STAMP BS2}
' {$PBASIC 2.5}

counter VAR Word
PINx PIN 5         'Pin 5 uesed, change this number to the pin you want to use.


DO

  FOR counter = 400 TO 728 STEP 5 '<change the step number to make servo move faster
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 728 TO 1000 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 1000 TO 728 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 728 TO 400 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

LOOP

Bane

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Re: programming with BASIC ATOM software?
« Reply #5 on: February 07, 2008, 01:03:04 AM »
First of all in the code sample you gave has a small mistake!!!

  FOR counter = 1000 TO 728 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

  FOR counter = 728 TO 400 STEP 5
    PULSOUT pinx,counter
    PAUSE 20
  NEXT

There you need a negative step!!!
So you better have STEP -5
Else you would see the servo just running from one side to another while ramping
when opposite...

If you program atom in basic there is only a simple change in names of commands...
Just see the datasheet!!! :P

Cheers,
Lefteris, Greece
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #6 on: February 08, 2008, 04:03:48 PM »
Wait, are you sure you've got a BASIC Atom and not a BASIC stamp? if yes then why did you post in the Bot Board & BASIC Stamp 2 section of the lynxmotion forum?
That's probably why they didn't correct the BS2 directives...

Anyway the code looks pretty much right, and you can remove the BS2 directives ' {$STAMP BS2} and ' {$PBASIC 2.5} . Anyways, the language for BASIC Atoms and BASIC stamps is pretty much the same, except a few things (for example you don't need a colon when you declare a label, and for the Atom Pro, the Pulsout command uses .5us timings instead of 1us (basic atom) or 2us (BS2). So to send a 1.5ms pulse (center position for the servo), you would write
pulsout pin, 3000     'on the Atom pro
instead of
pulsout pin. 1500     'on the Atom, or
pulsout pin. 750      'on the BS2

so you would have to multiply all the numbers in the FOR statements by four to get the right pulses (on the Atom pro) or by two on the BASIC Atom.

But the guys on the lynx forum have said pretty much all of it (BTW Robot Dude is the owner of Lynxmotion, and Acidtech works for basicmicro, the company which makes BASIC Atom chips)

good luck!

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #7 on: February 08, 2008, 04:09:16 PM »
and BTW, here is a link to the links for the manuals (first choose Atom or Atom Pro, and, also, tell use which one you use!) in pdf, which you should definitely have a look at: http://www.basicmicro.com/ViewPage.aspx?ContentCode=Downloads

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #8 on: February 08, 2008, 05:03:10 PM »
it here: http://www.lynxmotion.com/Product.aspx?productID=269&CategoryID=66

check out pic

is this right?  ............ errors

bane
« Last Edit: February 08, 2008, 05:08:34 PM by BANE »

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #9 on: February 09, 2008, 04:34:11 AM »
ok so first of all, your microcontroller is a BASIC Atom, not an Atom pro, so the timings in the pulsout commands are in 1us units, so you only have to multiply by two your values, for instance, you have to change
FOR counter = 400 TO 728 STEP 5
to
FOR counter = 800 TO 1456 STEP 10

you'll have to do the same thing with the other FORs

The error the compiler complains about is that the PIN command doesn't exist in BASIC Atom language, so you have to replace it with CON (for the BS2, it's actually the same command I think). So you have to change
pinx PIN 5
to
pinx CON 5   'or whatever pin number you are using instead of 5

If you add these modifications, the code should work.

Another thing you might want to add is a label to your main program, but it is not necessary. If you want to call the label 'Start', you would just write 'Start' one line above the beginning of the program (i.e. before the DO command)

I hope it'll work, and I especially hope the connection with the Atom will work as well, because I had a lot of pain finding a working usb to serial cable...

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #10 on: February 09, 2008, 07:58:01 AM »
Hey thanks for your help bietz, i've asked alot of people and they didn't catch that :D.   However, i redid every thing the way you said and it still has one error :-[.    check out pic.  I still must be doing something wrong.

I think that my usb to serial cable is fine because it show a connection has been established in the program and the three lights on the Bot Board II turn off too.

bane

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #11 on: February 09, 2008, 08:35:22 AM »
oh right that's something I didn't know... it's DO ... WHILE, not DO ... LOOP. So just change your LOOP at the end with a WHILE. I hope it doesn't need a condition after the while. If it gives you an error, just add 'true' after WHILE (hope it works, but I'm not sure about it)

For the serial cable, I also had the connection working, but it only didn't work when it tried to send the program to the chip... Hope it will work for you

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #12 on: February 09, 2008, 08:51:54 AM »
Hmmm.  it still doesn't like the "while" and i tried the "true" but still nothing :-\.

heres the coding for it, im trying some of the other things on there

http://www.basicmicro.com/Product.aspx?productID=72&CategoryID=1

bane

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #13 on: February 09, 2008, 09:04:57 AM »
oh check this out,  i just got it from the help menu

DO
......
WHILE 1=1 ??

bane

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #14 on: February 09, 2008, 09:23:21 AM »
Yep that'll work. A While loop will execute what is in it as long as the expression you write after WHILE is true.

For instance, if you write WHILE IN1 = 1, it will loop the content of the DO...WHILE while the input of pin 1 is 1 (ie about 5V), so it will exit the loop code as soon as IN1 becomes 0. So if you write an expression that is always true (such as TRUE, 1, 1=1, 2>1 or whatever), the loop will execute infinitely.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #15 on: February 09, 2008, 12:20:41 PM »
Everything went OK in the program but my servo is not moving still?   I have the right pin selected and everything... i think.

see pics

do i have something hooked up wrong? ???

bane

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #16 on: February 09, 2008, 12:39:54 PM »
Try to short the VS=VL jumper (next to the power headers). What that does is it will use the same battery you hooked up to the VL header both for logic and servos, so that you don't need to use a second battery for servos alone. And since you're using VS for the servo ports, you need a VS in the circuit, which you don't have for the moment since there is no battery attached to VS and the VS=VL jumper isn't shorted.

I hope that'll solve it

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: programming with BASIC ATOM software?
« Reply #17 on: February 09, 2008, 01:07:29 PM »
in the manual, the DO WHILE commands execute when the WHILE condition is false.

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #18 on: February 09, 2008, 01:11:52 PM »
in the manual, the DO WHILE commands execute when the WHILE condition is false.

No, that wouldn't make sense! You might be talking about the DO ... UNTIL, which exits the loop when the condition becomes true (it executes UNTIL it becomes true)

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: programming with BASIC ATOM software?
« Reply #19 on: February 09, 2008, 01:31:57 PM »
Here is it copied and pasted from the manual:

Quote
DO..WHILE - Repeat a group of commands while expression is false.

also see:

Quote
WHILE...WEND - Repeat a group of commands while expression is true.

unless the manual is wrong?

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #20 on: February 09, 2008, 01:48:25 PM »
Well, that's what I see on the latest BASIC Atom manual:
Quote
DO... WHILE
Repeats a set of instructions as long as a given condition remains
true (i.e. until the given condition becomes false).
The condition is tested after the instructions have been executed.

and

WHILE... WEND
Repeats a set of instructions as long as a given condition remains
true (i.e. until the given condition becomes false).
The condition is tested before the instructions are been executed.

finally

REPEAT... UNTIL
Repeats a set of instructions until a given condition becomes true (i.e.
as long as the condition remains false).
The condition is tested after the instructions have been executed.


The only difference between DO WHILE and WHILE WEND is whether the expression is evaluated before or after execution.
So you might have an old copy with an error    :P

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #21 on: February 09, 2008, 02:32:25 PM »
I don't know how old this is, but look at what is says about Do While.
http://www.basicmicro.com/Product.aspx?productID=72&CategoryID=1

bane

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: programming with BASIC ATOM software?
« Reply #22 on: February 09, 2008, 02:34:26 PM »
The reference comes from the link in this reply, i presumed that this was the command set that Bane was using (its the command set in relation to the product on sale), maybe you confused which language command set is actually being used

Quote
Hmmm.  it still doesn't like the "while" and i tried the "true" but still nothing .

heres the coding for it, im trying some of the other things on there

http://www.basicmicro.com/Product.aspx?productID=72&CategoryID=1

bane

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: programming with BASIC ATOM software?
« Reply #23 on: February 09, 2008, 02:42:46 PM »
further to this,

 The web page that shows that command executing while the condition is false has a link to a manual where it states:

Do...While
Do statements While some expression is true
Repeat a group of commands while expression is true

. There seems to be a major conflict going on there somewhere

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #24 on: February 09, 2008, 04:59:13 PM »
Well, let's just not care about the errors on the website. It just has to execute while the expression is true. That's how it works in every single language, from C/C++/java to all embedded languages including BS2 and whatever.

Bane, did you try shorting the VS=VL jumper as I told you here?

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #25 on: February 09, 2008, 07:00:01 PM »
Sorry for response time, had to go out :P.   I just tried it with the VS = VL and still nothing!
I've got some questions though on what i should have shorted.

>speaker shorted (but not used)
>VS = VL shorted
>servo bus = VS
>all LEDS shorted

Also, is there anyway to check that my computer is comunicating with the Microcontroller?
When I compile a program is it supposed to start rigth away?
Do i have to do something (ex. press button) for the program to start once downloaded?
Is there a set up you have to do before programming?

(my trying anything :D)

Bane
« Last Edit: February 09, 2008, 07:12:49 PM by BANE »

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #26 on: February 10, 2008, 06:47:54 AM »
well, once your code is ready, you press the 'program' or the 'debug' button and then it shouldn't complain about any errors and run directly.
Could you take a screenshot after compilation? (with any dialog boxes that appeared and the build log visible) Because maybe you've got some errors but didn't realize it.

Offline BANETopic starter

  • Supreme Robot
  • *****
  • Posts: 639
  • Helpful? 4
  • E=roboticsC^2
Re: programming with BASIC ATOM software?
« Reply #27 on: February 10, 2008, 11:22:48 AM »
Quote
counter var word

START:

FOR counter = 1 TO 150
    PULSOUT p4, 1500
    PAUSE 20
  NEXT
 

FOR counter = 1 TO 150
    PULSOUT p4, 750
  NEXT   

GOTO START
END

no errors showing, but the servo just vibrates back and forth.........?????

bane

Offline bietz

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: programming with BASIC ATOM software?
« Reply #28 on: February 10, 2008, 01:56:16 PM »
Add a PAUSE 20 after the PULSOUT in the second FOR loop, as in the first one. If you don't pause a bit between pulses, the pulses come so fast one after the other that they look like a single and too long HIGH pulse, and the servo of course doesn't understand that.

I could be wrong, but I think that should be the problem  ;)

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: programming with BASIC ATOM software?
« Reply #29 on: February 10, 2008, 02:15:17 PM »
are you sure its Pulsout p4,1500 and not pulsout p4,150
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here

data_list