serial infrared
electricsmith
Posts: 20
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 Baker
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.