Shop OBEX P1 Docs P2 Docs Learn Events
Serial port special usage — Parallax Forums

Serial port special usage

fma38fma38 Posts: 42
edited 2007-10-20 19:16 in BASIC Stamp
Hello,

I'm trying to develop a new interface for an astronomic head, in order to turn it into a panoramic head (to take photos).

The original electronic is made of 2 parts: a remote control, and an internal electronic. 3 PIC 16F73 are used: 2 inside, and 1 in the remote. The com. is a strange RS232: TX/RX lines of all PICs are wired together; the com. is half duplex. I guess that the PICs have to switch on/off transmit/receive lines. There is also a CS\ signal, which goes low when the remote start talking. I'm learning the protocol, and I almost found all commands. But now, I need to make real tests, and I would like to drive the head, using a BS2px instead of the remote. And I need some advices to wire it.

On the head side (using the 2 PIC, one for each axis), the CS\ signal has a 10k pull-up resistor; on the remote side, the PIC uses an open-drain output, to pull it to ground when start talking. In fact, this PIC also starts by checking if the head is connected, by using this pin as input, checking the +5V voltage.

1) Is there a way to use a BS2 output in open-drain mode? Or do I need to add an external transistor?

2) May I connect TX and RX on the BS2, like in the PICs? Or do I need additional external circuit to protect these pins? Do I need to turn them on/off, depending on the sens of the transmission? Is there a risk?

The protocol looks like following: all commands from the remote start with ':', followed by a letter, followed by an optional value. Answer from the head starts with '=', followed by an optionnal value (depending of the command). Separator is 0x0d. The CS\ line is first set to low, just before the transmission begins. Ex:

CS goes low
remote sends ':L2' + 0x0D
head answers: '=' + 0x0D
CS goes high

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr

Comments

  • fma38fma38 Posts: 42
    edited 2007-10-20 15:10
    Nobody can help me? Any idea how I can connect my BS2px to the TX/RX PICs pins, to avoid any problem (I don't want to destory the PICs, neither the BS2, on a program mistake)?

    To be more specific, how BS2 lines used with SERIN/SEROUT work? When something is outputed with SEROUT, does the line goes back to input mode at the end of the transmission? Or does in remain at a specific level? What kind of ouput is it? TTL? Open-drain? other? Same question with SERIN...

    Thanks,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • FranklinFranklin Posts: 4,747
    edited 2007-10-20 15:18
    Have you loaded the stamp editor and looked at the help information for serin and serout? Also it would help if you included schematics or datasheets for the parts you are trying to interface with. The head, not the chips.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-20 15:26
    Look in the PBasic Manual under the SEROUT command. You'll see that you can add a value ($8000) to the Baud number to make transmission open-drain. You don't need separate RX / TX lines in this case, just use the same pin number for both the SERIN and the SEROUT statements.

    If you use the open-drain mode, the I/O pin goes to input mode when it sends one bits and is left that way at the end of the SEROUT statement. If you don't use open-drain mode, the I/O pin is actively driven to a logic high for one bits and is left that way (logic high) at the end of the SEROUT statement. This is called TTL mode because those are the voltage levels used.

    SERIN changes the I/O pin to input mode and leaves it that way at the end of the statement.
  • fma38fma38 Posts: 42
    edited 2007-10-20 15:29
    Yes, I have the 504-pages-pdf from Parallax opened on my screen. The only thing I can read is:

    Step 4: Select driven or open output (bit 15):
    Driven = 0, Open = 32768

    at SEROUT command page. But I'm not sure what it means...

    About the schematics, I do not have them, as the head is a commercial product! I can only make reverse-engineering... What do you need to now, exactly?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • fma38fma38 Posts: 42
    edited 2007-10-20 15:31
    Oups, I didn't see your answer, Mike... So, this is great! I can easily connect the BS2 to the head in open-drain mode...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • fma38fma38 Posts: 42
    edited 2007-10-20 19:16
    And what about the CS signal? Is it possible to use an ouput in open-drain mode? Or do I need to add an external circuit?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
Sign In or Register to comment.