Shop OBEX P1 Docs P2 Docs Learn Events
LED switch — Parallax Forums

LED switch

NewzedNewzed Posts: 2,503
edited 2006-06-20 16:31 in General Discussion
Here is a neat little program, adapted from an earlier post about LED Touch Sensors.· It will work on any Stamp, using any two adjacent pin headers.
When the CHG pin goes high the program jumps to a little routine which toggles an LED on Pin 14, but it could jump to a GOTO, a GOSUB, or anything you like.· You don't really have to touch the LED - just momentarily block off the ambient light.· I had it working in several light levels.· The only thing is, if the ambient light level gets too low then CHG will stay high.· Different LEDs will probably work different - I'm using a resistorized diffused high efficiency red LED.· I've got a 31 cent pushbutton!!

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html

Comments

  • tperkinstperkins Posts: 98
    edited 2006-06-06 01:00
    Searching "LED touch" and "LED sensor" does not find the thread. Could you please post a link or a circuit?

    Thank you, Tom Perkins
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-06-06 01:06
  • NewzedNewzed Posts: 2,503
    edited 2006-06-06 11:44
    Tom, there is really no circuit -just plug an LED into two adjacent pins and the program does the rest.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-06 12:28
    Sid -

    PLEASE correct me if I'm wrong here, but if some poor rookie ran across your "LED Switch" posting and program, slapped any old LED across two Stamp pins and ran the program, he may stand a good chance of blowing a Stamp pin?

    If I understand the program correctly, I'm not sure that "I'm using a resistorized diffused high efficiency red LED" is enough of a forewarning. Perhaps you might want to add to the original post: "A resistor is REQUIRED in series with the LED. Failure to do so ... etc".

    My apologies if I'm mis-understanding what's happening here. I'm just a software guy smile.gif

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • NewzedNewzed Posts: 2,503
    edited 2006-06-06 12:35
    You are correct, Bruce.· Should have added a warning - just thought everyone knew you had to have a resistor in series with the LED if it is not resistorized.· The LED is only on for 1ms - do you think that would damage a Stamp pin even without the resistor?

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-06-06 12:54
    Sid -

    I guess there are really two anwers to your question:

    1. The program provides for EASILY changing the delay parameters, so what are the chances that this proposed "rookie" ISN'T going to fool with them?

    2. This "rookie" might be a student, as well as 6' 4" 325# pulling guard on the UCLA football team. Are you willing to take the chance that he won't find out where you LIVE? smile.gif

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Russ FergusonRuss Ferguson Posts: 206
    edited 2006-06-06 13:13
    Sid:

    Thanks for posting your work on this. I have been watching the other topic on this subject and wanting to spend some time playing with it myself.

    Have you tried using an LED display to do this? Maybe something like - touch the top of the display to toggle ON and the bottom to toggle OFF. Or maybe to move a servo arm one way by touching the top and then the other way when you touch the bottom.

    Russ
  • NewzedNewzed Posts: 2,503
    edited 2006-06-06 14:04
    Hi, Russell

    I using just a single LED at the moment.· Since it toggles each time you block the ambient light, I didn't even consider another one so I would have an On-Off switch.

    The present sequence takes 12ms plus overhead, which means in could be inserted in a servo pause or almost anywhere.· I playing around with the polltime to see how much I can shorten that.· What I have in·mind is setting up the switch routine as a GOSUB, then I can just call it from anywhere.· I'll post any results of the polltime duration here as soon as I finish.· I want to try a green and a yellow to see what difference they make.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • NewzedNewzed Posts: 2,503
    edited 2006-06-06 14:48
    Russell, I finished playing around.· I can't give you any hard and fast rules, but generally speaking, polltime is directly dependemt on the ambient light level - the higher the light level, the shorter you can make polltime.· There also differences between each LED.· I tried seveeral red ones, all from the same shipment, the the minimum polltime for each one varied.· I also found out, as I think Tracy Allen stated, that green LEDs are much more sensitive the red LEDs, so I have switch to a green one and have the polltime set at 5ms.· It was borderline at 3ms so I went back to 5ms to give me a bit of cushion.· Cycle time is now down to 7ms plus overhead, which really isn't too bad - I can stick the GOSUB almost anywhere.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • NewzedNewzed Posts: 2,503
    edited 2006-06-06 17:00
    Russell, I have an AppMod with two 595s driving two 2803s.· When turned on the 16 LEDs flash in a predetermined sequence.· Just for kicks, I inserted my LED switch program into the AppMod program as a GOSUB.· Now, when I turn the Stamp on all the LEDs flash as they should.· Pass my finger over the green LED - all LEDs go out.· Pass my finger of the green LED again and all the LEDs start flashing.· Neat!!

    I have attached the program so you can see just what I did.

    Sid


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-06-06 17:38
    While I really don't need another project right now [noparse][[/noparse]the Propeller has completely swamped my learning curve],
    this one really is excellent.

    I have a 'bar' of 5 and a 'bar' of 12 leds which may act as a kind of pre-packaged slide switch.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Russ FergusonRuss Ferguson Posts: 206
    edited 2006-06-06 17:40
    Sid:
    You have made it look pretty simple. I've have got to find some time to play with this myself!

    It seems to me that this concept could be used to select a program to run on a BOE-BOT, or some thing like that. With two LEDs you could count to 4 menu options by having them on most of the time in a display mode. When they are in switch mode then then one led would be used to increment the menu item count and the other to select the item.

    Need some time to play with this...
    Russ
  • tperkinstperkins Posts: 98
    edited 2006-06-06 18:12
    I confess I don't think I'd blown up an LED. But I would never have thought an LED could make that good a photodiode. The movie was awesome.

    Thank you, Tom Perkins
  • RGuyserRGuyser Posts: 90
    edited 2006-06-06 22:18
    yeah - that video is excelent!

    i suppose i is even a 'simple' project, almost... connect a LED matrix, figure out the code to read the LEDs as a switch, scan the rows, have a PC application display the data... a VB to macromedia flash interface would be great for this...

    so, get the position, send it to VB, have VB send a 'height' variable to a macromedia movie... this could become quite a dramatic interface system for art\interactive stuff..
  • NewzedNewzed Posts: 2,503
    edited 2006-06-06 23:09
    Russell, in the last routine - turnon: - I changed

    if chg = 1.......

    to

    if chg = 0 ...............

    Turned the Stamp on, all 16 LEDs were flashing.· Turned my desk lamp off, they all quite flashing.· Turned the desk lamp back on and they all started flashing again.· This would make a great little device to turn outside lights when it got dark.· By adjusting polltime you could even turn on lights when it got really cloudy.

    I'm going to try to add another LED switch to my board and see if I can run them both at the same time, but have them do different things.

    Sid





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Tronic (Greece)Tronic (Greece) Posts: 130
    edited 2006-06-07 11:49
    I tried the code with several LEDs and it worked fine.·From all the Leds·I tried the old yellow ones·worked·really well. No luck with the clear package high brightness·Leds (blue,red,green etc) but I guess it because of the higher demands on voltage...

    Its really exciting to see parts like that to do work other than they designed to do!!! Really cool!! I might intergrate it on my next project! smile.gif

    Regards Thanos



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Greekbotics: Greek Robotics Forum
  • NewzedNewzed Posts: 2,503
    edited 2006-06-07 15:25
    I added another LED switch to my setup.· Did away with the AppMod and am just controlling two red LEDs.· Rather than explain what I did, I am attaching the program.· It appears you have to have a separate
    LED On/Charge/Input routine for each switch - I ran into a conflict when I tried to run them simultaneously.· The program for the two switches only takes 108 bytes.· I am using green LEDs for the switches.· I need to make a little board to hold the LED switches - I think it would be a mechanical improvement.· Then I'll try for four switches.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

  • NewzedNewzed Posts: 2,503
    edited 2006-06-07 21:37
    Bruce Bates mentioned that I had forgotten to put a note in my original post about using a resistor in series with the LED and I agreed.· However, I got to thinking about - with a polltime of 10ms, the LED has a duty cycle of about 8 percent.· I felt that a standard LED would operate·OK at that duty cycle so I replaced one of the resistorized LED switches with a regular green LED.· It seemed to run just fine while I was taking a shower, but I noticed that the regular LED, which was a somewhat darker·green, would sometimes·switch on its own.· I increased the polltime·to 13ms, which made the duty cycle about 6 percent.· Now it operates just like the other switch.· I am not recommending - or even suggesting - that you use an LED without the series resistor.· I'm just reporting my own observations.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • NewzedNewzed Posts: 2,503
    edited 2006-06-08 23:25

    Finally got my quad LED switch going. A little aside - having my little SuperMill is just great - need a simple little board, I just lay it out, go out to the shop and in 30 to 45 minutes I’ve got my little board, all nicely etched and drilled.

    To press on, I have 3 green LEDs that perform tasks when they are activated. The fourth LED is a red one, and it acts like a panic button. Activate it and the program goes into STOP mode. You have to reboot to continue.

    I made a little cable for the green LEDs that plugs into the AppMod adapter – keeps the BOE clear. The red LED plugs into Pins 1 and 3 on the header alongside the BOE.

    I connected my O’Scope to one of the switch LED pins to measure the cycle time. The elapsed time from when a switch starts its routine to the time it starts it again is about 86ms.

    If you decide to build one of these switches, be sure you remove ALL traces of flux. Just a tiny bit of residue on the LED pins wreaks havoc with the timing and the CHG pin will never go high.

    I have attached the program just in case.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

  • NewzedNewzed Posts: 2,503
    edited 2006-06-12 19:13
    I liked my Quad LED switch so much a made a special board for it, complete with Stamp.· A picture is attached.

    The Stamp drives a ULN2003 in response to a switch activation.· As Chris Savage pointed out, if Pin 9 of the 2003 is left unconnected, the 2003 functions like a normal 7-transistor array and can drive almost any non-inductive·device.

    I had posted some questions·on the Basic Stamp forum about the possibility of serouting via the 2003 and the consensus was "Probably".

    I didn't have another BOE immediately available, so I hooked my O'Scope to output Pin 16 of the 2003, which was also driving an LED, and modified my program so that when Switch·1 was activated in would serout
    %10101010 to Pin 1 of the 2003.· The scope displayed what appeared to be the same thing except it was inverted, which I had expected.· It appears the 2003, with Pin 9 disconnected, will handle serouts which makes this a really flexible board.· I'll have to hook another BOE to prove this out, of course, and I think I'll change the baud rate to 2400 instead of the 9600 I used for the test.· I did not have a pullup resistor on Pin 16 - I think leaving the LED in place served as a pullup.· I'll have to look into that further.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    450 x 338 - 10K
  • NewzedNewzed Posts: 2,503
    edited 2006-06-13 19:34
    I modified my Quad LED program so that when Switch 1 was activated:

    if chg1 = 1 then
    serout 8, baud, [noparse][[/noparse]"A", "B", "C"]
    toggle 8
    pause dly3
    endif

    Pin 9 of the 2003 was floating.

    I hooked up another BOE and connected a wire from Pin 8 of the Quad LED to Pin 0 of the BOE.· Baud for the Quad was set at 16780 and for the BOE at 396.

    When both Stamps were programmed I connected my serial cable to the BOE.· When Switch 1 on the Quad was activated the BOE displayed:

    Received A· B· C

    I guess that proves that.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • ArmageddonArmageddon Posts: 6
    edited 2006-06-16 01:51
    ·· I'm curious how the switch works.· What is acting as the capacitor that is being charged and discharged?· Is·it the input gate on the basic stamp I/O pin? Maybe the LED itself is acting as a capacitor?

    ···I did alittle experiment outside the stamp circuit to see what is happening.·· I reverse biased a LED and pointed light at it.· When I do this, my multimeter shows a current of less then 1uA. Am I doing something wrong?· Is a diffuse LED somehow important?
  • gadgetgadget Posts: 6
    edited 2006-06-16 08:28
    Sid

    Cool project. Just curious, while using a green led found that if I reversed the connections the led would still react to light? If I use yellow or red then the anode must be connected to pin 1 to work. Also to be sure I have this right are the leds supposed to blink? Haven't made it to your quad program yet still running through all the options of what can be done with your program. Thanks.

    Cheers, Michael
  • NewzedNewzed Posts: 2,503
    edited 2006-06-16 12:27
    Micheal

    You can perform any task you like when the CHG pin goes HIGH.· I have been playing around with the Quad, and first of all, I found out that everything still works if Pin 9 of the 2003 is tied to 5VDC, and that the 2003 can perform any task.· For instance, here is the routine for Switch 1:


    'if chg1 = 1 then toggle 8
    'if chg1 = 1 then gosub blink1
    'if chg1 = 1 then gosub talk1

    blink1:
    for x = 0 to 5
    toggle 8
    pause 500
    toggle 8
    next
    return

    talk1:
    serout 8, baud, [noparse][[/noparse]"A", "B", "C"]
    return


    I just uncomment whichever of the three options I want to use.· In the first option, Pin 8 could turn and LED On or Off, or I could connect it to an external relay to to control a peripheral.· The first board I made only used 4 of the 2003's 7 outputs,· I am making another board what will use all seven 2003 outputs.· Then I will have a very flexible control panel that can perform any number of tasks.· The 4 LED switches and the 7 2003 outputs leave 1 I/O pin, plus Pin 16 for debugging, which is OK since this is just a control panel and does nothing else.

    The serout option talks to a BOE, which could interpret the command received to perform any task I desire.

    I have found that the LEDs for the switches can be standard LEDs without the normal limiting resistor since the duty cycle is quite low, and I will use these on the new board to see if they will hold up over a long period of time.

    Sid




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-06-17 15:40
    I have a couple of questions about using LEDs as touch sensors.

    1. Has anyone tried an Analog to Digital input?·
    The 8x8 matrix in the video appears to be responding in that way and it would be nice to use the LED as more than a toggle.

    2. Has anyone tried more exotic LEDs?·
    Seems there are narrow band and broad band versions that provide faster responose times.
    I acquired what I think are IR photo diodes [noparse][[/noparse]labled in cryptic Chinese] that I was considering using instead of CdS photoresistors on a robotics project·[noparse][[/noparse]they may be too narrow band for tracking daylight]. · I also have one other photo diode that senses in the daylight range and I wonder about trying it.· In doing some Googling, I come up with more options and more questions.· There are also P-I-N- diodes that seem very responsive as they work with microwaves, but I am not exactly sure what they might offer.

    I suppose that it is easiest to 'keep it simple stupid' and use the generic colored·diodes as they work and come in a prefabricated matrix, but an ADC input still appeals to me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • pjvpjv Posts: 1,903
    edited 2006-06-17 17:43
    Hi Kramer;

    This is a very interesting and broad subject. Let me see if I can shed some more light on it......... (pun intended)

    Regarding A/D input: As I normally use a "virtual" A/D in SX applications..... you know the two resistor and one capacitor plus a few lines of software trick, I have experimented with detecting light levels from photo transistors, and photo diodes, as well as regular diodes. While I really like the simplicity, flexibility and low cost (about 5 cents) of the virtual A/D, unfortunately its input impedance is not super high...... a few megohms at best. Hence one has to be very aware of that fact when working to use it to detect light levels using regular LEDs as sensors. To get a significant response, the LED's load impedance needs to be very high; 10 MegOhms or grater if possible. With some consideration the virtual A/D can probably made to work at 2 Megohm, or possibly 5 Megohm input impedance. At levels higher than that, the SX input leakage currents can get in the way and distort things.

    Using regular photo diodes will give increased performance since they are optimized for sensing light, rather than an LED whose principal purpose it is to emit light. Essentially, they are a very small current source, providing electrons as a function of incident light level at some frequency(ies). These devices have good predictable response times, and work great with a virtual A/D, even with somewhat lower impedance levels. PIN diodes are extremely fast, typically responding in a mere 2 or 5 nano seconds; a "must" for high speed optical communications such as fiber.

    And then of course there are the photo transistors which detect light similar to the photo diode, but include gain on top of that detection, and hence bring the sensitivity up another level. Typically they are slower than photo diodes due to capacitance in the base junction. Sometimes the base of the transistor is pinned out so you can mess with the detection parameters.

    Darlington photo transistors are again more sensitive, but they suffer horrendously from slow speed due to the internal capacitances of the first trasistor's junctions being effectively "multiplied" by the gain of the second transistor. But great sensitivity at very slow speeds. Due to the unpredictability and temperature sensitivity of the gain of the cascaded transistors, it can be very difficult to use these devices in ambient light conditions. Reliably setting detection thresholds with these devices is a very frustrating exercise. Temperature excursions alone can vary the "idle" current over a range of 10,000 to 1; a very difficult issue to deal with for stable operation.

    One way to improve rejection of ambient sources (visible or infra-red) is to use a light source that is pulsed at some frequency, and then look for that frequency in the signal detected by the receiver. This is sort of akin to "DSP", and I have done this with an SX operating a 20 foot open air optical link in sunlight at 115 Kbaud. So, lots can be done if you put some thought to it.

    One significant variant in light detection with ordinary emtting LEDs is the "beam width" angle of the lens. Reciprocity tells us that the range of emission angle will be the same as the acceptance angle. So very conveniently one can light up the LED, determine its principal emission distribution, and the be confident that it's reception zone will be the same angle! Many of the modern bright LEDs have a very narrow emission angle.

    I have not yet experimented with irradiating various clear lensed "coloured" LEDs with different colours; such as hitting a "yellow" LED with light from a "red" LED. Also I have found that diffuse or colored lensed LEDs are not very sensitive.

    I plan to try the "LED switch matrix" concept with ambient rejection by pulsing the source LEDs at a particular frequency, and looking for that frequency in the detectors. Additionally, the concept of an analog equivalent of "how hard the virtual switch is being pushed" is intreaging. There could be many applications.

    Thanks for your interest Kramer....... have fun experimenting!

    Cheers,

    Peter (pjv)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-06-18 11:58
    pjy -- Thanks again. Your information is quite helpful.

    I'll stay away from the Darlington Photo transistors. They seem quite difficult. I was wondering if the PIN diodes were too esoteric, they seem to be the highest performance, extremely sensistive, and best saved for modulated light reception.

    After posting the above, I came across some 8x and 16x ADCs from National Semicondutor. These would seem to be optimal for 8x8 and 16x16 LED grids at they would not tie up the microprocessor as much. I guess you could make an SX-28 handle 8ADCs and provide serial output. It appears that would also allow you to easily use the matrix format with a BasicStamp being supported by the SX-28.

    Is it possible that the SXes virtual ADC approach can be very useful for creating taylored proximity detection in things like the SumoBot, line detections, and their industrial counterparts? I do want to get rid of my CdS photoresistors and use good photodiode on my BOEbot for light navigaton. I can put them in tubes, add lens, and even add some motion control! One SX-18 can do all that and send a 2bit code [noparse][[/noparse]left-right-both-off] to a BS24.

    Right now I am trying to get a small CANbus transciever board adapted to Parallax products. I started this years ago, but I didn't have a clear vision of what I wanted. A few days ago, it became quite obvious.

    After having this hardware ready for an optimal Home Automation network, the LED matrices look very appealing as an input device with an LCD menu. An expensive chassis and cutting holes anything is nearly eliminated.
    Everything could be mounted on the underside of a clear acrylic plastic that can be printed with lables and masked.

    In other words, the LED sensor seems to be an optimal DIY interface with any microprocessor. It is all quite exciting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 6/19/2006 5:33:33 AM GMT
  • pjvpjv Posts: 1,903
    edited 2006-06-18 16:44
    Hi Kramer;

    I did not mean to scare anyone away from Darlington photo transistors. Its just that they can be a bear when ambient light is uncontrolled and if temperature variations are prevelant. They are otherwise very sensitive and quite usable if those two issues are considered.

    Again, regarding virtual A/D in an SX; I would bet that the virtual's software of 8 or so lines of assembler application code, will be much shorter than the code to interface serially to an external A/D. Why is the world having such a hard time grasping this ?????

    For modest performance (4 to 10 bit resolution) and modest speed (100 to 1000 conversions per second) and trivial cost (5 or 10 cents) it's the only way to go; each A/D consumes only 2 port bits, and some of the code is common among multiple A/Ds.

    If one's need for speed performance was indeed very modest (10 to 100 conversions per second), then the traditional circuit can be simplified even further utilizing only 1 port bit per A/D at a cost of another couple of lines of code. This means an SX could have as many as 20!

    Anyhow, enough rambling...... I'll get off my soap box now.

    Cheers,

    Peter (pjv)
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-06-20 16:31
    I checked the SXlist for A/D code and you are absolutely right. The code for 8 channels in the SX [noparse][[/noparse]or Propeller] would easily be less than serially downloading from an 8x multiple chip.

    There is even an SXDemo already written code that moves the output to an RS-232 port and includes other feature that I can remove.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.