Show Posts
Pages: 1 ... 435 436 [437] 438 439 ... 582
6541  Using Arduino / Programming Questions / Re: Streaming library - now that's cool! on: May 10, 2011, 05:04:43 am
He he, my speling never was reel good. How's this

Serial.print ("Invalid IO regastor (");

______
Rob
6542  Using Arduino / Networking, Protocols, and Devices / Re: Serial Frame on: May 10, 2011, 04:54:00 am
A frame is simply a series of bytes in a format that has been agreed on by both ends of the comms link. What Crossroads suggests is as good an example as any for a very simple application and even has some error checking and acknowledging which most protocols at this level don't.

Or you could simply do something like this

Code:
Serial.print ('<');
Serial.print (pinNum, HEX);
Serial.print (pinVal, HEX);
Serial.print ('>');

which would send say "<11234>" and the receiver splits the 1 and the 1234 to get the pin number and the value. The < syncs the receiver and tells it to start reading characters and the > tells it to stop and parse the data. If the data is fixed length you don't need the >.

A more sophisticated version may be like this



Which has addressing, a frame sequence counter, data length, command and a CRC.

Really it's up to you to decide now you want to do it. Do a search for "communicating between two Arduinos" or some such, this comes up about twice a day.

______
Rob

6543  Using Arduino / Programming Questions / Re: software reboot on: May 10, 2011, 04:36:34 am
You can do

asm ("jmp 0");

It's not a hardware reboot but will restart the code.

But as AWOL said, fix the probems, rebooting should never be the answer unless you're using a watchdog timer in a critical enviromnent and there's just no way to recover.
 
______
Rob
6544  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 04:31:41 am
I can think of so many issues here I hardly know where to start.

You can't supply a clock signal to the Z80 from an IO port, you need a high frequency, about 2-4MHz.

The Z80 has NO IO pins, everything is memory or IO mapped at high speed. There is no practical way to directly connect the two chips. You will need latching hardware but the Z80 still needs ROM and RAM to run.

Quote
But the Z80A started to get very hot
The Z80 may just run hot, it's a very old chip.

Quote
I've had hard times to find it, I'd rather not burn it!
Z80s are still produced and easily found.

Quote
when I spy the addresses required by the Z80A,
What do you mean "spy the addresses"?

Quote
I've just written a program for the arduino to send 0xC3 (JP) when the 0 address is requested, or 0 for any other address, so it will code a JP 0 and forever loop.
How will you do this? You have to test the 16-bit address against 0000, turn the data direction around on an Arduino port, then write 0xC3 followed by 0x00 and another 0x00. All within the cylce time of the Z80.

If you just want to test the Z80 you can easily do that by pulling all the data lines constantly low (00 = NOP), the Z80 will cycle the entire memory map and you can view the address lines with a scope.

I must say I love the idea of building a Z80 computer, just for the shear retroness of it, but I don't see how an Arduino can really help unless you want to make what is affectively an EPROM emulator.

In this case the Arduino can be very useful.

To do this your Z80 needs RAM and IO chips and per normal, it also needs an EPROM to run the code from but you substitute a RAM for that and dual-port it with some octal buffers. Now you have an EPROM emulator and you can compile Z80 code and download the HEX file to your Arduino which in turn dumps it into the RAM that is emulating the Z80s EPROM.

It's much easier than I probably made it sound.

I've done similar many times (a while back I admit) and can help if you really want to do it.

______
Rob
 
6545  Using Arduino / Programming Questions / Re: Streaming library - now that's cool! on: May 10, 2011, 04:04:58 am
I've been using it for a while, you can insert functions that return a string as well

Code:
Serial << PadString (r.name, 8, '-');

to print a string padded with ----- to a width of 8 for example.

I far prefer

Code:
Serial <<  "Invalid IO registor (" << parms[0] << ") for the " << SERVER_PROCESSOR << endl;

to

Code:
Serial.print ("Invalid IO registor (");
Serial.print (parms[0]);
Serial.print (") for the ");
Serial.println (SERVER_PROCESSOR);

______
Rob
6546  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Slave to Arduino Master SPI on: May 10, 2011, 03:35:22 am
Nobody spotted the deliberate error then?

Code:
for (x = 0; x < 8; x++) {
  pulse clock pin;
  data[i++] = PORTA; // all the 0 bits
  data[i++] = PORTB;
  data[i++] = PORTC;
  data[i++] = PORTD;
  data[i++] = PORTF;
  data[i++] = PORTG; // all the 7 bits
}
tell ADCs to start a new reading.

I thought about it while moving camp today but was out of range and anyway had to drive all day.

______
Rob
6547  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Slave to Arduino Master SPI on: May 09, 2011, 08:36:02 pm
If using SPI hardware I don't think there's any argument that daisy-chained has to be the most efficient, there is NO overhead for multiple slaves apart from an initial "load data" signal (and not even that if you are reading directly from ADCs). After that you can read a 1000 slaves with no extra handshaking.

Note that I haven't actually done this, there may be a gotcha I haven't thought of.

The drawing shows a parallel approach that has to use bit banging. This puts it behind the 8 ball for speed for starters, but the more inputs you have the better it gets and there will be a point at which it will be faster that daisy-chaining using the SPI hardware. What that point is I don't know.

For example if you have a Mega you could feed say 48 ADC MISO signals into the processor, The code would look something like this

Code:
data[i++] = PORTA;
pulse clock pin;
data[i++] = PORTB;
pulse clock pin;
data[i++] = PORTC;
pulse clock pin;
data[i++] = PORTD;
pulse clock pin;
data[i++] = PORTF;
pulse clock pin;
data[i++] = PORTG;
tell ADCs to start a new reading

Assuming that the various port pins are all available and only 8 bits per reading. This data will of course have to be reconstructed later.

If you need faster then the next thing to do is add hardware.

The drawing shows 8 sensors going to a single ADC, are they 8-input chips? What sample rate do you need?

At 8 bits each that's 1024 bits of data, have you done the maths? At the end of the day all this data has to get to a PC and AFAIK the fastest you can do this from an Arduino is 115200bps (via USB anyway, maybe using Ethernet would be faster).

______
Rob
6548  Using Arduino / Networking, Protocols, and Devices / Re: I need a message bus on: May 09, 2011, 07:33:07 pm
Yep I know about 485, in fact that's what I'm using.

Quote
Signal + return.
I thought this meant 1 signal line.

With most 485 transceivers I don't think it's practical to detect clashes at the bit level which is a nice feature because the clash can be made non-destructive, ie the winner carries on and there's no loss of data.

I was doing bit-level detection but decided that byte-level detection was good enough, this means that by the time a clash is detected the damage is done and both transmitters will have to try again.

In my single-master protocol this is not very important, it might be for you though depending on how many masters there are and the frequency they want bus access.

What's the application?
______
Rob
6549  Using Arduino / LEDs and Multiplexing / Re: How many LED's can you run off an Arduino Uno on: May 09, 2011, 10:55:48 am
Of course, I was thinking 200mA total with what goes in VCC comes out GND. But that's not the case when driving IO.

______
Rob
 
6550  Using Arduino / General Electronics / Re: Isolated N to N volts on: May 09, 2011, 10:30:48 am
Trouble is I want the DC power supply to be isolated as well.

______
Rob
6551  Using Arduino / Project Guidance / Re: Arduino with shift registers to control 70 devices. on: May 09, 2011, 10:23:31 am
Quote
I am currently using 3.3V
Then it looks like it's not OK. I can't remember, is there any reason not to use 5v? Even if there is it would be a quick test to see if that's the problem.

______
Rob
 
6552  Development / Suggestions for the Arduino Project / Re: Crystal vs. Resonator (Arduino Uno) on: May 09, 2011, 10:03:22 am
Quote
any issues could be resolved.
Yep, I doubt they'd be the first with a clock signal running around a board.

EME => ElectroMagnetic Emissions.

______
Rob
6553  Using Arduino / Networking, Protocols, and Devices / Re: I need a message bus on: May 09, 2011, 09:55:15 am
I'm working on something at the moment but it's not that fast, needs two signal wires, and is only single master. Apart from that it's perfect smiley

100kbps on one wire, offhand I can't think of a PHY layer that will do that except of course Ethernet.

There are 1000s of proprietary protocols around maybe one of them will do this. But I assume you want to DIY or at least get something open source.

______
Rob

6554  Development / Suggestions for the Arduino Project / Re: Crystal vs. Resonator (Arduino Uno) on: May 09, 2011, 09:46:52 am
I often wondered why they didn't make use of the free (and more accurate) clock from the 8U but never even bothered to look and see if it was available.

Maybe that big chunky 16MHz signal running half way across the board would be an issue for EME certification.
_______
Rob
6555  Using Arduino / Networking, Protocols, and Devices / Re: I need a message bus on: May 09, 2011, 09:25:30 am
Quote
(2 wires)
Two signal wires or two wires including earth return?

How fast?

______
Rob

Pages: 1 ... 435 436 [437] 438 439 ... 582