Shop OBEX P1 Docs P2 Docs Learn Events
Mirroring an input — Parallax Forums

Mirroring an input

ryan.elkholyryan.elkholy Posts: 6
edited 2006-08-03 01:14 in BASIC Stamp
Hello,

I made a simple program that takes 4 inputs and replicates their states (high or low) on 4 output pins. I hooked it up to 8 led's just to monitor it. My program looks like this:

pin1in VAR IN0
pin2in VAR IN1
pin3in VAR IN2
pin4in VAR IN3
pin1out· VAR OUT4
pin2out· VAR OUT5
pin3out· VAR OUT6
pin4out· VAR OUT7

pin1out = pin1in
pin2out = pin2in
pin3out = pin3in
pin4out = pin4in

End

When· I hooked it all up and ran the program I had the first four input LED's lit (obviously because I hardwired that to a 5V power supply), but the output was not replicated. The 4 output LED's were off. I was wondering if I made the right program for this. Or another thought that I had was that it was supplying a high to the output and that it was just not enough power to light the LED's. But even so, they should light up, but just be a little less bright. Any help is greatly appreciated!

Ryan

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-02 21:20
    Ryan -

    You can go through all of that, or if the inputs and outputs are contiguous, you can do something as simple as this:

    OUTB = INA 'Make pin ports 4-7 reflect pin ports 0-3

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • T ChapT Chap Posts: 4,223
    edited 2006-08-03 00:03
    Do you have a resistor between the pins and the leds on the outputs?

    Have you tried both direcvtions on the leds to make sure they are connects right?

    Have you put a meter on the 4 outputs when they should be high?

    Are you sure that whatever you are doing with the leds on the input aren't preventing a solid 1 from getting to the inputs?

    Your description of your test is a little hard to understand. Are you switching the inputs on and off or are the inputs hardwired to the +V? If you are switching then obviously you'd need to be looping the program and not ending it after one pass through.
  • RinksCustomsRinksCustoms Posts: 531
    edited 2006-08-03 00:47
    DO

    OUTB = INA

    LOOP

    This program will run until you pull the plug, mirroring what you put on the input pins. and it might be possible that the output led's are backward. As i was taught many moons ago, if the circuit doesn't work, pull the power & dbl check

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Definetly a E3 (Electronics Engineer Extrodinare!)
    "I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-03 01:14
    None of the above will work until you set the DIRS for the output pins to be outputs.· Until then those pins aren't connected to the outside world.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.