Creating a PIC16 emulator & NES music player (C++11 & electronics).

  • 7 лет назад
In this tool-assisted education video I create an emulator for the PIC16F628A chip. In the emulator design I aimed for a data-driven design where efficient code is produced from concise and easy-to-read data at compile-time.\r
\r
Twitter: \r
Patreon: (alternatives at \r
Twitch: \r
Homepage: \r
\r
The PIC16F628A is a microcontroller that packs an impressive set of features: it has timers, counters, analog comparators, a PWM generator, and lots of configurable I/O ports, for its meager 18-pin DIP case.\r
It also only has 224 bytes of RAM, which is segmented, and 2048 bytes of 14-bit program memory that cannot be read by the program itself.\r
\r
I bought five from here: because I was curious to see what I can do with it.\r
\r
As an execise, I used this chip to play some NES music.\r
Mind you, this chip does not have any audio capabilities on its own. It does not even have a DA converter. The mixing is all done in software, and output using pulse-width modulation.\r
\r
The chip can normally run at very low voltage and power levels, but in my configuration, the chip is run by 20 MHz clock, which requires 5 volts input. (At 20 MHz input the CPU runs at 5 MHz effective rate, because of its internal divider. Every instruction takes 4 cycles.)\r
\r
Its instruction set is very simple, on par with DCPU-16, making it an interesting emulation project. Its only complex because of all the I/O ports and peripheral hardware in it. My CPU implementation -- the most interesting part in this video -- can be seen from 6:45 onwards.\r
\r
DOWNLOAD MATERIAL: \r
\r
I began making this video in August new. I did not intend to take 1,5 years to make this video, but I could not quite decide what parts of the process I would showcase and how. The NES music player? The soldering and circuit design? The emulator? The robot (Nao) that assisted me in soldering?\r
In the end I just kicked myself and decided to publish the emulator and show bits from the other points of interest.\r
But even then, the emulator was made in five modules, and multi-module programs are hard to make into YouTube videos. Add to that the f that probably less than a percent of my audience understands what this chip is.\r
And then I suddenly got a burst of new subscribers and I was in hurry to publish my 3000 subscribers special video.\r
Oh well. I hope this gets a good reception anyway!\r
\r
P.S. My _first_ implementation of this design was on a breadboard, not the deadbug soldering that I claimed in the video. You can see the breadboard implementation here: I just nearly forgot to mention it, because it could not run at 20 MHz because of the breadboards internal capacitance messing up the signals.

Category

📺
TV

Рекомендуем