I have been trying to figure out a good project to use Ardrino to do a little demo on my ASR33.
It turns out to be a tough job.
I already have the electrical conversion done. My ASR33 Teletype is set up to receive RS232. I also have the TTL to RS232 converter working.
The problem I have is that Arduino cannot do 110 baud. Therefore, I need to bitbash some sort of software serial to allow me to send a string of characters to the Teletype.
Believe me, if you have ever seen one of these machines print, you would be as hot to make this work as I am.
My ASR33 is about 50 years old. It works fine, because I can do a hardware loop back and it prints what I send. That's a good thing.
Now, I am a new guy to all of this Arduino stuff. I know the Arduino cannot do 110 baud without serious modifications. I have been looking at the serial stream output on my scope and as soon as I go from 300 to 110 baud, the data word get shorter rather than longer. Arduino just doesn't support anything less than 300.
I found this code that someone wrote for an eariler teletype that should help me think this through. There are some notes in it that I have made but I am confused about a few things. It was originally set for 50 baud for earlier teletype machines that had 5 bits, 1 start and 1.5 stop bits 50 N51.5. Don't ask me what 1.5 stop bits is. I think it is really 2 stop bits but the last stop must be leading edge triggered.
Teletype ASR33 were 8 bit Ascii machines. 110 N82 I think is the protocol. I think the ASR33 doesn't pay any attention to the 8th bit.
Here is where I need help. I understand a large amount of this code but some stuff I fall short on.
- Where do I put the data I want to be printed on the Teletype. I think that variable is missing.
- What are "rtty2 and rtty1"? I am thinking they are just a couple of LEDs to show how this is working.
There are a couple of delays that I think add up to the bit time of 110 baud. I have already tried to modify them . I think .00909 = 9ms + 90us delay(9) should be the delay time for 110 baud. Remember that my serial word length is 11 bits rather than the normal 10 bits with most baud rates. Its 10 characters per second but each character is 11 bits.
/* I want a simple Arduino Sketch to generate bitbashed 110 N82 serial to run my
* ASR33 Teletype.
* I would like it to print something simple like:
* " The quick brown fox jumps over the lazy dogs back 1 2 3 4 5 6 7 8 9 10 "
*
*
*
* Transmitted string is broken into each byte (character) with rtty_txstring and each byte
into its corresponding bits with rtty_txbyte. The bits are then written out to Arduino pins
with rtty_txbit.
*/
void rtty_txstring (char *string) // *variable is a pointer to the variable
{
/* Simple function to send a char at a time to
** rtty_txbyte function.
** Each char is one byte (8 Bits)
*/
char c;
c = *string++;
while ( c != '\0') // \0 denotes end of string
{
rtty_txbyte (c);
c = *string++; //move to c to next char of string
}
}
void rtty_txbyte (char c)
{
/* Simple function to sent each bit of a char tortty_txbit function.
The bits are sent Least Significant Bit first
All chars should be preceded with a 0 and proceded with a 1. 0 = Start bit; 1 = Stop bit
*/
rtty_txbit (0); // Start bit
// Send bits for char LSB first
for (int i = 0; i < 8; i++) //8 bits in char (byte).
{
if (c & 1) rtty_txbit(1);
else rtty_txbit(0);
c = c >> 1;
}
rtty_txbit (1); // Stop bit
}
void rtty_txbit (int bit)
{
if (bit)
{
// high
digitalWrite(rtty1, LOW);
digitalWrite(rtty2, HIGH);
}
else
{
// low
digitalWrite(rtty2, LOW);
digitalWrite(rtty1, HIGH);
}
//.00909 = 9ms + 90us
delay(9); // 9 ms
delayMicroseconds(90); //90 us
}
So, does anyone want to take this on with me?
This is really cool stuff. I would love some help with this code.
Greg
