Thursday, May 22, 2014

Lab 15. Space Invaders. (ii) A finer ADC

I've had to come back to lab 14 (measure of distance) and make sure everything was working correctly.
In fact my ADC was connected wrong (thx lab 14 for your great help!). So once I got the correct ADC I had to update a little bit of code in the game. Now I really have a smooth battleship movement, I'm happy with it.

I've also checked moving the refresh of the LCD in the main loop. Good news, it works. Bad news, it looks flickering, it looks better inside the systick, lets see as long as I keep developing.

As a side effect I implemented a first collision algorithm which needs further development.
As a side effect as well I've seen that the LEDs are not as flashy as they use to be.

Next step. Collisions upgrade.

And now ... the video :-)


Wednesday, May 14, 2014

Lab 15. Space Invaders. (i)

Hi!

I've just done a first crappy version of the game. Just to get to the contest. It is not the final version, it is a "version" but there's still a lot of work dealing with the deployment of the code to get to the contest. I'm sure it will not be in the finals but it will be in the contest :-) (or at least I hope).
Deadline is tomorrow may 15th and I've yet to fix the ADC + the main loop doing the refresh + collisions + smoothing the joystick, vamos, ni de coña, I get to deliver a finer version.

So here it is the release version, in fact a youtube video is one of the requirements so here it is.

Enjoy it!!!


Thursday, May 8, 2014

Lab 15. Space Invaders. Testing module IV (Sounds)

Hi!

I'm just done with my sound test function and guess what ... It works. I'm so happy.



In fact the important thing finally, apart from the DAC, it was "the delay" between the chain of sounds.

My hypothesis: (I've got not taken an scope and maybe my guess is wrong but it makes sense to me) the clock time of the processor is 80Mhz which is way faster to run all my tests (at 11Khz with about 1sec in total of real sound). If you don't put a delay you won't be able to hear anything.

I was having as well a wrong interrupt, another part of my problem.

Finally my working sound_test function looks like this (all the rest equal):

// Testing Tools
void Sound_Test (void)
{
// Predefined sounds
Sound_Killed();
Delay100ms(20);
Sound_Shoot();
Delay100ms(20);
Sound_Explosion();
...

Here you can find the most significant files for the test:



During the Delay100ms I've the time to go through all the sampled sound with no other interruptions apart the one I'm interested.

And that's it, thx again to all of you

Lab 15. Space Invaders. Testing module III (Fire buttons & Joystick)

Hi everyone!
I think I've got already all the pieces to go through the game engine more confident in my hardware.
In fact my very hard problem is that I do not understand one of the pieces of my DAC testing. Going through all the sounds I've just got the very last one, it looks like if my test function is faster than my timer2 handler. No big deal for the game but frustrating as a test sound function.

Anyways, the fire button and leds had not really being a challenge, but integrating my joystick (the ADC) looks like it will be (is it not linear anymore??? weird?!)

By the way, I'm already @ 30K ! I've just got 2K left for the GameEngine (I guess and hope that I've enough ... )

As usual I let you with a proof of concept of this latest test module.

Have a nice day!




Wednesday, April 30, 2014

Lab 15. Space Invaders. Testing module II (DAC)

I'm testing the DAC. I was initially designed the DAC to be a 4bit DAC as it was in lab13 but going a little bit through the code I've seen that the sound resources I've got are 8 bit so I had either to upgrade the DAC from 4 bit to 8bit or downgrade the sound sources from 8bit to either 6 or 4 bits. I've read that 6bits DAC makes a pretty good sound (in the other hand it will take more memory! and I've only 32k!). So I've take the decission to upgrade my DAC to 6bits and downgrade the wave sources from 8bits to 6bits.

Here are my waves:

  • explosion.wav
  • fastinvader1.wav
  • fastinvader2.wav 
  • fastinvader3.wav
  • fastinvader4.wav
  • invaderkilled.wav
  • shoot.wav
  • ufo_highpitch.wav
  • ufo_lowpitch.wav
And here it is the Matlab script to download the wave and covert it, downsample it: (watch out! this converter is for 4bits)

Anyways, my first test of the DAC module is to test that the DAC is correctly implemented, so here I show you the ramp of a 6bit DAC and a closer look of the DAC hardware implementation, that' all for today folks!





Monday, April 28, 2014

Lab 15. Space Invaders. Testing module I (LCD)

Lab 15 is the final project of the edx.org "embedded system shape the world", the target is to build a video game in <= 32Kbytes (fun, isn't it? I've got less memory than my first ZX Spectrum 48K!) so, do not expect to see here the latest graphics, music and game experience.

Let's be honest, it will be far from being a PiPhone but I think that at least I will have the same fun as its creator.

I've got to break down the project in its main modules driving, the lcd, the DAC sounds, the LEDs, the "joystick" and finally the main engine controller.

So today is the first part, the LCD testing module :-) and here it is ...







Monday, April 21, 2014

Lab 14. Measure of distance

Here we go with Lab 14. What about lab 14? Well, the amazing thing of lab 14 is how we can sense the world. The lab was about making an "electronic ruler". Basically it was the symetry of lab 13 instead of generating signal here I was interpreting signals. 

Once the lab was done and graded I had a little problem with the screen!


It was full of noisy pixel everywhere. After checking once and again every single connection, the solution was, guess what ... turn off, turn on the device! And never had this problem again

Once I put the ruler on the variable resistor, once again, guess what!, I had to calibrate! and linear regrese the values to have a lineal ruler (using excel). Now I had the lcd, here it is the setup!


And finally the electronic ruler in action here!



If you're interested in the code, check it out here.