6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 29, 2024 1:27 pm

All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Fri Sep 08, 2017 12:27 pm 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
Just came across a YouTube 'build' video, only a few hours old, of a VCFMW 65C02 Badge designed by Lee Hart and Daryl Rictor. Lee has a write-up for the badge here. Daryl's interrupt driven bit-banged serial RX routine is very cool.

Cheerful regards, Mike

Image


Last edited by Michael on Sun Sep 10, 2017 5:36 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 08, 2017 3:11 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
SWEET! Take that Arduino!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 08, 2017 5:19 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
I don't need one, but I want one!

I usually learn a great deal by studying Lee's designs. Reading the schematic of both his 1802 membership card and VCF Elf was instructive.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 08, 2017 7:24 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
Michael wrote:
Daryl-s interrupt driven bit-banged serial RX routine is very cool.

Quote:
April 27, 2017: We figured out a way to eliminate the UART, by using the 6502's interrupt pin as its serial input, and one of the output bits for the LEDs as its serial output. That got the size down to something small enough to use as a name tag.

Yea, that's really clever.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 08, 2017 11:45 pm 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
Hey, guys. Would one of you consider helping me understand the purpose of R1D (22K), R3B (2K), and C6 (3.9nF) near the IRQ input in Lee's schematic, please?


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 09, 2017 4:53 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
Michael wrote:
Hey, guys. Would one of you consider helping me understand the purpose of R1D (22K), R3B (2K), and C6 (3.9nF) near the IRQ input in Lee's schematic, please?

As near as I can tell, it's for a software UART, suitable for up to 19200bps or more. It might work as high as 115.2kbps, just barely. R3B and C6 form a 7.8µs time constant for the receiver. If there is no transmitter connected, R1D to Vcc will hold the NMI\ high to avoid interrupting the processor. The software UART's output is at pin 15 of U5.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 09, 2017 5:13 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
I think R3B and C6 is a low pass filter with 2 KHz cutoff frequency to eliminate distortion. The Baudrate therefore must be less then 4000 Baud. As Garth said R1D is the usual /IRQ pullup to stop interrupts when RXD is open.

edit: actually R1D may have an influence on the cutoff frequency and it may even be lower than 2 kHz. I would say it is designed to take 2400 Baud at most.

edit2: as noted below the calculation was wrong and the cutoff frequency is 20kHz.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Last edited by Klaus2m5 on Sat Sep 09, 2017 2:28 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 09, 2017 5:40 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1738
Location: Sacramento, CA
Lee did the engineering on the hardware. R1D is a pull-up for when no TTL serial device is connected. R3B is a current limiter for TTL input, if I recall correctly. The cap is probably there to filter noise. I can tell you it runs quite well at 9600 baud.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 09, 2017 6:11 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Oh, I see. I didn't account for the CMOS input not needing a full swing signal but merely a little bit more (1) or less (0) than 1/2 Vcc. So R3B also protects the internal clamp diodes from going up in flames.

update: I used a low pass calculator that I hadn't used before. So instead 3.9nF it took 39 nF. Using 3,9nF the correct result is roughly 20 kHz. I found a better calculator with diagrams here: http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 09, 2017 8:03 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
3900pF times 2K makes a time constant of 7.8µs. What I forgot to take into consideration is that it ought to be up to the 1-1/e point ahead of the middle of the bit period. Giving a little extra safety margin, say to 10µs, brings us to a whole bit period of 20µs, which is 50kbps. The exact amount depends on where the input voltage thresholds are for dependable operation. 20kHz is the -3dB point for the fundamental frequency, a sine wave, of a cycle which is a pair of bits a 1 and then a 0, or vice-versa anyway. I think 38.4kbps should be reliable. 19.2kbps would definitely be. This resistor and capacitor are clearly there as a low-pass filter to reduce electrical noise.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 2:45 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
Thank you, Gentlemen.

I had wondered if that was simply a low pass filter for the 9600 baud Rx signal. Very nice!

I really like Daryl's serial interrupt driver method. It's clever, innovative, and intuitive. With the addition of a 3-pin IR Reciever IC, the driver code could be modified to provide a simple and inexpensive Keypad interface using an IR Remote like the ones I bought earlier this year (see below). The Remotes included a coin cell battery and use the NEC IR protocol (cost about $1.12 at the time). Of course you would want to design some kind of keyboard overlay for these Keypads.

Cheerful regards, Mike


Attachments:
NEC (small).png
NEC (small).png [ 143.85 KiB | Viewed 6353 times ]
24-Key IR Remote.png
24-Key IR Remote.png [ 164.22 KiB | Viewed 6353 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 3:33 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
This really is a cute 'minimal' computer design.

I was wondering what kind of 'minimal' hardware might be used to drive my little 2-pin 8-bit LCD backpack (see below) instead of an LED display? I need a single latched pin to drive the backpak 'CLK' line along with an active high pulse on the backpack 'E' line after loading all eight bits into the shift register IC. The RC time constant on the LCD backpack requires 10-uS per bit, including a 1-uS 'CLK' pulse, which may be a bit fast for a 2-MHz 65C02 so those RC values might need to be changed. So, I would just need one of the two 74HC273 latch ICs, right?

Cheerful regards, Mike

Code:
  /*                                                                *
   *  K8LH 2-Pin 8-Bit 74HC595/74HC164 LCD low level driver         *
   *                                                                */
   void PutLCD(char work)       // write byte to 74HC595 & LCD
   { char bitctr = 8;           //
     do                         // load 74HC595 shift register
     { if(!work.7) clk = 0;     // if a '0', set clk = 0
       delay_us(9);             // charge or drain cap (3*tau)
       clk = 0; clk = 1;        // clock bit into shift register
       work <<= 1;              // shift next bit into b7
     } while(--bitctr);         // until all 8 bits clocked out
     if(rs == 0) clk = 0;       // make clk pin = rs flag
     ena = 1; ena = 0;          // latch 595, pulse lcd 'e' pin
     clk = 1;                   // leave clk pin high
   }


Attachments:
K8LH 2-Pin Backpacks.png
K8LH 2-Pin Backpacks.png [ 52.87 KiB | Viewed 6349 times ]
rc timing.png
rc timing.png [ 17.81 KiB | Viewed 6349 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 5:13 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Nice idea! Yes a single 74hc273 should work. The fastest clock output would be 2 atomic sequential store absolute with 2 precharged registers resulting in a clock pulse of 2µs duration. You may have to double the time constant for the shifter's data pin.

The disabled interrupt for the atomic operation may leed to another problem. During the SEI STA STX CLI any soft UART start bit detection will be delayed by 5 µs. However the bit time for 9600 Baud is 104.17 µs. The delay introduces an error of about +5% maximum. So it really depends on how much internal error the soft UART accumulates up to the last bit, wether this is tolerable or not. It would help if the soft UART would have a negative bit time error (on the 104 µs rather than the 104.5 µs side, the soft UART may actually have a larger error of up to +-2% accumulating to +-20% depending on how accurate the timing in software is). The sender may also introduce an error of +-2 % per bit accumulating to +-20% overall. This should only lead to a maximum deviation of 40% between sender and receiver at end of frame.

Of course there is always the option of keeping both 74HC273 and connecting the LCD directly...

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 1:22 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8521
Location: Southern California
There's this post about bit-banging at 115kbps (ie, software UART) with a 2MHz 6502: viewtopic.php?f=4&t=1785
I think there's a whole topic about it here somewhere, but I can't find it in the little time I have at the moment.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sun Sep 10, 2017 2:23 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
Although this hardware doesn't have any other uses for the /IRQ, doesn't the software uart preclude such uses? Obviously you could be extremely quick in the alternative use, but wouldn't any other sources for changes to /IRQ mask any simultaneous change to RxD?

While a 6522 and 6551 simultaneously setting /IRQ is also possible the ISR could poll both of them and determine if one or both were the source of /IRQ.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: