Hein (fub) wrote,

  • Mood:

Hail to the king, baby!

It seems my most inspired time is in the morning, just before waking up completely. I tend to think up solutions for the problems I am faced with -- at least in the realm of programming and electronics. I had noticed that pin A4 did react to my settings, but pins A0-A3 didn't. So, I thought: I have 8 pins in port B that I can use, why not connect the ninth lead to A4?
And so I did that -- to little avail.

Dissapointed, I googled for 'porta pwm 16f628', and I saw that people set something in the CMCON-register, to turn off analog comparators. Intrigued, I opened up the datasheet and googled some more. The solution was simple: set the 7th bit in CMCON to turn off the analog comparators, and the pins will react like normal, well-behaved digital pins.

And now, I have 3 RGB-LEDs changing color via PWM. I'll clean up my code later and post it -- right now it's off to the showers and to bed!

  • OneDrive to rule them all

    Four and a half years ago, I managed to get one of the free STACK 1GB cloud storage, and I’ve been using it since — mostly for storing…

  • Little laptop

    Most of the stuff I do on a computer can be done in Firefox: mail, twitter, discord, etc. But my machine is in our office (it’s a proper…

  • Preparing for our vacation

    I hardly left the house today, and decided to do some chores to prepare for our vacation. One of those is to brush up on the mailing list: I tend to…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded