Shop OBEX P1 Docs P2 Docs Learn Events
Detecting a 100k squarewave — Parallax Forums

Detecting a 100k squarewave

John BondJohn Bond Posts: 369
edited 2005-01-10 12:09 in BASIC Stamp
Hi Guys
·
We make the wiring harnesses. The device we are looking to develop checks that the correct wire is placed in the correct connector of a wiring harness. The device induces a square wave in the wire and check for it at the connector (a variation on the old fashioned signal injector). Trials with discreet components, and PLC·work but the size of the project seem to dictate microprocessor. A frequency of 40KHz works, 100KHz works better.
·
We aim to inducing the square wave in one of about 60 different bundles of wire and then check that the correct wire is put into the correct socket of 60 different sockets. The bundles of wires are stored in one rack and the jigs holding the connectors with the sockets are mounted on a trolley. To overcome this difficulty, we’ll use 2 BS2s, one to control the transmission of the square wave and a second to check for the frequency at the socket in the connector. The 2 Stamps will communicate using RS232 or I2C or some other protocol. ·I am conceptualizing the project at the moment and have a couple of questions:
·
········ Can a BS2 or BS2p induce a square wave of 100KHz or do we stick with the 555 IC?
········ Can a BS2 or BS2p check for a square wave frequency of 100KHz at about 3.5V or do I use my existing detector circuit?
········ Which of your technical literature best describes using the multiple-slot programming feature of the BS2p?
········Can I have different program variables in the different slots? ·My limited Basic programming dates back to the 70’s and I chaff at the 26-byte limit.

·
And a final rhetorical question. – Why do we always choose a really difficult project when trying out a technology, which is new to us? (Answer that and you’ll become rich and famous)
·
Kind Regards from Kwa Dukuza
·
John Bond

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-01-04 14:24
    1. 100 Khz is a 10 uSec period. Since the BS2 does 1 instruction in 100 uSec, it can't generate that. Stick with the 555 IC.

    2. The BS2 CAN measure pulse widths (with PULSIN) down to 2 uSec, so you could use this command to monitor a pin.

    3. Note that all BS2 models are single-tasking. This means when it is 'listening' to RS232, it can't 'monitor' the signal. This does not have to be a problem -- the BS2 can do the one, then the other.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-04 14:26
    I'll throw something up quick for ya.

    If you want squarewaves, then the pulsout command would do for you.· The Pulsout resolution is 2uS which would give you a 500kHz limit...but of course, the program would eat up time and this would happen.·

    So if you put it all in a loop with a pulsout equivalent to 100kHz (or 10uS) then that might work for you!· These are 5V TTL pulses.

    Of course there's also the FREQOUT and DTMFOUT commands too.

    I say these last two in case you want to measure in a noisey environment.· Both FREQOUT and DTMFOUT allow you to send dual tones down the line.· With the DTMF one, you might be able to use the DTMF digits (numbers) to send down a give wire and be read in at the other end...of course, I don't see a DTMFIN command, so you might be SOL there unless a PULSIN command might work...but would be hard to decode.

    Does it have to be a squarewave....you could almost do it all in your stamp if you want.

    Those "Fox & Hound" units, that telco uses to find wires in their 'closets', use a 1kHz tone on their lines.· These DO bleed over on to their other lines though (if they're close together), but it is on a lesser scale....but might be detected by mistake.· So maybe an A/D is in part of your needs....you could then measure levels.

    Anyhow....sorry for typing and thinking at the same time....I tend to write my thoughts as I go!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-04 16:13
    The BS2 family has no instruction that will let you generate 100 kHz. You can detect 100 kHz using the PULSIN or COUNT instructions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-01-04 17:27
    The BS2 can generate a 111 kilohertz symmetrical square wave with the PWM command:
    PWM pin, 128, 255
    The square wave lasts for 294 milliseconds, so you would have to repeat the command if you want the signal to last longer. FWIW, the command, (PWM pin,64,255) generates a pulse train at 56 khz, but the duty cycle of that is 25%/75%. owlogic.com/BS2PWM.htm

    I think the BS2p frequency is higher by quite a bit, but I have not tested it to know for sure.

    The BS2 or BS2p could certainly detect the frequency of the 3.5 volt output pulses. The COUNT command on the BS2 can respond up to 120 khz, and on the BS2p up to 416 khz.

    Check out this for suggestions on multi bank programming:
    owlogic.com/BS2SX.htm
    Also, there is a great Nuts and Volts article about it, by Jon Williams, and there has been a lot of discussion of the topic here on this message board.

    In the BS2p, there are 127 bytes of scratchpad RAM in addition to the 26 bytes in the main RAM. Your program can GET and PUT values between the scratchpad and main RAM as needed. It does take a different sort of planning and recycling of variables that takes some getting used to in these days of gigabytes.

    Even if the project is big, the old rule holds--Break it into smaller chunks. The Stamp is well supported and maybe a few questions can help you past difficulties (and make us all rich and famous!).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-04 17:54
    Nice catch, Tracy! -- I forgot about PWM (since I rarely use it).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Tom WalkerTom Walker Posts: 509
    edited 2005-01-04 21:28
    It might also be worth it to mention that the BS2 is a single-tasking beast. So if you were envisioning a single Stamp generating and detecting the signal, this may not be the optimum tool <g>.

    Now, a PWMPAL would make it an interesting idea....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    XYZZY...PLUGH...*poof*
  • Shawn LoweShawn Lowe Posts: 635
    edited 2005-01-04 22:33
    Well, I think John Bond said he'd use 2 stamps, so he should be good to go! He could probably put in so other cool features using 2 stamps.

    Shawn Lowe
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-04 23:23
    Using two BASIC Stamps that communicated with each other one could construct a very fancy cable tester.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • John BondJohn Bond Posts: 369
    edited 2005-01-06 09:25
    Hi Guys

    Thanks for your response guys. This is much more detailed than I expected:

    * PWM is just what I'm looking for on the output side. Thanks Tracy!
    In addition, it doesn’t have to have a 50% duty cycle.
    * I will play some more with pulsin and count. We have some noise which
    may be a problem in the final device. If all else fails, there is always a PLL IC.
    * Thanks Tracy, Jon and others for the literature and endless support on programming
    Stamps. Tracy, your comments above on variables are particularly relevant.

    As you said Jon, this is a fairly complex device. I didn’t want to cloud the issue too much. The existing trial unit has a 40 I/O PLC, 8 analogue multiplexers, 8 data multiplexers, 2 four bit buses, 120 LEDs and over 350 different wire links going to wire bundles, connectors, LEDs, switches, thumb wheels etc. Obviously, using 2 stamps, a simple communication protocol and some common sense, we can simplify the device and, at the same time increase it’s functionality. Hey, a LCD display telling the operator where she was in the cycle would be a big help.

    This is all part of the quest for “Zero Defect”.

    Kind regards from Kwa Dukuza


    John Bond
  • eblanckeeblancke Posts: 26
    edited 2005-01-07 21:33
    An irrelevant curiosity - Where is Kwa Duzuza ?
  • John BondJohn Bond Posts: 369
    edited 2005-01-10 12:09
    Hi Eblancke

    Kwa Dukuza is a very small town in South Africa. It is about 75Km (45mi) north of Durban. It's only claim to fame is that it was one of the villages of the great warrior Shaka Zulu. Some time after Shaka's death, the Zulus were finally subdued by the English and in the 1880's, the village was then renamed Stanger after the Lt Governor of Natal. The town reclaimed its original name about 3 years ago and, as you can see, we are quite proud of it.

    Thanks for asking after our little town.

    Kind regards from Kwa Dukuza

    John Bond
Sign In or Register to comment.