![]() | ![]() | ![]() |
| | |||||||
| Notices |
| 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. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink (permalink)) |
| 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. Ken
__________________ "To invent, you need a good imagination and a pile of junk." Thomas A. Edison (1847 - 1931) | |
| | |
| | (permalink (permalink)) |
| 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) | |
| | |
| | (permalink (permalink)) |
| 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 | |
| | |
| | (permalink (permalink)) |
| 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. Last edited by HS3; 7th April 2008 at 09:40 PM. | |
| | |
| | (permalink (permalink)) |
| 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) | |
| | |
| | (permalink (permalink)) | |
| He already told us what his supply voltage is. Quote:
| ||
| | |
| | (permalink (permalink)) |
| 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) | |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Latest |
| latch and flip flop | Badar | General Electronics Chat | 7 | 27th August 2007 09:59 PM |
| Making a J-K flip flop from a D-Type Flip Flop | Terabyte | General Electronics Chat | 3 | 26th April 2007 08:01 PM |
| resetting a D type flip flop | kasper | General Electronics Chat | 5 | 13th April 2005 06:32 AM |
| JK Flip Flop Question | letsrelaythat | General Electronics Chat | 18 | 8th October 2004 09:46 AM |
| Need help with voltage flip flop please. | goofy | Electronic Projects Design/Ideas/Reviews | 12 | 13th April 2004 12:06 AM |