Show Posts
Pages: 1 ... 436 437 [438] 439 440 ... 584
6556  Using Arduino / LEDs and Multiplexing / Re: 595 & 4021 multiplexing on: May 10, 2011, 09:42:52 am
Just keep byte variables for each shift register, modify the bits in the variables then shift all of them out.

byte x = 0;
byte y = 0;

shiftOut (y...);
shiftOut (x...);

x |= B00010000;
y |= B00010001;

shiftOut (y...);  // turn on bits 0 and 4 in one SR
shiftOut (x...);  // turn on bit 4 in the other SR

y &= B1111110;

shiftOut (y...);  // turn off bit 0 in the other SR, bit 4 stays on
shiftOut (x...);  // no change here

6557  Using Arduino / Programming Questions / Re: how do i get a file off of uno? on: May 10, 2011, 09:39:57 am
So with hex, would I be able to translate it?
If you can find a dissassembler you can turn it back into opcodes, some even do a reasonable job with labels etc. But unless you're desperate or trying to reverse engineer some code I wouldn't bother.

6558  Community / Products and Services / Re: 15 dangerously Mad Projects for the Evil Genius on: May 10, 2011, 09:36:40 am
The object is suspended above the Arduino, is that to give you incentive to get the code right smiley

Looks like a fun book.

6559  Using Arduino / Programming Questions / Re: Bug in pinMode and digitalWrite - incorrect validation of pin parameter on: May 10, 2011, 09:21:45 am
Looks to me like the parameter is used to index directly into the digital_pin_to_port_PGM array with no checks.

extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )

6560  Using Arduino / Programming Questions / Re: Bug in pinMode and digitalWrite - incorrect validation of pin parameter on: May 10, 2011, 09:07:53 am
What file are those functions (digitalPinToBitMask/digitalPinToPort) in Nick, I can't find the bloody things, and neither can grep.

EDIT: Never mind, it's a #define
6561  Using Arduino / Project Guidance / Re: Arduino with shift registers to control 70 devices. on: May 10, 2011, 08:55:16 am
Here's one problem

#define TRIGGER_PULSE_WIDTH 16000000

Not sure what you get without the UL suffix but it's going to be a big number I think, then you do

digitalWrite (DATAPIN, i < TRIGGER_PULSE_WIDTH ? 1 : 0);

So until i gets to this "big number" you will always get a 1. Assuming the FFs are reset before you start (are they?) this will produce a traveling leading edge but no falling edge for "big number" * 9900uS.

Having said all that it may not make any difference as I would think the cameras trigger on the leading edge and you should still be getting that.

Also, having

Serial.print ("No. of cameras "); 
Serial.print (N_CAMERAS);
Serial.print (" Trigger Width ms ");

Inside loop() will not only be very annoying but seriously affect the timing.

Also the numbers being printed won't display because they will not be printable ASCII.

Here's a modified version
  Bullet time
Create a pulse on Data - 100ms long
Cascade it with a Clock transition across different cameras.
// No. of cameras in bullet time. This no. can also be greater than the number
#define N_CAMERAS 100
// 10ms delay for the camera. Thats a 100fps rate, and a 400% slowdown of the motion
#define TRIGGER_PULSE_WIDTH 10 // 100ms trigger pulse will switch on the camera

// Delay between switching each camera, slightly less than 10ms
#define DELAY 9900
  // 6 = Clk ; 7 = D
#define CLOCKPIN 6
#define DATAPIN 7

void setup() {               
   Serial.begin(9600);      // open the serial port at 9600 bps:
  // initialize the digital pin as an output.

pinMode(DATAPIN, OUTPUT);   
Serial.print ("No. of cameras "); 
Serial.print (N_CAMERAS, DEC);
Serial.print (" Trigger Width ms ");
Serial.println (TRIGGER_PULSE_WIDTH, DEC);

void loop() {

for (int i = 0; i < N_CAMERAS ; i++) {
   digitalWrite (DATAPIN, i < TRIGGER_PULSE_WIDTH ? 1 : 0); // puts 1 out for the first 10 pulses, then 0
   digitalWrite (CLOCKPIN, HIGH);
   digitalWrite (CLOCKPIN, LOW);
   delayMicroseconds (DELAY);


6562  Using Arduino / Project Guidance / Re: Arduino with shift registers to control 70 devices. on: May 10, 2011, 08:39:32 am
I'll have a deco at the code, but you should be able to prove the hardware by just touching the camera's trigger wire to one of the FF outputs. No need for clocks, just touch to Q and if that doesn't work /Q.

The camera works with a mechanical switch remote.
This worried me, mechanical switches just connect the trigger input to something, the question is what's that something, 5V, GND, ??. Do you have a schematic for the remote switch.
6563  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 08:05:04 am
I take back some of what I said before, given that we've determined the chip is static you could probably make a sort of CPU emulator that controlled the clock and looked at addresses then supplied data. A sort of hardware-based simulator.

Here's a good reference page

6564  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 05:58:56 am
How sad is that?
Pretty sad, but I think I can do better.

I used to lie awake at night dreaming of the 68000 and wondering what I could do if I could afford a processor as powerful as that.

And speaking of the 68k, the mob that makes the Z80 development board also does a 68000 board, complete with the 64-pin "aircraft carrier" pack CPU.

Who uses this stuff?

6565  Using Arduino / General Electronics / Re: Wiring a Z80 to Arduino... on: May 10, 2011, 05:43:55 am
Well it's been a while, I thought I remembered them as being dynamic.

It brings back memories.
Me to. I had a Microprofessor development board once and recently found out that they still make them. I couldn't believe it, but can't imagine who uses them.

I'm almost tempted to make a Z80 board just for the sake of a trip down memory lane. You can still buy the CTC, SIO, PIO, DART etc. I used Z80, Z8, 64180 and Z8000 over the years. In those days it was pretty much Zilog or Motorola. Then I went away from embedded stuff for 15 years and when I came back that had all changed.


6566  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Slave to Arduino Master SPI on: May 10, 2011, 05:08:36 am
As was just pointed out in another thread my spelling ain't reel good smiley I knows me numbers but have trouble wiff me lettuce.

6567  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 (");

6568  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

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.


6569  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.
6570  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.

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

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

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

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.

Pages: 1 ... 436 437 [438] 439 440 ... 584