Thoughts on delays...

Let's talk about anything related to the 6502 microprocessor.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: Thoughts on delays...

Post by cbmeeks »

Thanks for the suggestions everyone.

And thanks Bill for the offer.

Right now I'm at a stand-still. I've run into an issue with my board. Nothing seems to work on it. I've had to pull the ROM socket because it no longer holds a chip.
Cat; the other white meat.
bradleystach
Posts: 26
Joined: 26 May 2018
Location: Riverton, UT

Re: Thoughts on delays...

Post by bradleystach »

GARTHWILSON wrote:
GaBuZoMeu wrote:
Assuming° you are using the regular 1.8432 MHz clock for your 6551 and no external RxC than that pin (5 on DIL) reflects 16x RxC. Feeding this into PB6 of a VIA and use the pulse counting mode you can even generate an interrupt (out of the VIA) that would occur after transmission is done.

EDIT(1): with 1.8432 MHz the RxC should not exceed 115.2 kHz which can safely counted by a 1 or more MHz driven 6522.

This looks to be the best idea yet! From the VIA's data sheet, you write to the T2 low-byte latch, and that value gets transferred to the low-byte counter when you write to the high byte. For each byte, store the byte in the 51's transmit data register, then store the desired value (0 in this case, with STZ) to the high byte of the T2 counter to re-start the counter and to re-enable its interrupt. If the number of bits per frame remains constant, or if you just want to use the maximum for everything, the T2 low-byte latch value will be the same for all bit rates. Thanks, GaBuZoMeu!

Edit: Pin 5 is for 16x the bit rate, and 16 times 115.2kbps is 1.8432MHz. 9600bps is the fastest standard RS-232 speed a '22 running at 1MHz would be able to dependably count.
Would it be possible to use a couple of flip-flops to divide the RxC output to cover at least to 19200 baud. I have just gotten a 65C02 running on a breadboard at 1Mhz with a 65C51 (with bug) and a 65C22. I'm using the software delay loop and it's working great, but was thinking about giving this a try. Would you set the counter to 16 * 10 bits (start bit + 8 data bits + stop bit) so say 160 without FF divider or 40 with divider?
User avatar
GaBuZoMeu
Posts: 660
Joined: 01 Mar 2017
Location: North-Germany

Re: Thoughts on delays...

Post by GaBuZoMeu »

If you run your 65C51 @ 19200 bd and the 65C22 @ 1 MHz then no divider is required. One lazy way to figure out the correct counter preset would be to start with something large and reduce it until character transmission starts to show errors :)

As the 65C22 counts down you can start with 160 what sounds reasonable.


Don't forget to post your results!
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Thoughts on delays...

Post by BillO »

cbmeeks wrote:
Thanks for the suggestions everyone.

And thanks Bill for the offer.

Right now I'm at a stand-still. I've run into an issue with my board. Nothing seems to work on it. I've had to pull the ROM socket because it no longer holds a chip.
Do you want the 65C51? These ones require no delay loops and work as designed. I don't even use handshaking. Polled by a CPU running at up to 20mHz and run at 19,200 baud. I have noticed the odd framing error in using them, but it does not seem to be related to the CPU speed because the errors happen at 1.8mHz too. Might just be my poling routine. But ti's not enough to be a bother.
Bill
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: Thoughts on delays...

Post by cbmeeks »

Actually, I got my board working again. I've made it work with the 65C51 that I have. I also bought a genuine 6551 and it seems to work well too.

So full steam ahead! :-D
Cat; the other white meat.
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Thoughts on delays...

Post by BillO »

Awesome!
Bill
Post Reply