Hello,
I have the free version of uVision 4 and I am experimenting with a "bit banging" code. I have selected the input and output pins. And now I am looking for a way to serialy inject a character into the pin?
I have been looking for this in the application notes, but I don't see anything that would suite this kind of input.
Is there a way that I can have a file or something that will direct a character to the input pin?
Sincerely, Jim
It very much depends on what processor you have.
Easiest is to make use of a pin-change interrupt. Let it interrupt on both low-to-high and high-to-low pin changes. And use of a free-running timer to measure time.
So whenever the pin state changes, you check the value on the timer to know if it was just noise, or if one, two, three or more bit cell times have passed since previous pin change. Voila - there you have your software UART. With a good timer, you can have the timer auto-capture the time when the pin toggled.
For transmission, you let the timer generate an interrupt when it's time to toggle your output pin. With good hardware, the timer can auto-toggle the pin and then generate an interrupt to allow you to reconfigure the timer for next pin toggle needed.