BasicATOM Pro 24-m

6 views
Skip to first unread message

jgeidl

unread,
Nov 19, 2009, 5:54:54 PM11/19/09
to HomeBrew Robotics Club
Is anyone using these chips or their brothers and sisters from Basic
Micro? I bought one mostly because of the hardware PWM channels and
the availability of floating point math. Now that I have it the
documentation for the user does not appear to be very current. I keep
running into things that are not current. I'd sure like to hookup
with someone else more experienced with the chips.

Thanks,

Jim, K6JMG

Alan Marconett

unread,
Nov 19, 2009, 6:38:51 PM11/19/09
to hbrob...@googlegroups.com
Hi Jim,

I have the 28-pin AtomBasic and AtomBasicPro chips. The documentation on
the 'pro is probably the best maintained, the others are behind. Check the
LM or BM forums for comments on the particular commands you are having
trouble with.

I used the AtomBasic on my "Creepy Hybrid" (Servo Magazine, 2009) and the
'Pro in my current quadruped project. Far from an expert.

Alan KM6VV

Nathaniel Lewis

unread,
Nov 19, 2009, 7:58:53 PM11/19/09
to hbrob...@googlegroups.com
I don't have its programming environment, but does it contain a command list
in the help file like in the BASIC Stamp environment?
Nathaniel
--

You received this message because you are subscribed to the Google Groups
"HomeBrew Robotics Club" group.
To post to this group, send email to hbrob...@googlegroups.com.
To unsubscribe from this group, send email to
hbrobotics+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/hbrobotics?hl=.


Alan Marconett

unread,
Nov 19, 2009, 8:16:45 PM11/19/09
to hbrob...@googlegroups.com
There is a review of the commands in the manual which is accessed by the
help command.

http://basicmicro.com/downloads/docs/atompro_8000.pdf

James M.(Jim) Geidl

unread,
Nov 19, 2009, 9:34:24 PM11/19/09
to hbrob...@googlegroups.com
Thanks, Alan. I have the Pro 24 and really want it to work but am pretty
frustrated. It appears you have to bounce back and forth between their
Basic variant and assembler. I worked in assembler for about 27 minutes
about 30 years ago and promptly lost interest.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


> From: Alan Marconett [mailto:KM...@SBCGLOBAL.NET]
> Sent: Thursday, November 19, 2009 3:39 PM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] BasicATOM Pro 24-m
>

James M.(Jim) Geidl

unread,
Nov 19, 2009, 9:38:37 PM11/19/09
to hbrob...@googlegroups.com
Nathaniel,

I have the manual but, truthfully, I haven't spent much time in the help
file. Maybe the help file is more current.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


James M.(Jim) Geidl

unread,
Nov 19, 2009, 9:39:48 PM11/19/09
to hbrob...@googlegroups.com
Thanks, Alan, I have the manual but it appears to be incomplete and kind of
dated.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


> From: Alan Marconett [mailto:KM...@SBCGLOBAL.NET]
> Sent: Thursday, November 19, 2009 5:17 PM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] BasicATOM Pro 24-m
>

James M.(Jim) Geidl

unread,
Nov 19, 2009, 10:01:57 PM11/19/09
to hbrob...@googlegroups.com
Nathaniel,

Took a look at the help file and it is the same problem child as the
downloadable manual, unfortunately.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


> -----Original Message-----
> From: Nathaniel Lewis [mailto:linux.r...@gmail.com]

KM6VV

unread,
Nov 19, 2009, 10:34:55 PM11/19/09
to hbrob...@googlegroups.com
Jim,

Are you running the BasicAtomPro or the new does-all IDE (Studio)? Check
out the manual in the Studio version, it was supposed to be more
up-to-date.

Alan

James M.(Jim) Geidl

unread,
Nov 19, 2009, 10:54:57 PM11/19/09
to hbrob...@googlegroups.com
Alan,

I have the studio and it may be more current in some areas but the one place
I am having trouble it is just junk: HPWM. It has partial paragraphs or,
maybe, just the first sentence of a paragraph and nothing following it. "To
cancel the PWM signal." Then nothing following it like how to actually do
it. There is a code sample that won't even compile.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


Tom Rokicki

unread,
Nov 20, 2009, 11:33:36 AM11/20/09
to hbrob...@googlegroups.com
Time to switch to the propeller. It's got great documentation, a vibrant
community, tons of prewritten objects, supports I/O to SD at greater
than 1MB/sec concurrently with VGA or NTSC generation concurrently
with PWM on 8 pins all while still leaving plenty of CPU for your PID.

-tom

James M.(Jim) Geidl

unread,
Nov 20, 2009, 1:46:34 PM11/20/09
to hbrob...@googlegroups.com
Tom,

I probably should have done that since I am a Parallax fan anyhow but I
really didn't want to have to learn another language.


Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


> -----Original Message-----
> From: Tom Rokicki [mailto:rok...@gmail.com]
> Sent: Friday, November 20, 2009 8:34 AM
> To: hbrob...@googlegroups.com
> Subject: Re: [HBRobotics] BasicATOM Pro 24-m
>

Alan Marconett

unread,
Nov 20, 2009, 2:33:07 PM11/20/09
to hbrob...@googlegroups.com
Hi Jim,

OOPS! I thought I had a good example for you, but it's HSERVO (which is a
PWM as well for R/C servos).

Have you seen this HPWM.BAS example? Probably from BM site:

-------------------------------------------------
counter var long 'Used for the count command

hpwm 1,9920,4960 'Set up a 2KHz signal (approx)

'hpwm 1,8,4 'Set up a 83KHz signal (approx)

Loop:
count B0,1000,counter
'Set up our counter on pin B0 for 1 second

'Display the results
serout B1,i9600,[dec counter," Hz",10,13]

goto loop
-------------------------------------------------

I haven't tried it.

Alan KM6VV

James M.(Jim) Geidl

unread,
Nov 20, 2009, 3:27:09 PM11/20/09
to hbrob...@googlegroups.com
Alan,

I am, for testing doing something very similar. The problem I am hitting is
the once you issue a HPWM command you can't shut the pin off by issuing
either a HWPM pin#, 0, 0 or just a simple Low pin#. The examples in the
book are junk. I did finally get a note back from a fellow at BM asking for
more info so I will see where that goes. IO may end up just going to a
Propeller although, if I have to learn another language I might be better
off learning C which would give me more flexibility in using other chips.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//
> From: Alan Marconett [mailto:KM...@SBCGLOBAL.NET]
> Sent: Friday, November 20, 2009 11:33 AM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] BasicATOM Pro 24-m
>

Alan Marconett

unread,
Nov 20, 2009, 3:46:14 PM11/20/09
to hbrob...@googlegroups.com
Hi Jim,

Maybe a few ASM instructions could turn off the PWM. The Pro is Renisys, so
I don't know it like I do the PIC.

I'm a big fan of 'C'. The commercial C compilers I've worked with are much
more predictable, and documented. This is Basic, not a full or proper
BASIC, and I see commands vary much more then in the commercial world.

Hopefully you'll get more information.

Alan KM6VV

> -----Original Message-----
> From: James M.(Jim) Geidl [mailto:jge...@sbcglobal.net]
>
> Alan,
>

James M.(Jim) Geidl

unread,
Nov 20, 2009, 4:00:31 PM11/20/09
to hbrob...@googlegroups.com
Alan,

I did find, from another forum, a ASM instruction that shuts it off but the
fact that I have to do that makes me pretty nervous about the chip. How may
other things are there that don't work properly. One of the worst feelings
when you are starting out on a new endeavor is that you may be doing
everything correctly and there is an underlying problem the whatever you are
working with that you don't know about.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//


> From: Alan Marconett [mailto:KM...@SBCGLOBAL.NET]
> Sent: Friday, November 20, 2009 12:46 PM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] BasicATOM Pro 24-m
>

Tom Rokicki

unread,
Nov 20, 2009, 4:01:38 PM11/20/09
to hbrob...@googlegroups.com
Yeah, at first Spin was a turn-off for me; it's not like C, and it's
not like Basic.
It's sort of its own thing, with some odd operator syntax choices to boot.

But Spin is a *very* simple language; there's really not much to it at all.
It's reasonably effective and very easy to learn.

There is a C compiler for the Prop, but you're limited to 32K hub space
which may be insufficient for some purposes. (There are presently at least
*two* C compilers, one commercial and one free.) But the prop really
flies best in Spin + assembly.

One of the best things about the prop is the really simple but *super* quick
IDE. No big tool chain, no complicated downloads or cables needed.

Frankly, I think the prop was made for robotics (for those cases where a
*controller* suffices and you don't actually need a full Linux stack).
> --
>
> You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
> To post to this group, send email to hbrob...@googlegroups.com.
> To unsubscribe from this group, send email to hbrobotics+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hbrobotics?hl=.
>
>
>



--
Check out Golly at http://golly.sf.net/

Alan Marconett

unread,
Nov 20, 2009, 4:27:03 PM11/20/09
to hbrob...@googlegroups.com
Hi Jim,

Yeah, that's why I don't want to go out and "try every new chip out there".
I'm trying to stick with what I have a lot of experience in, rather then
have to learn every nuance about another chip. And a new compiler can add a
lot of confusion as well. Even gets hard to separate the two.

Alan KM6VV

> -----Original Message-----
> From: James M.(Jim) Geidl [mailto:jge...@sbcglobal.net]
>
> Alan,
>

Alan Marconett

unread,
Nov 20, 2009, 4:35:51 PM11/20/09
to hbrob...@googlegroups.com
It's always the question of how much time you want to invest in a new chip
or language. I've worked with enough chips, and enough compilers, that it's
not a difficult climb. But how many little hills to I want to climb on my
own dime? Give me a paying project, something for work or a contract, and
I'm all for it. But even then, on a contract they usually are looking for
someone already experienced in the chips/tools. I remember working with a
guy hired to do a test fixture that we were too busy to do, and I was quite
dismayed that he didn't already know his tools (happened to be a basic
compiler, and we even bought it)!

I'm sure the Spin language is a great little language, and the Prop quite
innovative in its approach to multiple threads/processors. Maybe a job will
come along at work that simply demands it, and I'll get a paid chance to
learn it (snicker).

Dave Curtis

unread,
Nov 20, 2009, 5:19:17 PM11/20/09
to hbrob...@googlegroups.com
What is the state of open source development tools on Propeller? In the
past Parallax has been hostile to anything but Windows, and never
provided enough documentation that anyone could do an open source code
loader.

I keep waiting for the day when I can do propeller development on Linux
or OS X without having to fight Parallax to do it.

-dave

Tom Rokicki

unread,
Nov 20, 2009, 5:43:14 PM11/20/09
to hbrob...@googlegroups.com
Oh, you can right now! There's a very nice Prop-IDE-alike compiler called
"bst" that has full compatibility, or if you want, all sorts of
extended capabilities.
That works on Windows, Mac, and Linux.

Parallax has also released a .dll that contains their full compiler that you can
invoke from any sort of Windows-emulator box, should you want to do that.
(That is, if you want a command-line compiler, or if you want to extend their
IDE in some cool way, or something like that).

Parallax is anything but hostile to Mac and Linux; they just don't have the
resources to do that development. But they have been *more* than open to
share the resources needed for others to build the tools, and other people
have indeed stepped up to the plate.

jgeidl

unread,
Nov 21, 2009, 11:48:14 PM11/21/09
to HomeBrew Robotics Club
Alan,

Would you be interested in sharing a little code with me relavent to
controlling your motor(s) with PWM or HPWM? I just ain't getting
anywhere.

Jim, K6JMG
> > Jim, K6JMG- Hide quoted text -
>
> - Show quoted text -

Alan Marconett

unread,
Nov 22, 2009, 2:09:55 AM11/22/09
to hbrob...@googlegroups.com
Hi Jim,

I haven't yet used the PWM command to drive motors. But I'll see if I
can dig something up for you.

Alan KM6VV

giuliano carlini

unread,
Nov 22, 2009, 2:11:36 AM11/22/09
to hbrob...@googlegroups.com
I can give you arduino code for an SN754410NE. Not sure if that will help. Code is off the top of my head, and not tested at all, but is close to what I have in "real" code so it should be close. "analogWrite" sets the pwm duty cycle. range is 0-255.

// declarations
int right_enable_pin  = 11;
int right_forward_pin = 12;
int right_reverse_pin = 13;

int left_enable_pin  = 6;
int left_forward_pin = 7;
int left_reverse_pin = 8;


// init
pinMode(right_enable_pin,  OUTPUT);
pinMode(right_forward_pin, OUTPUT);
pinMode(right_reverse_pin, OUTPUT);
pinMode(left_enable_pin,  OUTPUT);
pinMode(left_forward_pin, OUTPUT);
pinMode(left_reverse_pin, OUTPUT);

// Forward full speed
analogWrite(right_enable_pin,   255);
digitalWrite(right_forward_pin, HIGH);
digitalWrite(right_reverse_pin, LOW);
analogWrite(left_enable_pin,   255);
digitalWrite(left_forward_pin, HIGH);
digitalWrite(left_reverse_pin, LOW);

// Forward half speed
analogWrite(right_enable_pin,   128);
digitalWrite(right_forward_pin, HIGH);
digitalWrite(right_reverse_pin, LOW);
analogWrite(left_enable_pin,   128);
digitalWrite(left_forward_pin, HIGH);
digitalWrite(left_reverse_pin, LOW);

// Reverse half speed
analogWrite(right_enable_pin,   128);
digitalWrite(right_forward_pin, LOW);
digitalWrite(right_reverse_pin, HIGH);
analogWrite(left_enable_pin,   128);
digitalWrite(left_forward_pin, LOW);
digitalWrite(left_reverse_pin, HIGH);

// Spin clockwise half speed: left forward, right reverse
analogWrite(right_enable_pin,   128);
digitalWrite(right_forward_pin, LOW);
digitalWrite(right_reverse_pin, HIGH);
analogWrite(left_enable_pin,   128);
digitalWrite(left_forward_pin, HIGH);
digitalWrite(left_reverse_pin, LOW);

// Turn right half speed: left forward, right coast
analogWrite(right_enable_pin,   0);
digitalWrite(right_forward_pin, LOW);
digitalWrite(right_reverse_pin, HIGH);
analogWrite(left_enable_pin,   128);
digitalWrite(left_forward_pin, HIGH);
digitalWrite(left_reverse_pin, LOW);

// Brake. Either HIGH/HIGH or LOW/LOW for the forward/reverse pins works.
analogWrite(right_enable_pin,   255);
digitalWrite(right_forward_pin, LOW);
digitalWrite(right_reverse_pin, LOW);
analogWrite(left_enable_pin,   255);
digitalWrite(left_forward_pin, LOW);
digitalWrite(left_reverse_pin, LOW);

In reality, the value to analogWrite would probably be based upon sensor inputs. And be put through PID and ramp components.

giuliano

Nathaniel Lewis

unread,
Nov 22, 2009, 4:03:13 AM11/22/09
to hbrob...@googlegroups.com

Isn’t the Arduino language basically C++ except that they mask the main method to initialization and main code?

                                                                                Nathaniel

 

From: giuliano carlini [mailto:giul...@carlini.com]

Sent: Saturday, November 21, 2009 11:12 PM
To: hbrob...@googlegroups.com

Emil Valkov

unread,
Nov 22, 2009, 11:26:57 AM11/22/09
to hbrob...@googlegroups.com
Yes that's correct. They use gcc to do the compilation.

Emil

Nathaniel Lewis wrote:
>
> Isn’t the Arduino language basically C++ except that they mask the
> main method to initialization and main code?
>
> Nathaniel
>
> *From:* giuliano carlini [mailto:giul...@carlini.com]
> *Sent:* Saturday, November 21, 2009 11:12 PM
> *To:* hbrob...@googlegroups.com
> *Subject:* Re: [HBRobotics] Re: BasicATOM Pro 24-m
> <mailto:hbrob...@googlegroups.com>.
> To unsubscribe from this group, send email to
> hbrobotics+...@googlegroups.com
> <mailto:hbrobotics+...@googlegroups.com>.

James M.(Jim) Geidl

unread,
Nov 22, 2009, 1:11:30 PM11/22/09
to hbrob...@googlegroups.com
Giuliano,
 
Thanks, but I am looking for code for the BasicATOM chip rather than just code in general.
 

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number of electrons were terribly inconvenienced.


//


From: giuliano carlini [mailto:giul...@carlini.com]
Sent: Saturday, November 21, 2009 11:12 PM
To: hbrob...@googlegroups.com
Subject: Re: [HBRobotics] Re: BasicATOM Pro 24-m

I can give you arduino code for an SN754410NE. Not sure if that will help. Code is off the top of my head, and not tested at all, but is close to what I have in "real" code so it should be close. "analogWrite" sets the pwm duty cycle. range is 0-255.

 <snip>

James M.(Jim) Geidl

unread,
Nov 22, 2009, 1:13:15 PM11/22/09
to hbrob...@googlegroups.com
Nathaniel,
 
According to what I am reading,  Arduino may be next, it will use C or C++.
 
 

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number of electrons were terribly inconvenienced.


//



From: Nathaniel Lewis [mailto:linux.r...@gmail.com]
Sent: Sunday, November 22, 2009 1:03 AM
To: hbrob...@googlegroups.com
Subject: RE: [HBRobotics] Re: BasicATOM Pro 24-m

Isn’t the Arduino language basically C++ except that they mask the main method to initialization and main code?

                                                                                Nathaniel

 

From: giuliano carlini [mailto:giul...@carlini.com]
Sent: Saturday, November 21, 2009 11:12 PM
To: hbrob...@googlegroups.com
Subject: Re: [HBRobotics] Re: BasicATOM Pro 24-m

 

I can give you arduino code for an SN754410NE. Not sure if that will help. Code is off the top of my head, and not tested at all, but is close to what I have in "real" code so it should be close. "analogWrite" sets the pwm duty cycle. range is 0-255.

 <snip>

 

Randy M. Dumse

unread,
Nov 22, 2009, 2:27:55 PM11/22/09
to hbrob...@googlegroups.com
jgeidl said: Saturday, November 21, 2009 10:48 PM
> Would you be interested in sharing a little code with me
> relavent to controlling your motor(s) with PWM or HPWM? I
> just ain't getting anywhere.

I looked up the BasicMicro AtomPro documentation. Looks pretty
straight forward.
http://basicmicro.com/downloads/docs/atompro_7200.pdf

HPWM
HPWM pin,period,duty
Output a pulse width modulated signal at the specified period
and
duty cycle
Pin is an expression of the I/O pin number to use.
This pin will be placed into output mode during pulse generation
then switched to input mode when the instruction finishes. Only
pins with the FTIOB/C or D option can use the HPWM command.
Period is an expression of the period of the pulse width signal
in
us.
Duty is an expression of the duty cyle of the pulse width signal
in
microseconds(us).
Explanation
The HPWM command outputs a user specified Pulse signal. The
period is the time in us of one pulse cycle. The duty is the
time in us
that the pulse signal is high.

Pwm
PWM pin, period, duty, cycles
Convert a digital value to analog output via pulse-width
modulation.
Pin is an expression of the pin to use.
This pin will be placed into output mode during pulse
generation.
Period is an expression of the period of the pulse width signal
in
us.
Duty is an expression of the duty of the pulse width signal in
us.
Cycles is an expression of the number of pulses to output..
Explanation
The PWM command outputs a user specified Pulse signal. The
period is the time in us of one pulse cycle. The duty is the
time in us
that the pulse signal is high. The PWM command is software based
so it has the same limitations as any other software command. If
you
need to output a PWM signal constantly and still be able to run
other
commands see the HPWM command.


One of the keys in being successful in a micro development is
visibility into what you are doing. What tools do you have to
see what is happening? Do you have a volt meter, logic probe, or
oscilliscope? (or resistors and LED's to see what's coming out?)

Have you verified you can operate the motor and H-bridge by
hand? (Force the control inputs high or low as desired.)

Have you looked at what you get out of the micro with a scope?
(or other tool?)

Is your wiring correct? Have you operated the motor and H-bridge
through the micro with full speed before trying PWM to know you
have control?

It sounded perhaps that you had PWM running but didn't know how
to shut it off. Did you try the HIGH or LOW command to see if it
would override the PWM? Did you try just shutting off PWM with a
0 or "equal to period" duty cycle?

Randy


Randy M. Dumse

unread,
Nov 22, 2009, 3:48:16 PM11/22/09
to hbrob...@googlegroups.com
jgeidl said: Saturday, November 21, 2009 10:48 PM
> Would you be interested in sharing a little code with me

Another thought. If you have to get to the registers to turn off
PWM, PEEK and POKE can do anything you need without resorting to
assembly language.

Randy


James M.(Jim) Geidl

unread,
Nov 22, 2009, 6:39:24 PM11/22/09
to hbrob...@googlegroups.com
Randy,

First, that you very much for all the time you obviously put into your
message. You asked a bunch of questions that I have been finding myself
lying in bed at night asking myself.

Here is a sample of the code I am using with some annotations. Note the
hpwm enable, 0, 0 statement and the low enable statement. The numbering was
added in this message to allow for easy referencing...there are no numbers
in the code being uploaded to the chip. I am able to drive the motor using
the L298 but taking the proper pins high and low directly from the Vin.

What happens is that the chip turns on on statement 10 at about 75% voltage
then the voltage climbs up to full voltage on statement 12 so I know the
period/duty combination is working properly. One would expect that
statement 14 would then take the enable pin low but it has absolutely no
effect. The register diddle stops the motor But I am not very happy having
to deal with the chip this way. I have been trying to avoid having to pick
up another language therefore jumped on the this chip because it is
~supposed~ to be using a Basic variant. If I have to start doing assembler
or C code I am going to a different chipset entirely.

1 enable con p12 ;enable pin of motor one on the L298
2 per_iod var word
3 duty var word
4 per_iod=800
5 duty=600 ; 75 duty cycle
6 low enable ; take the enable pin low or the motor starts with
the next statement
7 high p15 ; one iput of the L298, starts the motor running
8 low p14 ; other input of the L298
9 main
10 hpwm enable, per_iod, duty ;trigger the HPWM pin p12 PWMD
11 pause 3000
12 hpwm enable, 0, 0 ;should shut PWM off on the pin and it does but
leaves the pin high
13 pause 3000
14 low enable ; should take the enable pin low but doesn't
have any effect on it
15 pause 3000
16 TMRW.bit2=0 ;takes the pin low
17 goto main ; repeat

I am checking the frequency with a Tek 485 dual channel scope as well as a
Tenma 72-7290 frequency counter they both indicate about 20KHz which is what
I am shooting for. The L298 datasheet says it can handle 25KHz on the low
end.

The scope shows the enable pin going high and properly allocated to the
period and duty. A Fluke 189 on the enable pin indicates the 3.72V on the
pin which is about correct after statement 10. The volatge on the enable
pin climbs up to 5V after statement 12, which makes some sense, and remains
there until the program cycles back around to statement 10 again. I think
the enable pin should be going low on statement 14 but doesn't. The
register diddle in statement 16 take the pin low and the motor stops.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//






> -----Original Message-----
> From: Randy M. Dumse [mailto:r...@newmicros.com]
> Sent: Sunday, November 22, 2009 11:28 AM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] Re: BasicATOM Pro 24-m
>

Randy M. Dumse

unread,
Nov 22, 2009, 7:50:29 PM11/22/09
to hbrob...@googlegroups.com
James M.(Jim) Geidl said: Sunday, November 22, 2009 5:39 PM
> Note the hpwm enable, 0, 0 statement and the
> low enable statement.

Try using the same period, but 0 width while high, or duty 0.

So your statement 12 like this

12 hpwm enable, per_iod, 0

At worst you might get a kick every PWM cycles, but very short
lived, and the motor will likely not even turn if it does. Try
that and let me know. I'm just working from inferences here, as
I have never used the BasicMicro Atom (although I think I own
one traded in on one of my boards by a friend). It might be the
combination of 0 0 on period and duty leaves the timer in a
constant reset mode. I never like to the the period to 0. If
anything, you might take it out to a maximum when you want it to
stop. Then even if you do get a 1 cycle blip, it will have even
less effect on the motor.

Apparently the:

14 low enable

works on the pin output register, but does not choose the port,
leaving the peripheral mode in charge of the pin.

Randy


KM6VV

unread,
Nov 22, 2009, 7:57:13 PM11/22/09
to hbrob...@googlegroups.com
Hi Jim,

Here's a link to an AtomBasic program, it compiles under pro. See if
you can get anything out of it. I don't have any Scorpion driver
boards, I do have a board I'm building with H-bridge chips on it.

Alan KM6VV

http://www.lynxmotion.com/images/html/build135.htm

James M.(Jim) Geidl

unread,
Nov 22, 2009, 8:55:52 PM11/22/09
to hbrob...@googlegroups.com
Randy,

Worked perfect. I change the HPWM enable, 0, 0 to HPWM enable, per_iod, 0
and the motor stopped just as you predicted. Thank you very much. Now on
to the next hurdle.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//





> -----Original Message-----
> From: Randy M. Dumse [mailto:r...@newmicros.com]
> Sent: Sunday, November 22, 2009 4:50 PM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] Re: BasicATOM Pro 24-m
>

James M.(Jim) Geidl

unread,
Nov 22, 2009, 9:08:02 PM11/22/09
to hbrob...@googlegroups.com
Randy,

Phase II went OK too!! Running both motors.

enable1 con p12 ;enable pin of motor 1 on the L298
enable2 con p11 'enable pin of motor 2 on L298
per_iod var word
duty var word
per_iod=800
duty=600 ; 75 duty cycle

low enable1 ; take the enable pins low on motor1 or it starts
with the next statement
high p15 ; one input of motor 1 on the L298, starts the motor running
low p14 ; other input of motor 1 the L298

low enable2 ; take the enable pins low on motor2 or it starts
with the next statement
high p8 ; one input of motor 2 on the L298, starts the motor running
low p9 ; other input of motor 1 the L298

main
hpwm enable1, per_iod, duty ;trigger the HPWM pin p12 PWMD
hpwm enable2, per_iod, duty ;trigger the HPWM pin p12 PWMD
pause 3000
hpwm enable1, per_iod, 0 ;shut PWM off on enable1
hpwm enable2, per_iod, 0 ;shut PWM off on enable2
pause 1000
goto main ; repeat



James M. (Jim) Geidl, K6JMG
www.spinochio.com
3528 Liberty Ct.
Antioch, CA 94509
925 778-8958

The information in this email may be confidential, privileged, and protected
from disclosure. This email is intended to be reviewed by only the
individual or organization named above. If you are not the intended
recipient or an authorized representative of the intended recipient, you are
hereby notified that any review, dissemination or copying of this email and
its attachments, if any, or the information contained herein is prohibited.
If you have received this email in error, please immediately notify the
sender by return email and delete this email from your system. Thank You

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.



> -----Original Message-----
> From: Randy M. Dumse [mailto:r...@newmicros.com]
> Sent: Sunday, November 22, 2009 4:50 PM
> To: hbrob...@googlegroups.com
> Subject: RE: [HBRobotics] Re: BasicATOM Pro 24-m
>

giuliano carlini

unread,
Nov 23, 2009, 12:18:22 AM11/23/09
to hbrob...@googlegroups.com
Arduino is C++. 

main() calls the arduino init function, then setup(), and then loop().

Some preprocessing is done, mostly to figure out what libraries to load.

giuliano

Randy M. Dumse

unread,
Nov 23, 2009, 11:24:19 AM11/23/09
to hbrob...@googlegroups.com
James M.(Jim) Geidl said: Sunday, November 22, 2009 8:08 PM
> Phase II went OK too!! Running both motors.
> hpwm enable1, per_iod, duty ;trigger the HPWM pin p12
PWMD
> hpwm enable2, per_iod, duty ;trigger the HPWM pin p12
PWMD
> pause 3000
> hpwm enable1, per_iod, 0 ;shut PWM off on enable1
> hpwm enable2, per_iod, 0 ;shut PWM off on enable2


Notice what you've done here is really just commanded two
separate speeds, one at 75% and the other at 0%.

Do the wheels "sqeak" or slip when you apply 75%?

If so the next fun thing might be to profile the acceleration to
give you a smooth startup and a smooth stop.

So you make a variable cmdduty (command duty cycle desired) and
change duty to curduty (current duty cycle set), and call a
subroutine that "increments" and outputs curduty until it
becomes equal to cmduty.

By increment, I mean move some value which represents an
acceleration. Of course if the curduty is above cmdduty you
would change sign or subtract the acceleration parameter to make
it change in the right direction.

So let's say the acc is 5. If you change your cmdduty from 0 to
600 (out of maximum of 800, or per_iod), you would output
5,10,15,..,595,600. You probably want to put a pause in the loop
for each step of acceleration. Likewise, if you cmdduty back to
0, it should step down until it reaches 0. (Be sure to test not
to overshoot if acc is not one. Otherwise you might miss
depending on where you start from e.g. 13, 8, 3, -2 ???)

If you want fairly exact moves, being sure your motors don't
start or stop too suddenly is a first step to getting what I
call "beautiful motion". It takes more processing power. You'll
soon need to learn the multitasking aspect of the Atom to get
much further.

Randy


James M.(Jim) Geidl

unread,
Nov 23, 2009, 2:16:27 PM11/23/09
to hbrob...@googlegroups.com
Randy,

Controlled start and controlled stop are both on my list of modules. I
intended to build separate procedures for forward, reverse, right turn,
left turn, accel and decel, and get-me-a-beer. Obviously, the first thing I
had to do was conquer just getting the motors to run and stop reliably.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//





> -----Original Message-----
> From: Randy M. Dumse [mailto:r...@newmicros.com]
> Sent: Monday, November 23, 2009 8:24 AM
> To: hbrob...@googlegroups.com

Chris Palmer

unread,
Nov 28, 2009, 1:58:57 PM11/28/09
to hbrob...@googlegroups.com
Jim...

A bit of a late reply by me... but you can also change the other 2
motor control line signals to stop the motor. Setting them both-high
or both-low will make any Enable-line pulses act like braking
signals. You would probably only notice this braking effect if your
robot can freely roll down an incline when it has no power, but it is
yet another way to stop the drive signal to your motors.

As you continue to make progress, a PID loop (or even just "PI") will
give you lots of nice control over your platform.

-Chris

On Nov 22, 2009, at 5:55 PM, "James M.\(Jim\) Geidl" <jge...@sbcglobal.net

James M.(Jim) Geidl

unread,
Nov 28, 2009, 4:42:57 PM11/28/09
to hbrob...@googlegroups.com
Chris,

Thank you, I am doing that but that is different than a chip that doesn't
want to do what it is told. I have made up my mind that there is something
seriously wrong with this chip. I have tried to contact BM about it but
they just ignore my emails; I guess they are happy with the $49 they got
from but that is real foolish. As an example, I have easily spent 20 times
that much with Parallax before I decided to try a different chip
arrangement. But, I also got tremendous customer service from Parallax. Oh
well, no accounting for bad business practices.

Randy M. Dumse

unread,
Nov 28, 2009, 5:04:18 PM11/28/09
to hbrob...@googlegroups.com
James M.(Jim) Geidl said: Saturday, November 28, 2009 3:43 PM
> a chip that doesn't want to do what it is told.
> I have made up my mind that there is something
> seriously wrong with this chip.

You are past running two motors at once, so what are you trying
to do that it isn't? Have you arrived at a new sticking point?

Randy


James M. Geidl

unread,
Nov 28, 2009, 5:20:58 PM11/28/09
to hbrob...@googlegroups.com
Randy,

Thing don't run consistently. I can power the chip and do an upload and it runs fine. 10 minutes later it won't work at all. Sometimes while it us running it just stops. Sometimes after it stops I can tap the IC gently and it starts back up. Before you ask, I have tried different wiring and have even tried different positions on the breadboard and different breadboards all together.

Jim
------Original Message------
From: Randy M. Dumse
To: hbrob...@googlegroups.com
ReplyTo: hbrob...@googlegroups.com
Subject: RE: [HBRobotics] Re: BasicATOM Pro 24-m
--

You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To post to this group, send email to hbrob...@googlegroups.com.
To unsubscribe from this group, send email to hbrobotics+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hbrobotics?hl=en.




Sent directly out of my pocket!

Wayne C. Gramlich

unread,
Nov 28, 2009, 6:06:05 PM11/28/09
to hbrob...@googlegroups.com
Jim:

If the thing didn't cost $49 each, you could just buy another
one and see if the problem goes away or not. It could be
something else is flaky in your system and you can not
distinguish between it and flaky chip. That has certainly
happened to me in the past.

-Wayne

Randy M. Dumse

unread,
Nov 28, 2009, 6:11:02 PM11/28/09
to hbrob...@googlegroups.com
James M. Geidl said: Saturday, November 28, 2009 4:21 PM
> Thing don't run consistently. ... Sometimes after it
> stops I can tap the IC gently and it starts back up.

Sounds like cold solder. Or sometimes the xtal can have
"microphonics" issues, as it is essentially a mechanical device.
Those are really hard assembly problems to spot. Did you order
it from them? Or buy through a distributor? I'd say they should
probably replace it. Or take it back for repair at a minimum.
However, you may need to document it not working to get them to
move on it.

Of course, you have to be a careful observer, and not mistake
this effect for loading different software at different times.

Perhaps you could probe the xtal when it is not running, and see
if you see it oscillating. Now, if it is xtal related, just
touching the scope probe to the xtal lead can set it running, so
this may be a hard problem to diagnose, but that's where I'd
start to see if it were running or not. Of course if every time
you touch the xtal if it starts running, that narrows the
problem down considerably.

Randy


James M. Geidl

unread,
Nov 28, 2009, 6:28:18 PM11/28/09
to hbrob...@googlegroups.com
Wayne,

You are absolutely correct but I am not going to risk another 49.00. I have just had too many problems with everything related to this product.

Jim
------Original Message------
From: Wayne C. Gramlich
To: hbrob...@googlegroups.com
ReplyTo: hbrob...@googlegroups.com
Subject: Re: [HBRobotics] Re: BasicATOM Pro 24-m
Sent: Nov 28, 2009 3:06 PM

Jim:

If the thing didn't cost $49 each, you could just buy another
one and see if the problem goes away or not. It could be
something else is flaky in your system and you can not
distinguish between it and flaky chip. That has certainly
happened to me in the past.

-Wayne

James M. Geidl wrote:
> Randy,
>
> Thing don't run consistently. I can power the chip and
> do an upload and it runs fine. 10 minutes later it won't
> work at all. Sometimes while it us running it just stops.
> Sometimes after it stops I can tap the IC gently and it
> starts back up. Before you ask, I have tried different
> wiring and have even tried different positions on the
> breadboard and different breadboards all together.

Wayne C. Gramlich

unread,
Nov 28, 2009, 6:51:26 PM11/28/09
to hbrob...@googlegroups.com
Jim:

I totally understand. I'm embarrassed by the number of times
I have cussed at flaky hardware only to discover that
the batteries were low.

I want to forewarn you, that as you try to get your robot to
do ever more advanced things, you will start to discover
that most of the products out there have issues. In general,
robotics is a branch of real time programming and real time
programming is actually quite hard. There are some point
solutions out there that are actually quite slick, but nobody
has solved it in general yet.

-Wayne

James M. Geidl wrote:
> Wayne,
>
> You are absolutely correct but I am not going to risk
> another 49.00. I have just had too many problems with
> everything related to this product.

[snippage]

James M.(Jim) Geidl

unread,
Nov 28, 2009, 7:12:25 PM11/28/09
to hbrob...@googlegroups.com
Randy,

It has reached a point now where the IDE just says the chip ain't there no
more! I have found that good grammar makes everything much gooder.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//



> -----Original Message-----
> From: Randy M. Dumse [mailto:r...@newmicros.com]
> Sent: Saturday, November 28, 2009 3:11 PM
> To: hbrob...@googlegroups.com

James M.(Jim) Geidl

unread,
Nov 28, 2009, 7:14:44 PM11/28/09
to hbrob...@googlegroups.com
Wish you hadn't said THAT! Maybe I need a different hobby...maybe
competitive drinking.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//



> -----Original Message-----
> From: Wayne C. Gramlich [mailto:wa...@gramlich.net]
> Sent: Saturday, November 28, 2009 3:51 PM
> To: hbrob...@googlegroups.com

Chris Palmer

unread,
Nov 28, 2009, 10:06:44 PM11/28/09
to hbrob...@googlegroups.com
Is this with the chip by itself or in your circuit with the HBridge
and motors, too?

-Chris

On Nov 28, 2009, at 4:12 PM, "James M.\(Jim\) Geidl" <jge...@sbcglobal.net

James M.(Jim) Geidl

unread,
Nov 28, 2009, 10:29:54 PM11/28/09
to hbrob...@googlegroups.com
Chris,

I was having so much trouble with it the I disconnected everything then just
connected the RS-232 interface, power, and one LED and resistor to do some
testing.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//



> -----Original Message-----
> From: Chris Palmer [mailto:ch...@zencow.com]
> Sent: Saturday, November 28, 2009 7:07 PM
> To: hbrob...@googlegroups.com

James M.(Jim) Geidl

unread,
Nov 28, 2009, 10:33:07 PM11/28/09
to hbrob...@googlegroups.com
BTW, I have an Arduino that I am playing with now as well. I have resisted
learning C but I think this may be the way to go to start a new adventure.
Once I get some footing in C I can sorta go whatever direction I want.

I would love to get the ATOM working if for no other reason than the fact
that I have $49 invested in it and it appears that I am stuck with it as the
company is total unresponsive to my requests for a return.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number
of electrons were terribly inconvenienced.


//



> -----Original Message-----
> From: Chris Palmer [mailto:ch...@zencow.com]
> Sent: Saturday, November 28, 2009 7:07 PM
> To: hbrob...@googlegroups.com

giuliano carlini

unread,
Nov 28, 2009, 10:46:30 PM11/28/09
to hbrob...@googlegroups.com
Jim,

I'm biased toward Arduino as a learning platform. Heck, as a platform
that can do a whole lot of "real" stuff.

I've bought Arduino's from multiple vendors, and all have been willing
to replace faulty boards.

As for C/C++, well, it's a foul beasty, but it can be learned, and it
can do a lot. Arduino is good at letting you start with just a bit of C
++, and adding it bit by bit to do more.

I sent you some Arduino code for your motors before. Give it a shot
and see how it works.

Can't help with your ATOM, but if you want to meet some time and
Arduino-ize some time, let me know.

giuliano

James M.(Jim) Geidl

unread,
Nov 28, 2009, 11:01:36 PM11/28/09
to hbrob...@googlegroups.com
Giuliano,

I am working my way through the tutorials that are available including a
work in progress from Mike McRoberts that is really good at starting you at
the very basics...this is a hammer, when you hit your thumb with it that
hurts, that's called stupid. I will pester you as soon as I get through the
basics stuff.

I have been a database programmer for 25 years so programming in general is
not at all foreign to me. Fortunately, much of programming is understanding
the concepts which I have already. Now I am trying to understand the C
basics like why the h__l you have to put a semicolon at the end of a line
and what does "void" do for you at the beginning of a function. :-)

I will be back to pester later!!

e...@okerson.com

unread,
Nov 28, 2009, 11:01:12 PM11/28/09
to hbrob...@googlegroups.com
Jim,

You have to put a semicolon at the end of the line because C treats all
white space the same, so a space, tab, newline are all the same (ignored).

A function that has "void" at the beginning of the declaration does not
return any value when it returns to the caller. A function can return any
type of variable, int, char, double, etc., so void means it returns
nothing.

Ed Okerson

James M.(Jim) Geidl

unread,
Nov 28, 2009, 11:14:38 PM11/28/09
to hbrob...@googlegroups.com
Ed,

Thanks, I know that now but when I first ventured into C after skillfully
avoiding it for 30 years these were some of the questions I had. I tossed
them out just to show my lack of knowledge of even the barest of essentials
and the help I received from Mike McRoberts book.

Thanks again for taking time to help...

e...@okerson.com

unread,
Nov 28, 2009, 11:13:08 PM11/28/09
to hbrob...@googlegroups.com
Jim,

No problems. I have been writing in C for nearly as long as you have been
avoiding it, so feel free to ask any other questions. It can be a
difficult language to pick up, but very powerful once you do.

Ed

James M.(Jim) Geidl

unread,
Nov 28, 2009, 11:27:15 PM11/28/09
to hbrob...@googlegroups.com
Ed,

Thank you I will do that!
<snip>

Nathaniel Lewis

unread,
Nov 29, 2009, 3:19:38 AM11/29/09
to hbrob...@googlegroups.com
If you become good with Arduino, then you can pretty much develop C/C++. I
have not used the environment myself, but I am told that it IS C++ with some
background configurations hidden.
Nathaniel
Message has been deleted

James M.(Jim) Geidl

unread,
Nov 29, 2009, 4:22:39 PM11/29/09
to hbrob...@googlegroups.com
 
Guiliano,
 
I took your code, completed it so it would compile then added a few things to it for my own clarity and came up with what is below.  Works great, thank you again!  I used the Copy for Forum tool which didn't work so I removed it and am trying again.

Jim, K6JMG
www.spinochio.com

No trees were harmed in the sending of this message; however, a large number of electrons were terribly inconvenienced.


//

// Motor control from guiliano carlini
//  added serial outs so I had some idea where I was
// added delays
 
// declarations
int right_enable_pin  = 11;
int right_forward_pin = 12;
int right_reverse_pin = 13;
 
int left_enable_pin  = 6;
int left_forward_pin = 7;
int left_reverse_pin = 8;
 
void setup(){

  // init
  pinMode(right_enable_pin,  OUTPUT);
  pinMode(right_forward_pin, OUTPUT);
  pinMode(right_reverse_pin, OUTPUT);
  pinMode(left_enable_pin,  OUTPUT);
  pinMode(left_forward_pin, OUTPUT);
  pinMode(left_reverse_pin, OUTPUT);
  Serial.begin(9600);
}
 
 
 
void loop(){
 
  // Forward full speed
  Serial.println("Forward full speed");  //JMG

  analogWrite(right_enable_pin,   255);
  digitalWrite(right_forward_pin, HIGH);
  digitalWrite(right_reverse_pin, LOW);
  analogWrite(left_enable_pin,   255);
  digitalWrite(left_forward_pin, HIGH);
  digitalWrite(left_reverse_pin, LOW);
 
  delay(3000);  //JMG
 
  // Forward half speed
  Serial.println("Forward half speed");  //JMG

  analogWrite(right_enable_pin,   128);
  digitalWrite(right_forward_pin, HIGH);
  digitalWrite(right_reverse_pin, LOW);
  analogWrite(left_enable_pin,   128);
  digitalWrite(left_forward_pin, HIGH);
  digitalWrite(left_reverse_pin, LOW);
 
  delay(3000);  //JMG
 
  // Reverse half speed
  Serial.println("Reverse half speed");  //JMG

  analogWrite(right_enable_pin,   128);
  digitalWrite(right_forward_pin, LOW);
  digitalWrite(right_reverse_pin, HIGH);
  analogWrite(left_enable_pin,   128);
  digitalWrite(left_forward_pin, LOW);
  digitalWrite(left_reverse_pin, HIGH);
 
  delay(3000);  //JMG

 
  // Spin clockwise half speed: left forward, right reverse
  Serial.println("left forward, right reverse");  //JMG

  analogWrite(right_enable_pin,   128);
  digitalWrite(right_forward_pin, LOW);
  digitalWrite(right_reverse_pin, HIGH);
  analogWrite(left_enable_pin,   128);
  digitalWrite(left_forward_pin, HIGH);
  digitalWrite(left_reverse_pin, LOW);
 
  delay(3000);  //JMG
 
  // Turn right half speed: left forward, right coast
  Serial.println("left forward, right coast");  //JMG

  analogWrite(right_enable_pin,   0);
  digitalWrite(right_forward_pin, LOW);
  digitalWrite(right_reverse_pin, HIGH);
  analogWrite(left_enable_pin,   128);
  digitalWrite(left_forward_pin, HIGH);
  digitalWrite(left_reverse_pin, LOW);
 
  delay(3000);  //JMG
 
  // Brake. Either HIGH/HIGH or LOW/LOW for the forward/reverse pins works.
  Serial.println("Brake low/low");  //JMG

  analogWrite(right_enable_pin,   255);
  digitalWrite(right_forward_pin, LOW);
  digitalWrite(right_reverse_pin, LOW);
  analogWrite(left_enable_pin,   255);
  digitalWrite(left_forward_pin, LOW);
  digitalWrite(left_reverse_pin, LOW);
 

  delay(5000);   //JMG
}


From: giuliano carlini [mailto:giul...@carlini.com]
Sent: Sunday, November 22, 2009 9:18 PM

To: hbrob...@googlegroups.com
Subject: Re: [HBRobotics] Re: BasicATOM Pro 24-m
Arduino is C++. 

main() calls the arduino init function, then setup(), and then loop().

Some preprocessing is done, mostly to figure out what libraries to load.

giuliano

 <snip> 

giuliano carlini

unread,
Nov 30, 2009, 2:12:26 AM11/30/09
to hbrob...@googlegroups.com
Glad it worked and that it seems to have helped.

It's okay for expository code, but it isn't "production quality". My
"real" code wraps this into a C++ class. Not entirely happy with it
yet. Still learning this robot stuff myself, and am trying to figure
out how to make it better.

giuliano

On Nov 29, 2009, at 1:17 PM, jgeidl wrote:

> Guiliano,
>
> I took your code, completed it so it would compile then added a few
> things to it for my own clarity and came up with what is belwo. Works
> great, thank you again! I used teh Copy for Forum tool and hope it
> uploads properly to the forum.
>
> [quote]
> [color=#777755]// Motor control from guiliano carlini[/color]
> [color=#777755]// added serial outs so I had some idea where I was[/
> color]
> [color=#777755]// added delays[/color]
>
> [color=#777755]// declarations[/color]
> [color=#996600]int[/color] right_enable_pin = 11;
> [color=#996600]int[/color] right_forward_pin = 12;
> [color=#996600]int[/color] right_reverse_pin = 13;
>
> [color=#996600]int[/color] left_enable_pin = 6;
> [color=#996600]int[/color] left_forward_pin = 7;
> [color=#996600]int[/color] left_reverse_pin = 8;
>
> [color=#CC6600]void[/color] [color=#993300][b]setup[/b][/color](){
> [color=#777755]// init[/color]
> [color=#996600]pinMode[/color](right_enable_pin, [color=#CC0000]
> OUTPUT[/color]);
> [color=#996600]pinMode[/color](right_forward_pin, [color=#CC0000]
> OUTPUT[/color]);
> [color=#996600]pinMode[/color](right_reverse_pin, [color=#CC0000]
> OUTPUT[/color]);
> [color=#996600]pinMode[/color](left_enable_pin, [color=#CC0000]
> OUTPUT[/color]);
> [color=#996600]pinMode[/color](left_forward_pin, [color=#CC0000]
> OUTPUT[/color]);
> [color=#996600]pinMode[/color](left_reverse_pin, [color=#CC0000]
> OUTPUT[/color]);
> [color=#996600]Serial[/color].[color=#996600]begin[/color](9600);
> }
>
>
>
> [color=#CC6600]void[/color] [color=#993300][b]loop[/b][/color](){
>
> [color=#777755]// Forward full speed[/color]
> [color=#996600]Serial[/color].[color=#996600]println[/color]
> ([color=#CC0000]"Forward full speed"[/color]); [color=#777755]//JMG[/
> color]
> [color=#996600]analogWrite[/color](right_enable_pin, 255);
> [color=#996600]digitalWrite[/color](right_forward_pin,
> [color=#CC0000]HIGH[/color]);
> [color=#996600]digitalWrite[/color](right_reverse_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]analogWrite[/color](left_enable_pin, 255);
> [color=#996600]digitalWrite[/color](left_forward_pin, [color=#CC0000]
> HIGH[/color]);
> [color=#996600]digitalWrite[/color](left_reverse_pin, [color=#CC0000]
> LOW[/color]);
>
> [color=#996600]delay[/color](3000); [color=#777755]//JMG[/color]
>
> [color=#777755]// Forward half speed[/color]
> [color=#996600]Serial[/color].[color=#996600]println[/color]
> ([color=#CC0000]"Forward half speed"[/color]); [color=#777755]//JMG[/
> color]
> [color=#996600]analogWrite[/color](right_enable_pin, 128);
> [color=#996600]digitalWrite[/color](right_forward_pin,
> [color=#CC0000]HIGH[/color]);
> [color=#996600]digitalWrite[/color](right_reverse_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]analogWrite[/color](left_enable_pin, 128);
> [color=#996600]digitalWrite[/color](left_forward_pin, [color=#CC0000]
> HIGH[/color]);
> [color=#996600]digitalWrite[/color](left_reverse_pin, [color=#CC0000]
> LOW[/color]);
>
> [color=#996600]delay[/color](3000); [color=#777755]//JMG[/color]
>
> [color=#777755]// Reverse half speed[/color]
> [color=#996600]Serial[/color].[color=#996600]println[/color]
> ([color=#CC0000]"Reverse half speed"[/color]); [color=#777755]//JMG[/
> color]
> [color=#996600]analogWrite[/color](right_enable_pin, 128);
> [color=#996600]digitalWrite[/color](right_forward_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]digitalWrite[/color](right_reverse_pin,
> [color=#CC0000]HIGH[/color]);
> [color=#996600]analogWrite[/color](left_enable_pin, 128);
> [color=#996600]digitalWrite[/color](left_forward_pin, [color=#CC0000]
> LOW[/color]);
> [color=#996600]digitalWrite[/color](left_reverse_pin, [color=#CC0000]
> HIGH[/color]);
>
> [color=#996600]delay[/color](3000); [color=#777755]//JMG[/color]
>
> [color=#777755]// Spin clockwise half speed: left forward, right
> reverse[/color]
> [color=#996600]Serial[/color].[color=#996600]println[/color]
> ([color=#CC0000]"left forward, right reverse"[/color]);
> [color=#777755]//JMG[/color]
> [color=#996600]analogWrite[/color](right_enable_pin, 128);
> [color=#996600]digitalWrite[/color](right_forward_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]digitalWrite[/color](right_reverse_pin,
> [color=#CC0000]HIGH[/color]);
> [color=#996600]analogWrite[/color](left_enable_pin, 128);
> [color=#996600]digitalWrite[/color](left_forward_pin, [color=#CC0000]
> HIGH[/color]);
> [color=#996600]digitalWrite[/color](left_reverse_pin, [color=#CC0000]
> LOW[/color]);
>
> [color=#996600]delay[/color](3000); [color=#777755]//JMG[/color]
>
> [color=#777755]// Turn right half speed: left forward, right coast[/
> color]
> [color=#996600]Serial[/color].[color=#996600]println[/color]
> ([color=#CC0000]"left forward, right coast"[/color]);
> [color=#777755]//JMG[/color]
> [color=#996600]analogWrite[/color](right_enable_pin, 0);
> [color=#996600]digitalWrite[/color](right_forward_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]digitalWrite[/color](right_reverse_pin,
> [color=#CC0000]HIGH[/color]);
> [color=#996600]analogWrite[/color](left_enable_pin, 128);
> [color=#996600]digitalWrite[/color](left_forward_pin, [color=#CC0000]
> HIGH[/color]);
> [color=#996600]digitalWrite[/color](left_reverse_pin, [color=#CC0000]
> LOW[/color]);
>
> [color=#996600]delay[/color](3000); [color=#777755]//JMG[/color]
>
> [color=#777755]// Brake. Either HIGH/HIGH or LOW/LOW for the forward/
> reverse pins works.[/color]
> [color=#996600]Serial[/color].[color=#996600]println[/color]
> ([color=#CC0000]"Brake low/low"[/color]); [color=#777755]//JMG[/
> color]
> [color=#996600]analogWrite[/color](right_enable_pin, 255);
> [color=#996600]digitalWrite[/color](right_forward_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]digitalWrite[/color](right_reverse_pin,
> [color=#CC0000]LOW[/color]);
> [color=#996600]analogWrite[/color](left_enable_pin, 255);
> [color=#996600]digitalWrite[/color](left_forward_pin, [color=#CC0000]
> LOW[/color]);
> [color=#996600]digitalWrite[/color](left_reverse_pin, [color=#CC0000]
> LOW[/color]);
>
>
> [color=#996600]delay[/color](5000); [color=#777755]//JMG[/color]
> }
>
> [/quote]
>
> On Nov 21, 11:11 pm, giuliano carlini <giuli...@carlini.com> wrote:
>> I can give you arduino code for an SN754410NE. Not sure if that will
>> help. Code is off the top of my head, and not tested at all, but is
>> close to what I have in "real" code so it should be close.
>> "analogWrite" sets the pwm duty cycle. range is 0-255.
>>
>> // declarations
>> int right_enable_pin = 11;
>> int right_forward_pin = 12;
>> int right_reverse_pin = 13;
>>
>> int left_enable_pin = 6;
>> int left_forward_pin = 7;
>> int left_reverse_pin = 8;
>>
>> // init
>> pinMode(right_enable_pin, OUTPUT);
>> pinMode(right_forward_pin, OUTPUT);
>> pinMode(right_reverse_pin, OUTPUT);
>> pinMode(left_enable_pin, OUTPUT);
>> pinMode(left_forward_pin, OUTPUT);
>> pinMode(left_reverse_pin, OUTPUT);
>>
>> // Forward full speed
>> analogWrite(right_enable_pin, 255);
>> digitalWrite(right_forward_pin, HIGH);
>> digitalWrite(right_reverse_pin, LOW);
>> analogWrite(left_enable_pin, 255);
>> digitalWrite(left_forward_pin, HIGH);
>> digitalWrite(left_reverse_pin, LOW);
>>
>> // Forward half speed
>> analogWrite(right_enable_pin, 128);
>> digitalWrite(right_forward_pin, HIGH);
>> digitalWrite(right_reverse_pin, LOW);
>> analogWrite(left_enable_pin, 128);
>> digitalWrite(left_forward_pin, HIGH);
>> digitalWrite(left_reverse_pin, LOW);
>>
>> // Reverse half speed
>> analogWrite(right_enable_pin, 128);
>> digitalWrite(right_forward_pin, LOW);
>> digitalWrite(right_reverse_pin, HIGH);
>> analogWrite(left_enable_pin, 128);
>> digitalWrite(left_forward_pin, LOW);
>> digitalWrite(left_reverse_pin, HIGH);
>>
>> // Spin clockwise half speed: left forward, right reverse
>> analogWrite(right_enable_pin, 128);
>> digitalWrite(right_forward_pin, LOW);
>> digitalWrite(right_reverse_pin, HIGH);
>> analogWrite(left_enable_pin, 128);
>> digitalWrite(left_forward_pin, HIGH);
>> digitalWrite(left_reverse_pin, LOW);
>>
>> // Turn right half speed: left forward, right coast
>> analogWrite(right_enable_pin, 0);
>> digitalWrite(right_forward_pin, LOW);
>> digitalWrite(right_reverse_pin, HIGH);
>> analogWrite(left_enable_pin, 128);
>> digitalWrite(left_forward_pin, HIGH);
>> digitalWrite(left_reverse_pin, LOW);
>>
>> // Brake. Either HIGH/HIGH or LOW/LOW for the forward/reverse pins
>> works.
>> analogWrite(right_enable_pin, 255);
>> digitalWrite(right_forward_pin, LOW);
>> digitalWrite(right_reverse_pin, LOW);
>> analogWrite(left_enable_pin, 255);
>> digitalWrite(left_forward_pin, LOW);
>> digitalWrite(left_reverse_pin, LOW);
>>
>> In reality, the value to analogWrite would probably be based upon
>> sensor inputs. And be put through PID and ramp components.
>>
>> giuliano
>>
>> On Nov 21, 2009, at 8:48 PM, jgeidl wrote:
>>
>>
>>
>>> Alan,
>>
>>> Would you be interested in sharing a little code with me relavent to
>>> controlling your motor(s) with PWM or HPWM? I just ain't getting
>>> anywhere.
>>
>>> Jim, K6JMG
>>
>

jgeidl

unread,
Dec 12, 2009, 12:13:01 AM12/12/09
to HomeBrew Robotics Club
Well, got a little good news from Basic Micro. They are shipping me a
new chip!!

Jim, K6JMG

Reply all
Reply to author
Forward
0 new messages