Shop OBEX P1 Docs P2 Docs Learn Events
serial infrared — Parallax Forums

serial infrared

electricsmithelectricsmith Posts: 20
edited 2009-01-27 09:24 in Propeller 1
I am rather new to spin programming, and am just plain afraid of assembly.· I was trying to implement a basic infrared port for data transmission and would like to use the FullDuplexSerial object.· My intent was to take the Transmitted information and AND it with a 38khz frequency from the frequency synthesis object.· Of course using the selection to ignore the Tx signal on Rx.· I know there are other methods hardware wise to perform this, like possibly an external AND gate, or transmitting to another Input pin, then performing an AND on another output, but thought if there was anyone that had implemented a modified Serial Port Object that could modulate at the IR frequency, it would save I/O, processing, and/or hardware.· What are your thoughts?

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2009-01-27 05:36
    Have you thought about using one of the objects from the object exchange? There's the IR_kit: http://obex.parallax.com/objects/37/·and IR_Transmit: http://obex.parallax.com/objects/95/. the second one is even written in spin. These would be a better starting point to make a general IR serial transmission.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
  • electricsmithelectricsmith Posts: 20
    edited 2009-01-27 09:24
    I have looked through the IR functions and have found a few hits in the threads.· All of the objects are catered to using IR for remotes or for tracking and distance detection.· I have been able to gleen how to wire it up and generate signals, I just get stuck trying to merge that with making it function as an RS232 connection.· There were previous threads related to it and the suggestions there were to add an external chip that would take the Tx line from the prop and add the carrier frequency.· Also, when it came to IrDA, the discussions were related more towards trying to hack the existing IrDA protocols being used in various manufactured products.· So, there are several ways to approach it.· I like the FullDuplexSerial object due to it's simplicity in integrating into my code and its performance, but if I really wanted to modify it, I've got to dive into the assembly portion, which will slow down my project development time considerably, given that I haven't written in assembly in over 10years since college.· My thoughts are, in order·to avoid any rework with my hardware and minimize board space, is to have an object that is a modified serial connection for IR that works like FullDuplexSerial:

    Drop in the IRSerial object and define it just like the following from FullDuplexSerial:

    PUB start(rxpin, txpin, mode, baudrate) : okay

    '' Start serial driver - starts a cog
    '' returns false if no cog available
    ''
    '' mode bit 0 = invert rx
    '' mode bit 1 = invert tx
    '' mode bit 2 = open-drain/source tx
    '' mode bit 3 = ignore tx echo on rx


    where the rxpin is connected to the receiver (may need to be inverted like mode 0), the txpin to the led through a resistor, mode bit set to 3 to make it ignore it's own led (may be more complicated than this, may need to be a "halfduplex" type connection, course this mode bit at 3 might essentially be making it halfduplex, don't know), and set a baudrate (highest I can get given the distance needed, which will be extremely close).· That way my coding to run my own protocol over a separate RF link remains the same, I just repeat it for another port instead of just one and hardware wise I will be running the same data over RF and IR separately and/or concurrently.· I know how these guys on here love to code, so I thought I would ask if anyone had an object like this already.
Sign In or Register to comment.