floobydust wrote:
Well, I assume you're using the latest WDC 65C51, which has the transmit bug.
AH! Yeah, that's right. In fact, now that you mention it, I remember looking on the chip a long time ago for the batch number (or something like that) and determined it was the "bad" version. I bet that's it!
floobydust wrote:
This requires that you have a delay after writing a byte to the register before trying to send another byte. The delay needs to be at a minimum the time to send a single character at the baud rate you're using. at 19.2K, that requires at least 521 microseconds. Make sure your delay is at least that.
Will do. I will add that in there when I clean up all of the code.
floobydust wrote:
Also, you don't mention how you're interfacing the 65C51 as a console. Handshake lines need to be properly configured and connected to some terminal program. By default, I use RTS/CTS handshaking with a 5-wire interface:
- Ground, RTS, CTS, TxD, RxD
You can try using ExtraPutty. I've been using it for years and it works flawlessly with the 65C51 when properly configured.
Sorry, I should have mentioned that. For now, I'm just using straight TxD and RxD. I'm not using any hardware handshaking at the moment. In my final design (that will use the NXP), I plan on adding a driver, etc. so that I can interface with some of my legacy equipment that expect real RS-232 interfaces. Thanks for recommending ExtraPutty...I will check that out.
floobydust wrote:
I would also recommend you structure your code differently. Look at a single routine which only initializes the chip and nothing else. You can then have separate routines that read a character and write a character. I can dig out my old code that supports the W65C51 (with the bug) but you'd have to make a few changes to run on your board. Writing a small BIOS could help with debugging and some added flexibility.
Oh, I agree. This isn't my final draft. More of a "slop it together and then clean it up". I learned a long time ago that premature optimization can sometimes prevent you from actually finishing anything.
floobydust wrote:
Finally, make sure the baud clock is running correctly. If you're using a crystal, ensure you have a 1meg resistor in parallel with it and a 20pf cap to ground as per the datasheet. If you're using a can oscillator, ensure it has adequate power supply bypass and is putting out a stable clock. You can check the baud clock output from the chip directly on pin5 (DIP) after the chip is initialized.
Thanks, I will look into that too. I am using a can oscillator. I don't have a cap directly near the can but I will add one for good measure. My ACIA has a cap right under the board about 2mm away from the power pin. Then I have a couple larger caps driving those too. My slots have a large cap as well.
Thanks again!
**EDIT**
A little OT here...but speaking of caps and canned oscillators, I saw a video from the EEVBlog where he opened one up and saw that it had an internal cap or two. Not sure if all of them do...but it was an interesting video.