Hein (fub) wrote,
Hein
fub

  • Mood:

Smallest footprint PWM

I have only worked one day with the Wisp628 programmer, and I've already fallen in love with it. I made a test-circuit with a 12F675 on my breakboard, and I could simply stick the connection wires in the breadboard and program the PIC while it is sitting in the ciruit.

Which was a good thing, because my initial attempts at porting the PWM code to the smaller PIC (only 8 pins!) were unsuccesfull. For some reason (which I haven't found out yet), the PICs GPIO register (which controls the outputs (i.e. which pin sources current for, say, turning a LED on) doesn't like bit-wise operations on it. If I set the 3rd bit in the GPIO register, all other bits are turned off -- so I could only get one LED burning at any time.
Very odd, something I will ask the various internet fora about. But setting the whole register all at once (copying the contents of the working register into the GPIO) did have the desired effect.

Pretty bizarre, but I 'solved' it by doing all bit-wise operations on a register, and copying the contents of that register into GPIO after all bits had been set. Works like a charm...
I got it working too late in order to use that new-found knowledge in the mini-andon we made for klik's grandmother, who will be celebrating her 93rd (!) birthday tomorrow -- but a 16F628A also did the job, so no problems there.
Tags: electronics project
Subscribe

  • Gundam

    My love for the mecha anime genre is well-documented on this blog and elsewhere. And of course, Gundam is the granddaddy of the genre, such a huge…

  • Kakiage

    I’ve been on a manga-reading spree these days. It all started out with Dungeon Meshi, which merges my interest in RPGs and dungeon delving…

  • Anime movie introduction

    Two weeks back, a colleague wore a shirt with a text that also included ‘NEO-TOKYO’. I asked him if this was a reference to Akira, and…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments