Shop OBEX P1 Docs P2 Docs Learn Events
MoBoStamp-pe BS2pe Motherboard and transceiver communication problem — Parallax Forums

MoBoStamp-pe BS2pe Motherboard and transceiver communication problem

@rere@rere Posts: 7
edited 2012-03-18 11:20 in BASIC Stamp
Hi,

I am recently working on an device which will be able to detect the change of movements. When someone move within 10m, the device will start its effect, and for each 2m he/she get nearer, the device will be able to sense it and give response.

Currently I have a controller board (MoBoStamp-pe BS2pe Motherboard (#28300)) and a transceiver (TR24). As the transceiver is of SPI interface, which is quite different from the Motherboard.Does anybody know how the two communicate so that I can have the Motherboard controlling the sensors?

If not, could anyone suggest me what to use so as to do the above function I mentioned? And how?


Please help as this is quite urgent and I am completely new to all these.

Thank you,
rere

Comments

  • @rere@rere Posts: 7
    edited 2012-03-01 20:18
    Noted that I cannot use ultrasound emitting device, that is also the reason of why I am choosing TR24, as it is an RF transceiver.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-01 20:28
    rere,

    Welcome to the forum!

    You can use the BS2pe's SHIFTIN and SHIFTOUT commands to communicate with SPI devices. Can you post a link to the TR24 transceiver that you're using?

    -Phil
  • @rere@rere Posts: 7
    edited 2012-03-03 20:03
    Thanks Phil,

    Attached is the info. about the transceiver TR24, I am sorry it is in Chinese, as I bought it from China and they don't have an English version. I found a similar one on web, with English, yet, the sensitivity seems a bit different and the function names are different.

    http://wenku.baidu.com/view/df45b5ea856a561252d36f60.html

    rere
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-03 20:38
    I don't read Chinse, but the hardware interface looks very straightforward, both for wiring and for the low-level SPI protocol. Be sure to configure your MoBo for 3.3V operation. I can't tell from the photo, but if the spacing of the interface pads is 0.1", it should be easy to solder the transceiver to a Proto-DB. Just be sure that the antenna (the zigzap trace) hangs over the edge of the board. Also, study the two PBASIC commands I mentioned in the context of the waveforms shown in the TR24 doc.

    Good luck!

    -Phil
  • @rere@rere Posts: 7
    edited 2012-03-03 21:55
    I have just translated the TR24 guide to English.
  • @rere@rere Posts: 7
    edited 2012-03-03 22:08
    Do you mean that I can soldier the transceiver onto the Proto-DB, connect to my the MoBo board and use the SHIFTIN and SHIFTOUT command to communicate with it? Can I directly program it within the AVR studio? As I am totally new to SPI interface, I have no idea how to program it. All I know is C....so can I just program it with C?

    Thank you!
    rere
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-03 22:35
    rere wrote:
    Do you mean that I can soldier the transceiver onto the Proto-DB, connect to my the MoBo board and use the SHIFTIN and SHIFTOUT command to communicate with it?
    Yes.
    rere wrote:
    Can I directly program it within the AVR studio? As I am totally new to SPI interface, I have no idea how to program it. All I know is C....so can I just program it with C?
    Going through the AVR would be the hard way to do it, since PBASIC makes it so easy. Even if you went the C route via AVR Studio, you'd still have to do some PBASIC programming to interface with the AVR. So you might as well do it all in PBASIC.

    -Phil
  • @rere@rere Posts: 7
    edited 2012-03-06 08:21
    I am now using the PBASIC to program the device, so do I need to convert the H files and C files provided by the transceiver company into PBASIC before including it into my program? Moreover, I am having a bit difficulties in connecting the transceiver to the Motherboard. I don't know how to connect the Interrupt Request pin (IRQ) and the Chip Select Not pin (CSN) of the transceiver to the Motherboard. Should I connect the IRQ to poll input and CSN to SDA?

    Once again thank you very much!

    rere
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-06 09:10
    rere wrote:
    so do I need to convert the H files and C files provided by the transceiver company into PBASIC before including it into my program?
    Essentially, yes. But it would be better if you took the time to understand what the manufacturer's C code does, then write your PBASIC program based on the knowledge you gained, rather than attempting a one-for-one transcription.
    rere wrote:
    I don't know how to connect the Interrupt Request pin (IRQ) and the Chip Select Not pin (CSN) of the transceiver to the Motherboard.
    Any pin except A0/A1/B0/B1 will do for these. If any of the transceiver's outputs are open-collector, you will want to pick a pin that's pulled up on the MoBo. And, again, use a Proto-DB for the interface, as opposed to poking wires into the daughterboard socket, which could damage it.

    -Phil
  • @rere@rere Posts: 7
    edited 2012-03-18 10:32
    I have been studying PBASIC and the SHIFTIN and SHIFTOUT code and I came along some difficulties.......to communicate with the SPI interface transceiver, is that I need to SHIFTOUT each command-word from the Motherboard to control it? Where should I hold the command-word to be sent then? (given that I only know the corresponding address of the command-word) Also, how to set the address? Can I just set a VAR Byte to hold it? Also is that PBASIC can only identify binary number? Can I have the address in hexadecimal? Sorry for having so much to ask.....as I have been feeling quite confused. Can you help me by giving me better references? Thank you!

    rere
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-18 11:20
    If the values that you're sending (e.g. address and data) are constants, you don't have to assign them to variables first. The numbers can simply be put into the argument list between [brackets]. But you can always assign the data to variables, if you want, then include the variable name(s) in the argument list. PBASIC supports decimal (e.g. 12345), binary (e.g. %10101), and hex (e.g. $4AE7) constant expressions. For more on SHIFTOUT, refer to the PBASIC AppNote here:


    -Phil
Sign In or Register to comment.