Shop OBEX P1 Docs P2 Docs Learn Events
Serial Port + BS2p40 — Parallax Forums

Serial Port + BS2p40

CRussellCRussell Posts: 15
edited 2008-07-14 17:05 in BASIC Stamp
Rather a simplistic question I hope.· I know the BS2p40 is programmed via the serial port using pins 1-4 on the chip.· I'm intending on making a project to control certain circuits external to the chip and was planning on controlling the BS2 via the serial port from the computer it's connected to.· I'll be playing with the SERIN/SEROUT commands in order to communicate with it.· The question is, do I need to attach a secondary serial port to the chip for this communication, or can I use the already attached serial port on pins 1-4 for those communications?· If I indeed need to add a secondary port, is it the same wiring diagram as for the already attached serial port?· IE an SOUT/SIN and ATN line on pins 2,3,4 (on the DB9) respectively to 3 seperate pins on the BS2?· Also, do I need to include the 0.1uF caps as shown in the parallax diagram for hooking up said serial port?· Thanks in advance.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-14 16:49
    1. If you're only using the "programming" port, and you only need one serial port connection with the 'host' PC, then yes you can use the "Programming" port for this purpose, you don't need a second port.

    2. If you DO decide to add a second port, you'll need a MAX232 or equivalent chip to generate the +-9 volt signal the PC needs out of the 0..+5 volt signal the BS2 uses. So pins 2 and 3 on the DB-9 would go to the Max232, and the other side of the Max232 would go to two pins on the BS2. You MUST connect pin 5 (ground) of the DB-9 to Vss as well.

    3. The "ATN" signal is ONLY used for programming purposes -- it allows the IDE to "reset" the BS2 for programming, and that ONLY works on the "programming" port. The 0.1 uF caps "decouple" the ATN signal so that 'dumb' programs like Hyperterm (which hold ATN in "reset" otherwise) will still let the BS2 run. So for a 'normal' serial port, you don't need these capacitors.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-14 16:54
    You can certainly use the programming port for general use. You can use whatever you've been using for programming the Stamp. There are some restrictions. 1) Anything sent from the PC (or whatever takes its place) is echoed back. You have to account for that. 2) The DTR (ATN) line is used to reset the Stamp. If you don't want this to happen when the serial port is opened or closed (DTR toggled), you need to disconnect the DTR (ATN) line unless you're using it for programming the Stamp. If you're going to use the this port for programming, you'll need the 0.1uF capacitors. These are used to transform the edges of the DTR transitions to short reset pulses for the Stamp.

    SERIN and SEROUT can be used on this port with a "pin" number of 16.
  • CRussellCRussell Posts: 15
    edited 2008-07-14 17:05
    Thank you very much for the quick response!· If I can use the original serial port already attached to the chip for programming for my communications purposes 'after' the programming has taken place, then I'll skip the addition of the secondary port (the board is already pretty crammed, not sure I could add the MAX chip onto it).· I just wasn't sure I'd have the ability to talk to pins 1/2 on the BS2 since they're not designated as IO pins on the schematic.· Thanks again!
Sign In or Register to comment.