Close

First Port to the PIC10

A project log for PICSPEAK

A rudimentary voice synthesiser in less than 1kB of code.

luciolucio 12/07/2016 at 10:540 Comments

I have completed the port to the PIC10 and the little (6-pin) critter speaks!

Very interesting exercise indeed. First of all I had to refresh my PIC assembly. I was amazed how much rust had accumulated in only a couple of years (or is it more) of "only" C programming. The original code was written for 12-bit "baseline" PICs, the old C5X series, and that used to come with a whole lot of restrictions and complications that I had almost completely forgotten about. For example, subroutines could only be called in the lower half of the program space. Since the only way to implement a lookup table in those days was to use the "idiosyncratic" RETLW opcode... tables themselves were restricted or rather we used to jump through hoops!

Now the PIC10F3xx, is a "mid-range" PIC, meaning the instructions are 14-bit wide which allowed me to move things around a bit. I now for a fact that the code does fit now!

The PIC10F32x also comes with a convenient PWM, and that can be clocked fast enough (using only the internal oscillator) to produce an audio D/A, so all I need now is a single output pin.

Most importantly, I programmed the code on the little PIC10F demo board (see picture) and connected (poorly) a little audio amplifier: it does speak, kind of ...

Definitely not happy with the quality of the sound, I am going to investigate how the ... I did come up with those samples back then. What was I thinking?

Also I see a few possible directions (branches?) this project could take from here:

1- Investigate use of the NCO (frequency synthesiser) peripheral (instead of the fixed PWM) to frequency shift a single sample waveform and produce the multiple vowels needed. I need to think this one through...

2- Evaluate replacing the RETLW tables with proper NVM access. The PIC10F3' Flash read/write module allows full access to the program flash word. That would give me 14-bit of data for each word instead of just 8. I could pack double the number of samples...

3- I could get adventurous and try to change the "spoken" word into something more appropriate for the contest ("one k", or "Hackaday"?)

Discussions