Mirroring an input
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
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
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 -->
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.
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 Savage
Parallax Tech Support
csavage@parallax.com