Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: How to code fast output of multiple bit patterns on: May 15, 2012, 05:51:36 pm
Many thanks AWOL - 'Port Registers' is just what I am looking for.

(I don't see a link to that page from the Reference home page so I am glad I asked!)

And @robtillaart - yes, I should have been more specific.

To step all 6 motors at their max speed of 350 steps per second would require me to loop through that code 2100 times per second and there is some other arithmetic to be done before we get here. However, the faster I get get this then the more consistent my timing will become.
I think I can live with the portability issues in this case.

Many thanks again,
 - jon.
2  Using Arduino / Programming Questions / How to code fast output of multiple bit patterns on: May 14, 2012, 03:39:19 pm
Hi all,

(I am sure this has been answered before but I could not find it.)

Using an Arduino Uno, I need to output bit patterns as fast as possible.
(This is to drive several stepper motors.) The bit patterns consist of 3 bits to address a motor, and 4 bits for it's step pattern, then a strobe is toggled.

Currently I do it thus:
Code:
const byte pattPin[]  = {4, 5, 6, 7}; // Array of pin numbers for motor patterns
const byte motAddr[]  = {8, 9, 10}; // Array of pins for motor addr (1 to 6)
const byte strobe   = 11; // Data strobe pin

// Find motor pattern and output;
int pIndex = motPos[mot] & 7;
byte mPat = motPatt[pIndex];
digitalWrite(pattPin[0], bitRead(mPat, 0));
digitalWrite(pattPin[1], bitRead(mPat, 1));
digitalWrite(pattPin[2], bitRead(mPat, 2));
digitalWrite(pattPin[3], bitRead(mPat, 3));

//Output motor addr
digitalWrite(motAddr[0], bitRead(mot, 0));
digitalWrite(motAddr[1], bitRead(mot, 1));
digitalWrite(motAddr[2], bitRead(mot, 2));

// Strobe the data through:
digitalWrite(strobe, LOW);
digitalWrite(strobe, HIGH);

If I have this correct, the 4-bit motor pattern is on ATmega168 port D4,5,6,7 and the 3-bit motor address on port B0,1,2 and strobe on B3.

Please can you show me how to do this in embedded assembler by passing variables?

Many thanks,
 - jon.
3  Development / Other Software Development / Re: Arduino Eclipse Plugin <Update> on: January 26, 2012, 01:02:32 pm
Hi Jantje,

just to let you know that I have just built and uploaded my first Arduino Uno sketch using your Eclipse plugin on Ubuntu 10.04 Lucid.
I'd like to express my thanks for all the hard work you have put into this.

For others who are using Ubuntu: it took me a few hours to go through the install as I first needed to install

I, also, made the mistake of NOT installing C++ support in Eclipse but that can be retro-fitted. You only notice when the 'New Sketch' is created as Eclipse fails to open the perspective although the projects are created anyway.

My project will use a Java application on the PC communicating with the Arduino via USB so Eclipse makes a great development platform even without a debugger. I guess we need an emulator?

 - jon.
4  Using Arduino / Project Guidance / Re: How fast can Arduino Uno switch ouput pins? on: January 09, 2012, 12:03:30 pm
Many thanks to you all for your fast responses, useful help and great encouragement!
I have ordered my first Arduino Uno and I'm looking forward to making that old arm go again after so many years! (And after 4 house moves, 4 new jobs and 4 children!)

For Techone:
Quote
I am just curious...Did you use a PIA chip to connect with the Commodore ( assuming 64 ? ) or with the Sinclair ZX ? I wonder what kind ? ( 8000 series or 6800 series ) or others type of PIA.

The Mini-Mover 5 had a 40-way ribbon cable with an IDC edge-connector.
If I remember correctly, the Commodore (I assume '64' too but was not that familiar with it.) had a rear edge-connector that the MiniMover was designed to plug into. I suppose it had a parallel interface which was driven by Basic 'peek' and 'poke' commands.

On the Sinclare(s), the rear edge connector exposed the Z80 bus lines so I built a board with an 8255 PIO with some simple TTL logic to map it into the IO address space.

For cr0sh:
Quote
Whatever you do, try to keep the interface to that robot as -separate- from the base electronics as possible. What I mean by that, is use the interface as presented; don't go hacking at the internals of the base PCBs or anything. If there is an on-board port (like a DB25 or similar), use that. Pictures I have seen of similar vintage arm robots typically used such an interface, or have a ribbon cable terminated in an IDC connector or such (if yours has such a dual-row IDC connector - find or build a mating set of pins, perhaps mounted on a PCB with a standalone Arduino and FTDI interface or such).

Yes, good points. I always intended to use the existing interface. I found a couple of other projects on the web where they had replaced the internals for 'educational reasons' but I don't want or need to do that. If an 4 Mhz Z80 can drive this then I don't think I'll need to change it!

I'll keep you updated but don't expect immediate results - my projects are often incredibly slow!

5  Using Arduino / Project Guidance / How fast can Arduino Uno switch ouput pins? on: January 06, 2012, 07:10:23 pm
Hi all,

I have only just discovered 'Arduino' and I am looking for some advice on whether an Arduino Uno will do what I need.

My project it to drive a very old robot arm that was known as a 'Minimover 5' 25 years ago!
It has 6 x 4-pin stepper motors and presents a TTL (5 volt) interface which used to connect directly to a Commodore computer (but I did make a Sinclair ZX Spectrum interface back then). Now I want to drive it via USB.

The interface is really simple using 8 TTL level outputs. 3 are used to 'address' each of the 6 motors, 4 used to 'set' the stepper motor pattern, and 1 to 'strobe' the data into the stepper motor coils.

My question is: how fast can a Arduino Uno change the output pattern? That is, what is the maximum frequency that a single output pin can be switched on/off? As you can see, to move all 6 motors 1 step requires 6 patterns to be output and for each the strobe to be toggled = pattern/strobe on/strobe off... so probably 18 changes (IOs) to make all 6 motors 'simultaneously' move 1 step.
(I have a simple Velleman K8055 card but that can only manage 125 IOs/second which moves the motor(s) very slowly - I need something like 10 to 20 times that speed.)

I am thinking that the Arduino could host a basic "Robot OS" and take movement commands from a host PC via USB so a PC application (Java) will handle the high level functions and the Arduino application will handle lower level hardware driving.

Does this sound feasible? If not, any thoughts on what else I should consider?

Many thanks,
 - jon.

Pages: [1]