Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
LinkBack Thread Tools Display Modes
Old 7th March 2008, 11:32 AM   (permalink)
Default

Ron,

I'm no programmer. I did a little assembly language and BASIC many, many years age. I'm now into these PICAXE interpreted BASIC µCs. I tried starting with the BASIC Stamp, but could not see spending what they want for even for their lowest level chip. PICs also seemed to have a high startup cost with programming hardware and software. The PICAXE editor was free, the serial cable was homebrew, and the 8-pin Picaxe 08M is about $3, so almost a jelly bean IC like the 555. They recently introduced the 14M with more I/O, so I guess I'll treat that like a 556. Most of my applications have been slow, like LeeH68's, so have not needed the blinding speed of tight compiled code in the raw PIC's.

Ken
__________________
"To invent, you need a good imagination and a pile of junk."
Thomas A. Edison (1847 - 1931)
KMoffett is online now  
Old 10th March 2008, 07:36 PM   (permalink)
Default

Ron,

Thought that since I said I did it, I should prove it.

When the circuit is first powered there is no previous selection stored, so all three LEDs flash on and off as a warning. When any pushbutton is pressed, only the corresponding LED is lit, and that selection is stored in static ram. Subsequently, when any other button is pushed the current LED goes out, the new LED is lit and the new selection is stored. If power is lost and restored, the program recovers the last selection, and lights that LED.

Ken

P.S. The program has only been tested in the PICAXE simulator!
Sorry about the poor transfer of indents and tabs.

Code:
'1-of-3 Pushbutton/LED control...Simulation tested only
'PICAXE 14M
'Inputs 0,1,2   ...decimal 0=None, 1=Red, 2=Amber, 4=Green, 7=3 LSB
'Outputs 0,1,2  ...decimal 0=None, 1=Red, 2=Amber, 4=Green, 7=All
'For use with 1of3 Toggle 3.sch
'1of3toggle.bas
'Ken Moffett

Start:			'Power-up
	Let pins = 0		'Turn off all LEDs

Recovery:			'Check last LED selection before power-off
	Peek $50, b0		'Retrieve last LED selection from static memory
	b0 = b0 & 7			'Mask for lower 3 inputs
	'b0 = 0			'> simulated error <
	If b0 = 1 then LED	'Last PB was Red
	If b0 = 2 then LED	'Last PB was Amber
	If b0 = 4 then LED	'Last PB was Green
	Goto Flash			'Static memory $50 empty or invalid data	
	
LED:				'Store and turn on selected LED
	Poke $50, b0		'Store LED selection in static memory
	Let pins = b0		'Light selected LED
	Gosub PBup			'Check for PB up
	Goto PBdown			'Check if PB still down
	

PBdown:			'Check if PB still down
	b0 = pins & 7		'Retrieve and mask for lower 3 inputs
	If b0 = 1 then LED	'Red PB pushed
	If b0 = 2 then LED	'Amber PB pushed
	If b0 = 4 then LED	'Green PB pushed
	goto PBdown			'No buttons pushed
	
PBup:				'Check for PB up
	b0 = pins & 7		'Retrieve and mask for lower 3 inputs		
	If b0 <> 0 then PBup	'Check if any PB still down
	Return

Flash:			'Flash all LEDs until valid PB down
	Let pins = 7		'Turn on all LEDs
	Pause 250			'Pause 250 mS
	Let pins = 0		'Turn off all LEDs
	Pause 250			'Pause 250 mS
	Let b0 = pins & 7		'Retrieve and mask for lower 3 inputs
	If b0 = 1 then LED	'Red PB pushed
	If b0 = 2 then LED	'Amber PB pushed
	If b0 = 4 then LED	'Green PB pushed
	Goto Flash
	
End				'Halt program
__________________
"To invent, you need a good imagination and a pile of junk."
Thomas A. Edison (1847 - 1931)
KMoffett is online now  
Old 11th March 2008, 12:37 AM   (permalink)
Default

Way cool, Ken! That's definitely better than all those FFs and gates.
__________________
Ron (aka Rube)

Roff is online now  
Old 7th April 2008, 09:52 AM   (permalink)
Default

Just to close this out. Due to my inexperience with electronics I eventually used a Repol programmable relay (model NEED-024DC-01-08-4R). The supplier programmed it for me for a small fee.

Though this was probably a more expensive option - cost £65.00 each + £100 to have all 14 programmed it was certainly the simplest way and least stressful for me.

Many, many thanks to everyone who helped me with this, I wouldnt have got this resolved without your help.

Lee
LeeH68 is offline  
Old 7th April 2008, 08:37 PM   (permalink)
Default

It just seems to me that things are getting unnecessarily complex here and that some basic things are being overlooked.

Like I think the switches are rated up to 24 V and everyone here has assumed the OP wants to use 24 V. Or am I missing something?
HS3 is offline  
Old 7th April 2008, 09:39 PM   (permalink)
Default

I think this would work and it only requires 4 resistors, 2 diodes and one common transistor per switch.

The idea is that when one transistor is conducting it prevents the other two from doing so. Pressing the button starts that transistor to conduct and stops the other two. I cannot find any flaws.

Others can review it and calculate component values.
Attached Images
File Type: png SRT.png (1.3 KB, 9 views)

Last edited by HS3; 7th April 2008 at 10:41 PM.
HS3 is offline  
Old 10th April 2008, 05:31 PM   (permalink)
Default

HS3,

I think you may be right about the 24V's...and our assumptions. Maybe Lee could tell us what power supply was already in his system. ???

I had to try out your circuit, so ran it in a TINA simulator. 12v supply, 1k resistors for the LEDs and 10K for all others. All LEDs lit on initial power-up...then 1-of-3, as individual buttons are pushed.

Thanks.

Ken
__________________
"To invent, you need a good imagination and a pile of junk."
Thomas A. Edison (1847 - 1931)
KMoffett is online now  
Old 10th April 2008, 05:42 PM   (permalink)
Default

He already told us what his supply voltage is.
Quote:
Originally Posted by LeeH68
I have no idea what you both are talking about, but if its any help my PSU is 24V DC output and is 3Amp.
Lee
That doesn't necessarily mean it can't be regulated down, but LeeH68 would have to address that.
__________________
Ron (aka Rube)

Roff is online now  
Old 10th April 2008, 08:01 PM   (permalink)
Default

Ron,

I just couldn't remember, didn't want to go back through all the posts, and...he's already gone with a commercial solution. Still finding it interesting all the ways to do the same thing.

Ken
__________________
"To invent, you need a good imagination and a pile of junk."
Thomas A. Edison (1847 - 1931)
KMoffett is online now  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
latch and flip flop Badar General Electronics Chat 7 27th August 2007 11:00 PM
Making a J-K flip flop from a D-Type Flip Flop Terabyte General Electronics Chat 3 26th April 2007 09:02 PM
resetting a D type flip flop kasper General Electronics Chat 5 13th April 2005 07:32 AM
JK Flip Flop Question letsrelaythat General Electronics Chat 18 8th October 2004 10:47 AM
Need help with voltage flip flop please. goofy Electronic Projects Design/Ideas/Reviews 12 13th April 2004 01:06 AM



All times are GMT. The time now is 11:34 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker