Parallax Propeller for a time
HobbyCoder
Posts: 8
Greetings,
I have been using a Parallax Propeller for a time, however... I have encountered an issue with determining the state of a push button. I am pretty sure this is a software issue at this point, not a hardware issue. The push button is called INT.
How do I make sure that it only turns on pin 17 when the button is down?
EDIT: to specify, the issue is that the code believes that the button is always down.
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:51:13 AM GMT
I have been using a Parallax Propeller for a time, however... I have encountered an issue with determining the state of a push button. I am pretty sure this is a software issue at this point, not a hardware issue. The push button is called INT.
' EMS ' ' Energy Management System '************************************************************************************** 'Summary: This is a home energy management system. '************************************************************************************** 'File: EMS.spin '************************************************************************************** 'Correct Function: This system should control energy distribution '************************************************************************************** ' CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 High = 1 Low = 0 Out = %1 In = %0 ' VAR Byte INT 'Interrupt Pin Byte Q1 'Quandrant 1 Pin Byte Q2 'Quandrant 2 Pin Byte Q3 'Quandrant 3 Pin Byte Q4 'Quandrant 4 Pin Byte A1 '(TEMP) Arg 1 Byte A2 '(TEMP) Arg 2 Byte A3 '(TEMP) Arg 3 ' PUB Start INT := 1 Q1 := 2 Q2 := 3 Q3 := 4 Q4 := 5 A1 := 0 A2 := 0 A3 := 0 'DirA[noparse][[/noparse]INT] := In DirA[noparse][[/noparse]Q1] := Out DirA[noparse][[/noparse]Q2] := Out DirA[noparse][[/noparse]Q3] := Out DirA[noparse][[/noparse]Q4] := Out Repeat 500 if (InA[noparse][[/noparse]INT] = 1) DirA[noparse][[/noparse]17] := Out OutA[noparse][[/noparse]17] := High WaitCnt(5_000_000 + Cnt) 'ONE-HALF SECOND WAIT End ' PRI End ' 'INDENTION IS IMPORTANT IN SPIN: There are no ENDIFs, END REPEATs, END SUB, etc.
How do I make sure that it only turns on pin 17 when the button is down?
EDIT: to specify, the issue is that the code believes that the button is always down.
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:51:13 AM GMT
Comments
Hope this helps.
Or why not just continually copy the input of INT out to Pin17 (or the logical inverse, depending on how the switch is wired)?
Cheers!
Paul Rowntree
Since this is an interrupt button, i want it to be high when pushed. I think that is how I have it set up. I have attached a relatively high resolution image of the current configuration.
Post Edited (HobbyCoder) : 1/10/2009 11:34:40 PM GMT
I would read the propeller education labs. These lessons wire up switches and read them.
John Abshier
Make sure your switch is right looks strange.
PS. edit your first post and add a subject liine.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
www.parallax.com/Portals/0/Downloads/docs/prod/prop/Web-PELabsFunBook-v1.0.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob
as you seem to have to learn about electronics I recommend before connecting a circuit to the propeller
to check it with a digi-multimeter voltages AND current flowing through the circuit.
Especially flowing to that wire that is connected to the Propeller-IO-Pin.
You have to connect it to +3.3V and check it AND to connect it to ground=0V
If you define an input-pin accidently as an output pin the output could be switched to HIGH= 3.3V and Ground=0V
In both cases the current should stay below 30mA. Otherwise you are in danger to fry your propellerchip
best regards
Stefan