GARTHWILSON wrote:
If all you want is a square wave signal of variable frequency into a piezoelectric beeper, you can make the VIA's T1 put that out on PB7. The number you put in T1's latch determines the frequency. (This is mentioned also in Tip #17 in my "Tip of the Day" column where you'll get lots of other ideas as well.) Ah, its not really a variable frequency Im after. if you had a 6522 and not a 32768 can with frequency divider and all these notes 'just sitting on these pins', yeah Id totally use the 6522 for those basic feedback 'bloops'. For me it is using the existing frequencies that are created by the 32768 clock and the accompanying frequency divider and putting them to use. I get a good set of C notes in different octaves, distinct enough to be useful, thats all.
if I could 'easily get' a scale in one octave, that would be great though unlikely. The notion of a divide-by-n IC, would be to divide by a number used on a common scale, between two frequencies, to create a scale in that octave, no programming, no cycles, n ram reads or register writes, just pure frequencies coming out of a crystal and divided. Why 'create' a frequency, when its sitting right there?
Id be mathematically synthesizing the tone, rather than programmatically creating the tone. It really is an interesting experiment I might use for a synthesizer in the future, though for now, it seems much overkill for the project. Im just trying to use a bunch of otherwise useless pins on a frequency divider and use those pins for my breadboard to make a few beeps and human-readable clock cycles.
I am '
slightly interested in yet
see no real chip to use' for a frequency range divider. I think there is something I could do with a PLL and a divide-by-n counter. Really, very quickly, it becomes much easier to just use an actual Programmable Sound Generator.
Im fine, just using 5-6 C notes I 'get for free' from the clock since Im using it for the breadboard anyway to run both my RTC and my CPU clock off different pins.
Really, though the VIA can produce notes, its overkill unless I use it for something else, same with any kind of frequency divider in the can itself. I
might, maybe, put a 6522 on this board, probably not though, the board space is limited. Off the breadboard, I'll be running much faster, and I might not have the same hardware there, I dont think an Altoids can-puter needs a lot of low speed modes for its cpu clock, it should be running at 6 or 12 MHz or such. Whatever ends up compatible with the other chips I use.
and I do not intend for this to really 'connect' to much right now. Im not planning to use a 6522 in lieu of a sound chip, though its cool you can get a few tones out of it too. If I do not use the same frequency divider setup, then I need something else to make the notes used for user feedback. The 6522 would fill in there, still it would increase cost and complexity to add it.
I am very torn on adding the 6522, Im not overly impressed with it at this point. Its big and bulky and has a few bugs in it.
It is very versatile and can 'do lots of things'. Its a nice 'swiss army knife', yet I have no idea how I would use it at this point and
designing to include it, is not wise.
It can 'do a lot' yet requires overhead from the CPU, unlike using a MCU you can program a loop or two for and have it run its own code.
you cannot really 'program' the 6522, you 'instruction' the 6522 regularly. I do consider the 6522 to be a 'direct companion' to the 6502, as it provides a lot of I/O functions that the 6502 does not have, that say more modern designs have incorporated.
For this device, I dont know if I need one yet and it adds like $10 to the cost. Inexpensive, simple and easy to assemble for almost anyone, anywhere... actually, 'some kind' of I/O is probably desired, maybe a 'usb card' or such... even more reason to look at an MCU with usb built into it, since I plan to use that later anyway...
I guess its a good time to go over 'intended functions' of the device:
Practical:
carry around in my pocket and show to people as a conversation starter
to create a modular hobby DIY platform (much like many projects here)
to establish all or part of the Wayfarer Tech 65xx 'Core CPU Section'
(connecting to devices through a 9-Pin DIN or USB sounds 'educational')
Functional:
have a real time clock, with calendar on my little screen with several alarms and notifiers
play games on the tiny screen with the d-pad and buttons, very simple type games
read and type a little on the tiny screen, probably a hex editor or basic monitor type
(my phone does all of these things, yet often requires service or connectivity)
Possible:
play music (needs a sound chip and headphone jack?)
interface with a computer or other device (needs USB or rs-232 port etc and a control chip etc)
I hadnt planned on using a 6522, it adds a lot of complexity to the design, for an altoids can...
Im not certain I can justify adding one at this time, though Im just sorting out what kind of clock I want on my breadboard at this point.
I will possibly need a way to flash a ROM or load files, I figured Id use a memory card or just USB if I add it,
or just flash the ROM and use that,
Im not sure if Im going to put an MCU on here to handle RAM/ROM and I/O yet, probably not, pin count is a concern here and Im not a big fan of SPI or I2C, Im more of a parallel guy I guess. idk, Im looking into it though, several chips I like use IIC or SPI (I think I prefer SPI maybe), though I still want to write to them directly, or have an MCU do that.
When I think of system level design, and I get away from protocols, wires and timing, I think:
CPU (runs programs and OS calls)
MCU (runs the OS/board and puts everything else, ito RAM locations/'vectors' so the CPU can read them)
so the CPU doesnt really talk to other chips, it delegates that to the MCU, the CPU runs Binary Embedded Executable Files, code for the 6502. the MCU runs the 'DMA' or whatever, it gets interrupts and sorts them and does whatever it can first, then sends IRQ to the CPU only as needed. the CPU should look at RAM, run code, and send a command stack to the MCU to do, and go back to its running program.
The core loop in here is very 'game centric' and our OS is basically a
Code:
startup_sequence();
while(on){
do input;
do logic;
do video;
do sound;
do I/O;
do IRQ maintenance;
}
shutdown_sequence();
or something not much more complicated than that.
this gets into the OxideOS range of things though.
Parts I want to use:
WDC6502
2k or 8k TimeKeeper RAM or similar integrated RAM/RTC
(this will be determined by the vector used for the RTC so it doesnt interfere with the hardware RESET vector etc.)2.8" 320x240 LCD screen with built in S7 type controller.
these are pretty cheap and okay, its going to be GBA level graphics, or NEO GEO pocket color, etc.Probably 16k ROM, maybe 8K. It might be determined by an MCU instead.
a PSG maybe, its probably too much complexity for here.
So this little guy really is very minimal. I might swap an MCU, like a PIC18 or such instead, as it would have some ROM, and some shared RAM, and could do I/O, with timers and maybe USB depending on model...
So what I am doing, is leaving room in the board, so a version with a PSG, or a 6522 or a USB controller, or an HDMI/VGA out, or an FPGA chip... can be built. IDK if I want a 6522 on here, its huge for a 2"x3" board, and Im not sure what its
needed for yet...