EET 253 Microprocessors Final Project -- please help

Here is my project in a nut shell: I have a game called Star Wars X-Wing Miniatures. The main web page is: here. I plan on making a play table that has inputs from two cannibalized joysticks and their buttons, two reed relays, a missile switch. The outputs will be: two servos or DC motors; 3 red bar graph displays; 3 amber bar graph displays; one blue bar graph display; and an mp3 shield from adafruit.

I am trying to incorporate an Arduino Mega 2560 with the computer interface we made for Microprocessor class. We are using QBASIC to write the program that will read sensors, control motors; pneumatics; lights; relays; etc..

The PCI card is plugged into the expansion slot. from the expansion slot it goes to the bread board. we are only using 10 of the 32 lines on the address bus. The expansion slot is identified as the port 30016 or 1100000002 or 76810.

My professor says we do not need to use AND gates when we are outputting to any output other than 1, 2, 4, 8, 16, 32, 64, and 128. We can have outputs from 1 to 255. So, say you are outputting to 3, the code may look like this:

10 OUT 768, 3 REM output to interface data line 3
20 SLEEP 1 REM wait one second
30 OUT 768, 0 REM turns off all outputs
40 SLEEP 1 REM wait one second
50 GOTO 10 REM go to line 10

"REM" is short for remark or comment.

What I am asking is can the Arduino differentiate between output 1 and output 3? or do I need an AND gate for the Arduino to only be activated by the output of data line 1 and 2 (which combine to make output 3)?

I have attached the a screen shot of the interface schematic.

I can send the multisim file, if somebody can open it and view it. PM your email for the file.

The Arduino is a microcontroller and fully capable of performing an AND operation. If you want a better answer, ask a better question.

Ok, I will try again. How do I do an and operation? Is it possible to have the two to eight 5v signals going to a single digital pin or do I have to put each one to its own pin?

Another question I have is: how do I slow down a DC motor? I tried resistors, but all that did was prevent the motor from receiving enough voltage. Do I lower the amperage? If not, what do I alter to get a slower RPM?

  1. One pin per digital signal
  2. Use a motor controller and a PWM signal to control the speed of a motor.

I will have too many inputs for my Mega if I connect the lines to one digital pin each.

I think I am going to use a servo instead.

Thank you

Then use a port expander or gates before the input if you only want an AND or OR function.

How do I do an and operation?

The bitwise AND operator is &

so the 0x2 & 0x4 = 0x6 0x0

Edit:- corrected example which is now not much use so here is another:-

0x3 & 0x1 = 0x1

so the 0x2 & 0x4 = 0x6

That's an OR :slight_smile:

0x2 & 0x4 = 0
0x2 | 0x4 = 0x6

Pete

That's an OR :slight_smile:

So it is. :slight_smile:

Thanks.

I do not know if I said this, but I am new to programming. Especially, Arduino. Do I need to initialize digital inputs?

If so, is it done like this:

int startPin = 23

el_supremo:
That's an OR :slight_smile:

0x2 | 0x4 = 0x6

If this is an OR, then how is the result 0x6?

Or these two values:
00000010 (=2)
00000100 (=4)

And what do you get?

00000110 (=6).

ChilliTronix:
Or these two values:
00000010 (=2)
00000100 (=4)

And what do you get?

00000110 (=6).

It has been a while since I had Digital Electronics.

Do I need to initialize digital inputs?

If so, is it done like this?

int startPin = 23

[/quote]

Do I need to initialize digital inputs?

Yes

If so, is it done like this?

No

You use the pinMode function call.