Asteroids on Oscilloscope
Re: Asteroids on Oscilloscope
Arse.
This project http://openprog.altervista.org/OP_eng.html says your chip is known working. The circuit looks breadboardable, the only complex component is a low-end PIC which you might already have. Assuming the programmer you already have can program one of the little PIC needed for the programmer, the whole thing is bootstrapable, in theory.
This project http://openprog.altervista.org/OP_eng.html says your chip is known working. The circuit looks breadboardable, the only complex component is a low-end PIC which you might already have. Assuming the programmer you already have can program one of the little PIC needed for the programmer, the whole thing is bootstrapable, in theory.
Re: Asteroids on Oscilloscope
Thanks, but that's way too complicated for me to build!
The big draw of getting the real programmer was to get the proper debugging features. I could in theory build the final programming interface from a parallel port, but all the time I spent debugging any programmer I build myself is time I don't spend doing cool things.
There's got to be a way to trick this thing into thinking it's its big bro.
The big draw of getting the real programmer was to get the proper debugging features. I could in theory build the final programming interface from a parallel port, but all the time I spent debugging any programmer I build myself is time I don't spend doing cool things.
There's got to be a way to trick this thing into thinking it's its big bro.
Re: Asteroids on Oscilloscope
that panel would look nice with a bit of varnish or a reddy brown stain - walnut perhaps
Re: Asteroids on Oscilloscope
also i got some stupidly bright leds on ebay, 30000mcd, i have been making them flash
Re: Asteroids on Oscilloscope
Aye. I don't know if I'm going to use the wooden panel, the idea was to make it out of blue plastic to match the tin, but now that I've measured how much it would have to stick into/out of the tin to work, the biscuit tin is right out. A walnut console is very possible!adam wrote:that panel would look nice with a bit of varnish or a reddy brown stain - walnut perhaps
Right now it (still) smells very strongly of burning wood glue...
Re: Asteroids on Oscilloscope
Assuming that the Microstick (and the Microstick 2) are a bust, I'm moving on the PICkit (if I can find one for less than a zillion pounds.) That means I need to design my circuit so that there's a PICkit 5 pin header on it, connected to !MCLR, +V, GND, PGED and PGEC. Assuming I haven't swapped D and C around copying between the documents, the left side of this gizmo is becoming a little complicated.

The PICkit header is next to the chip socket. The !MCLR, PGED and PGEC pins are in the right place, but the power rails need to be connected to it separately. I've moved it a couple of columns to the left to allow space for the return path for the status LED and the unregulated voltage measurey dividey pair.
This layout should obey The Rules: connect power to the chip first, cap the voltage coming out the regular, cap the rails close to the chip, wire everything else up nice, !MCLR network connected to switch with PICkit !MCLR pin connected directly to chip.
The sense bus is carefully pinned out to allow Amiga joysticks and Sega Mega Drive pads to be used. The +V and GND pins neatly overlay between the GPIO pins on the bottom right, with the top two pins lining up with analogue inputs so it might work with potentiometer paddle pads. The fiddly thing in the bottom right is a jumper for switching +V or an IO pin to pin#7 on the joystick (Amiga mouse power supply, Sega TH selector). If I hadn't have cheaped out and gotten the 1.5A regulator instead of the 100mA regulator, I would have had enough current to drive the Amiga mouse (at 50mA), but right now it doesn't really have any use. Using an Amiga mouse would be a lovely gimmick to get working (decoding the quadrature within interrupts in the PIC), but do I really wanna get the mice out again just for this?
There's not a lot of horizontal space left on the right of the socket. I've taken out a power cap before the regulator (against my better judgment) because it seemed redundant. I have a lot of vertical lines on the right because GND appears quite a few times there. Not much I can do about that.

The PICkit header is next to the chip socket. The !MCLR, PGED and PGEC pins are in the right place, but the power rails need to be connected to it separately. I've moved it a couple of columns to the left to allow space for the return path for the status LED and the unregulated voltage measurey dividey pair.
This layout should obey The Rules: connect power to the chip first, cap the voltage coming out the regular, cap the rails close to the chip, wire everything else up nice, !MCLR network connected to switch with PICkit !MCLR pin connected directly to chip.
The sense bus is carefully pinned out to allow Amiga joysticks and Sega Mega Drive pads to be used. The +V and GND pins neatly overlay between the GPIO pins on the bottom right, with the top two pins lining up with analogue inputs so it might work with potentiometer paddle pads. The fiddly thing in the bottom right is a jumper for switching +V or an IO pin to pin#7 on the joystick (Amiga mouse power supply, Sega TH selector). If I hadn't have cheaped out and gotten the 1.5A regulator instead of the 100mA regulator, I would have had enough current to drive the Amiga mouse (at 50mA), but right now it doesn't really have any use. Using an Amiga mouse would be a lovely gimmick to get working (decoding the quadrature within interrupts in the PIC), but do I really wanna get the mice out again just for this?
There's not a lot of horizontal space left on the right of the socket. I've taken out a power cap before the regulator (against my better judgment) because it seemed redundant. I have a lot of vertical lines on the right because GND appears quite a few times there. Not much I can do about that.
Re: Asteroids on Oscilloscope
So the 10uF across VCAP and VSS on the right of the device is supposed to be non-polarised. Glad I found out that piece of obscure information before I soldered anything! I assumed it was supposed to be electrolytic because 10uF is quite juicy, and bitsbox doesn't stock 10uF ceramics.
Dang. I suppose I could put 20 ceramics in parallel...
Going over to the Microchip forum to ask if a non-polarised electrolytic will do...
Dang. I suppose I could put 20 ceramics in parallel...
Going over to the Microchip forum to ask if a non-polarised electrolytic will do...
Re: Asteroids on Oscilloscope
I don't remember having that much trouble finding programming devices back in the day. Have you considered AVR parts, instead?Kamineko wrote:Assuming that the Microstick (and the Microstick 2) are a bust, I'm moving on the PICkit (if I can find one for less than a zillion pounds.)
Re: Asteroids on Oscilloscope
I couldn't find an AVR with dual DACs. If you can find a part that does and a programmer that isn't expensive, then we'll have a look. 
(I know AVR does 'something' with dual DACs because the Arduino Due is AVR-related I think and it has them.)
(I know AVR does 'something' with dual DACs because the Arduino Due is AVR-related I think and it has them.)
Re: Asteroids on Oscilloscope
Post 100, woo!


I need some good solid cored wire before I start filling in the blanks, but that's the Ocelot's mainboard done. It won't work as it is, even if I had a compatible chip programmed and ready to go, because it needs a cap on the top right for one pair of power pins, a pin header (they're terrible to solder... keep freakin' melting!) for video, a pin header for audio, a varied selection of resistors for the mixer (decided against having all channels the same volume in the end) and the magical tantalum capacitor of mystery for VCAP.
BUT when I've fitted all of that stuff, I should be able to plop a PICkit cable onto that 5-pin in the centre and I am in business.
I measured some voltages after attaching the battery and closing the power switch with a jumper and everything seems in order. The regulator is regulating. The divider is dividing. All is well. Except for the missing stuff and the stuff I bought in error.
Next up, I must learn the programming side! I need to master the PORTx stuff in order to set the GPIO pin values for the audio out and Genesis TH pin, I need to master CNPUx so I can set the 'sense bus' to have pull-up nature ready for a Zipstick to close switches to ground, I need to master timers to get the frame rate set up and the audio oscillators oscillating, and I need to master DAC in order to get analogue outputs working.
It's all go in Ocelotsville.


I need some good solid cored wire before I start filling in the blanks, but that's the Ocelot's mainboard done. It won't work as it is, even if I had a compatible chip programmed and ready to go, because it needs a cap on the top right for one pair of power pins, a pin header (they're terrible to solder... keep freakin' melting!) for video, a pin header for audio, a varied selection of resistors for the mixer (decided against having all channels the same volume in the end) and the magical tantalum capacitor of mystery for VCAP.
BUT when I've fitted all of that stuff, I should be able to plop a PICkit cable onto that 5-pin in the centre and I am in business.
I measured some voltages after attaching the battery and closing the power switch with a jumper and everything seems in order. The regulator is regulating. The divider is dividing. All is well. Except for the missing stuff and the stuff I bought in error.
Next up, I must learn the programming side! I need to master the PORTx stuff in order to set the GPIO pin values for the audio out and Genesis TH pin, I need to master CNPUx so I can set the 'sense bus' to have pull-up nature ready for a Zipstick to close switches to ground, I need to master timers to get the frame rate set up and the audio oscillators oscillating, and I need to master DAC in order to get analogue outputs working.
It's all go in Ocelotsville.
- Kelloggs
- Baaaaa!

- Posts: 1859
- Joined: Wed Jun 22, 2005 11:38 pm 0
- XBL Gamertag: TheAntiKelloggs
- Location: Widnes or Altrincham. Take your pick.
Re: Asteroids on Oscilloscope
Plug something into it to sink the heat away - a length of wire might be enough, but you might need to hold the pin in a pair of pliers (with your spare hand). That way, the solder can get hot enough to melt for just long enough to set again, while the "something" stops the plastic doing likewise.Kamineko wrote:a pin header (they're terrible to solder... keep freakin' melting!) for video
Re: Asteroids on Oscilloscope
I've soldered pretty much everything now. Just need the last capacitor to make it a functional device. The crap chip with the crippled programmer is pin compatible with the good chip with the DACs so I could in fact start programming and testing the Ocelot system's sound and input as soon as I have that one last piece... but after spending all that effort working around the PICkit header, I think I'll wait until I've got the PICkit too.
Re: Asteroids on Oscilloscope
I've decided to use the Microstick 1 as it was designed: a learning tool. I can't really sell it while that one guy is making a mint out of selling sealed N.O.S units on eBay, so I'll see how far I can get with what I have.
Holy moly is the MPLAB debugger cool. Watches, breakpoints, stepping, variable modifying in situ. All of this stuff is still available while the chip is seated within the application circuit! After goofing around with homebrew console nonsense and incomplete emulators, having a feature-filled hardware debugger (for a tenner) is absolutely bonkers. When I attach the PICkit leads into the completed Ocelot system (provided my board layout routes everything safely), this set-up going to be off-the-charts amazing.
The Microstick has a socket on the bottom and comes with double-headed pin strips to allow you to install it onto a breadboard for playing around. One frustration there is that the Microstick base socket is 0.6" wide and the chip itself is 0.3" wide. I could have given the Ocelot mainboard a configuration versatile enough to seat both the bare chip and the Microstick mothership (install an extra column of pin sockets to one side of the 28-pin DIP socket so it looked like [ ] ]), but I decided against that route when I decided to get a PICkit instead of a Microstick 2. Instead of putting a big blockomatic onto your board for debugging, the PICkit has a five-pin ribbon connector that connects to a header you put on your board and takes over the show through the magic of ICSP. I assume it's very much like JTAG in concept.
In terms of coding, the documentation seems to go out of its way to make everything as complex as possible. Mercifully, after a Reset the default settings for most registers are safe: all optional modules off and all pins are set to non-explodey defaults. My timer code appears to be working; the built in LED is blinking at my command. Correct rate, correct duty cycle. Also, the clock selection thing seems happy enough. It's running at 39.61375 MIPS out of a maximum of 40 MIPS. To set the clock, you have a set of variables that massage the internal 7.37 MHz clock through a number of discrete stages into the final instruction clock speed. I'm using values copied from a guide on getting started with dsPIC33 (a lot of example code uses the same values for full-tilt operation), but I've worked out alternate solutions that could let me run the chip at a slightly higher 39.92083 MIPS. It's a 1% increase but according to all the data sheets it's within the safe limits. I'm not really sure what 'safe' is other than what the data sheet says 'never go beyond X at each stage Y in calculating the clock speed'. I'd worked out a completely middle-of-the-road solution to get a totally safe looking solution for 37 MIPS, so I was surprised to see everybody else going for higher numbers. It works now and it's 99%... let's leave it be.
My pin pull-up setting and detecting code (for the joystick input and music output) is working too: I'm shorting pins on the left side to ground with a screwdriver to simulate the joystick and the CPU is branching appropriately! I even put a breakpoint in and it all worked. Things that work are the best of all things.
It's just a crying shame that this particular Microstick only works with these two chips. The only difference between the chip that's inserted into it now and the chip I want to use is this one has PWM outputs (my nemesis, come to haunt me) instead of DACs, and half the code PROM space. Same clock speed, modules, form factor, pinout, everything... calling it an underpowered shitbag on the previous page was uncalled for; I was overcome with FURY at my own incompetence.
The real worst thing about this is that I now own a fully functional programmer and two extra high-powered jack-of-all-trades-as-long-as-you-don't-want-analogue-out chips. I could do anything with these... I could link them to the Ocelot's main CPU through I2C or RS232 or whatever and use them for Extra Crap. I could whack up to 18 bits of R-2R onto the second chip and use it as a 39.99 MIPS soft-synth chip! That's a hell of a lot of MIPS and they're not shitty MIPS either. Single cycle multiply and divide, or so the story goes. Or, alternatively, I could swap them around: make the non-DAC the Boss chip and use the DAC chip as a dedicated vectoriser, whirling around its own internal copy of vector screen state until its told otherwise by the all-digital Boss chip. If I did that, game hardware or software lock-ups wouldn't cause the oscilloscope to dangerously freeze. (DMA is supposed to let you do that anyway, but who knows if I'd be able to get that working.)
It's never going to end. I'm going to end up with biscuit tins full of absurd home-made electronic crapola. Every mistake and every purchase just leads to more spare stuff that's just itching to be put to use.
Holy moly is the MPLAB debugger cool. Watches, breakpoints, stepping, variable modifying in situ. All of this stuff is still available while the chip is seated within the application circuit! After goofing around with homebrew console nonsense and incomplete emulators, having a feature-filled hardware debugger (for a tenner) is absolutely bonkers. When I attach the PICkit leads into the completed Ocelot system (provided my board layout routes everything safely), this set-up going to be off-the-charts amazing.
The Microstick has a socket on the bottom and comes with double-headed pin strips to allow you to install it onto a breadboard for playing around. One frustration there is that the Microstick base socket is 0.6" wide and the chip itself is 0.3" wide. I could have given the Ocelot mainboard a configuration versatile enough to seat both the bare chip and the Microstick mothership (install an extra column of pin sockets to one side of the 28-pin DIP socket so it looked like [ ] ]), but I decided against that route when I decided to get a PICkit instead of a Microstick 2. Instead of putting a big blockomatic onto your board for debugging, the PICkit has a five-pin ribbon connector that connects to a header you put on your board and takes over the show through the magic of ICSP. I assume it's very much like JTAG in concept.
In terms of coding, the documentation seems to go out of its way to make everything as complex as possible. Mercifully, after a Reset the default settings for most registers are safe: all optional modules off and all pins are set to non-explodey defaults. My timer code appears to be working; the built in LED is blinking at my command. Correct rate, correct duty cycle. Also, the clock selection thing seems happy enough. It's running at 39.61375 MIPS out of a maximum of 40 MIPS. To set the clock, you have a set of variables that massage the internal 7.37 MHz clock through a number of discrete stages into the final instruction clock speed. I'm using values copied from a guide on getting started with dsPIC33 (a lot of example code uses the same values for full-tilt operation), but I've worked out alternate solutions that could let me run the chip at a slightly higher 39.92083 MIPS. It's a 1% increase but according to all the data sheets it's within the safe limits. I'm not really sure what 'safe' is other than what the data sheet says 'never go beyond X at each stage Y in calculating the clock speed'. I'd worked out a completely middle-of-the-road solution to get a totally safe looking solution for 37 MIPS, so I was surprised to see everybody else going for higher numbers. It works now and it's 99%... let's leave it be.
It's just a crying shame that this particular Microstick only works with these two chips. The only difference between the chip that's inserted into it now and the chip I want to use is this one has PWM outputs (my nemesis, come to haunt me) instead of DACs, and half the code PROM space. Same clock speed, modules, form factor, pinout, everything... calling it an underpowered shitbag on the previous page was uncalled for; I was overcome with FURY at my own incompetence.
The real worst thing about this is that I now own a fully functional programmer and two extra high-powered jack-of-all-trades-as-long-as-you-don't-want-analogue-out chips. I could do anything with these... I could link them to the Ocelot's main CPU through I2C or RS232 or whatever and use them for Extra Crap. I could whack up to 18 bits of R-2R onto the second chip and use it as a 39.99 MIPS soft-synth chip! That's a hell of a lot of MIPS and they're not shitty MIPS either. Single cycle multiply and divide, or so the story goes. Or, alternatively, I could swap them around: make the non-DAC the Boss chip and use the DAC chip as a dedicated vectoriser, whirling around its own internal copy of vector screen state until its told otherwise by the all-digital Boss chip. If I did that, game hardware or software lock-ups wouldn't cause the oscilloscope to dangerously freeze. (DMA is supposed to let you do that anyway, but who knows if I'd be able to get that working.)
It's never going to end. I'm going to end up with biscuit tins full of absurd home-made electronic crapola. Every mistake and every purchase just leads to more spare stuff that's just itching to be put to use.
Re: Asteroids on Oscilloscope
someone was telling me about cleaning out his house because he wants to move, finding interesting components, then ordering more to go with them
Re: Asteroids on Oscilloscope
Here's the Ocelot mainboard full of wires and pin-headers.

I was curious if the PP3 connector I'd bought to clip on a 3xAA battery holder was the same type as a 9v battery, and it was. Since I'd used the voltage regulator, the gizmo should be able to handle 3V-20V (limited by the capacitors tolerances. Maximum of 12V if you attach the amp board due to the TBA820Ms maximum.)... I connected the 9V and started testing voltages to see if I was getting the promised 3V-3.6V on the VDD terminals. Nope, I was getting 6V. Everywhere I was expecting to see regulated voltage I was actually seeing the battery minus a diode drop (it's an old 9V so it was only 7.2V unloaded). I checked the board for bridges. Nope, my soldering's good. I checked to see if I'd installed the regulator correctly. Yep, as I thought, I've got unregulated voltage on the topmost row (connected to the amp board only), then ground, then regulated voltage on the lower row. The big strips of wires in the centre are soldered to ground and regulated voltage. If you look at the regulator from the top and have the flat surface 'up', the datasheet says...
Oh. Wait. It says on the datasheet that that's bottom view. I've installed the regulator backwards.
If you can't see the regulator on the picture, it's the small black rectangular object in the top right I've maked with an arrow, between the small orange cap and the big cylindrical cap. While I'm there, I'm going to desolder half of my 22k/22k divider and put in a 10k I had left over from my Mega Drive cartridge bits. The 22k/22k divider was supposed to let me measure the raw voltage from 3 or 4 rubbish-but-kinda-okay rechargeable AAs that would come in anywhere between 4.0V and 6.6V combined (measuring 2.0V-3.3V through the divider, safely in the range). If I make it a 10k/22k divider, I can measure a 9V battery's voltage safely too!
This is why we test. And test. And test! And never connect work-in-progress crap to the mains! And insert the expensive irreplaceable ICs that would explode if you put them into a 4V supply LAST.

I was curious if the PP3 connector I'd bought to clip on a 3xAA battery holder was the same type as a 9v battery, and it was. Since I'd used the voltage regulator, the gizmo should be able to handle 3V-20V (limited by the capacitors tolerances. Maximum of 12V if you attach the amp board due to the TBA820Ms maximum.)... I connected the 9V and started testing voltages to see if I was getting the promised 3V-3.6V on the VDD terminals. Nope, I was getting 6V. Everywhere I was expecting to see regulated voltage I was actually seeing the battery minus a diode drop (it's an old 9V so it was only 7.2V unloaded). I checked the board for bridges. Nope, my soldering's good. I checked to see if I'd installed the regulator correctly. Yep, as I thought, I've got unregulated voltage on the topmost row (connected to the amp board only), then ground, then regulated voltage on the lower row. The big strips of wires in the centre are soldered to ground and regulated voltage. If you look at the regulator from the top and have the flat surface 'up', the datasheet says...
Oh. Wait. It says on the datasheet that that's bottom view. I've installed the regulator backwards.
If you can't see the regulator on the picture, it's the small black rectangular object in the top right I've maked with an arrow, between the small orange cap and the big cylindrical cap. While I'm there, I'm going to desolder half of my 22k/22k divider and put in a 10k I had left over from my Mega Drive cartridge bits. The 22k/22k divider was supposed to let me measure the raw voltage from 3 or 4 rubbish-but-kinda-okay rechargeable AAs that would come in anywhere between 4.0V and 6.6V combined (measuring 2.0V-3.3V through the divider, safely in the range). If I make it a 10k/22k divider, I can measure a 9V battery's voltage safely too!
This is why we test. And test. And test! And never connect work-in-progress crap to the mains! And insert the expensive irreplaceable ICs that would explode if you put them into a 4V supply LAST.


