Hello Erich and Matthias,
* Erich Waelde <ew....@na...> [101117 20:15]:
> I see 2 non-software approaches:
> use a controller with 2 serial interfaces, e.g. atmega644P
>
> use a bit of stuff to multiplex the tx line to some other
> connection, then use the hw usart. The sw would then do
> "redirection" like this
> get-data <to-other> send-data </to-other>
>
>
> And I see one software approach:
> use a timer/pwm thing to create the wave form,
> the corresponding interrupt handlers then can provide the next
> bit, set the timer registers and fire the timer again.
> Downside: needs most probably be coded in assembler.
>
>
> Maybe a few more words about what you want to achieve
> could turn up more possible solutions.
As Matthias has guessed correctly I am looking for a bitbanging
solution in software. I do have a Atmega328P which I want to connect
to a so called 'fnordlicht mini' which is yet another mood light
led toy I have assembled some time ago. This device can be reprogrammed
and controlled via a simple serial protocol, which I hoped would
be fun to play with interactively. So for this application I wanted
to send some bytes out to the device.
I am aware that I could just use the RX/TX Ports of the USART but
I would like to keep the nice forth prompt at my disposal.
As the baudrate would be 9600 I guess I need to resort to either
the interrupt approach you described or I could implement an assembler
word that takes the bytes off the stack (or some other memory) and
busy waits, pulls up/down the pin until all data is transmitted.
As the processor does not need to do anything else during that time
it should be ok.
As I don't have much experience in hardware yet I am not sure if
this even makes sense. I have had a look at the so called SoftwareSerial
lib (sic!) that the arduino folks use, which does work roughly as
described above. As the inner interpreter adds too much overhead
in this case I also think that I am stuck at using assembler for
this word.
What would a good interface look like?
bang-out! ( port lenght addr -- ) comes to mind.
Thanks for your thoughts,
Christian
|