One Shot Toggle and Repeat
Rob7
Posts: 275
Hi all,
O.K.
I now have all the hardware I need for my next project.
I am trying to toggle 4 pins (Output) set to read an input, at 5 vdc each pin. (I haven't forgot the input resistor.)
Read pin x, if high, toggle pin output x, repeat for that pin if input is high.
4 input pins
4 output pins
All 4 input must be read in parellel.
I have run thru the tutorial, I just can't seem to get it !
I must be brain damaged...
Help!!!!!!!
Can someone please show me the correct way to start the program.·I think with this help I can add more pins later and modify them to my applications.
Rob7
O.K.
I now have all the hardware I need for my next project.
I am trying to toggle 4 pins (Output) set to read an input, at 5 vdc each pin. (I haven't forgot the input resistor.)
Read pin x, if high, toggle pin output x, repeat for that pin if input is high.
4 input pins
4 output pins
All 4 input must be read in parellel.
I have run thru the tutorial, I just can't seem to get it !
I must be brain damaged...
Help!!!!!!!
Can someone please show me the correct way to start the program.·I think with this help I can add more pins later and modify them to my applications.
Rob7
Comments
I changed PRI to PUB to get it to load.
I cannot seem to get an high output from the inputs ?
Rob7
This was only a code fragment to illustrate something. I assumed that you've already set up the pins for input or output and that the input pins were 4 through 7 while the output pins were 0 through 3. The routine only reads the input pins once and toggles (or doesn't toggle) the output pins once. You have to call the routine each time or put it in a repeat loop. If an input pin is high, the corresponding output pin will be toggled every time the routine is called. Is that what you want? Maybe you need to give more information about what you're trying to accomplish, perhaps with a schematic drawing.
Mike
Sorry for the confusion.
The outputs work , I am having trouble with creating inputs to trigger the outputs.
I have attached the outputtest. spin program.
Here are the schematics for my input and output pcb's.
Rob 7
If you're going to use your existing circuitry, do check the output high and low levels with a voltmeter to be sure the voltage margins are adequate for the 3.3V CMOS inputs.
Overkill is right, However these boards were designed for another purpose. I can change the input resistance with the jumper resistor abd buffer all noise at the inputs.
Rob7
Then fiddle with the isolated input to see if the Propeller sees the proper signal level.
I will try it tonight !
Thanks Mike for all your help !
Rob7
-Phil
I have two short programs and they work seperate. I am trying to combine them to creat a pulsout program but I am having problems.
At the Outa := Pulsout I want to look down and run the pulseout string, but however I try. I cannot get it to work. Can someone please head me in the right direction.
Here is the combined program.
Thanks!
Rob7
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
If you want to call the routine from the BS2 object, you need a function call. Look at the comment in the routine for an example.
Since you've incorporated the routine into your own program, the "BS2." is not used. A statement like "PULSOUT_uS(4,500)" will
produce a 500us pulse. There is no such statement as "Low := Low". If you want pin 4 to become low, use "OUTA := Low".
It looks like you're trying to use statements from PBasic on the Propeller. The Propeller is very different, but not hard to understand. On the Stamp, in addition to statements like LOW and HIGH, you can directly access the direction register and the input and output registers as if they were 16 bit words. On the Propeller, that's all there is. You have to do it that way.
The BS2 object was written to help people make the transition from PBasic to SPIN by providing similar functionality, but they're
not exact replacements. The routines have to be called with a SPIN function call (which is a statement too) and sometimes several routines have to be called to do what one statement in PBasic will do (like SERIN or SEROUT) because these operations are not built-in.
Thanks Mike, for clearing that up for me.
Rob7