Monthly Archives: October 2012

Working dsPIC30f4011 code to control servo angle from PC via serial

Here’s a working example of servo angle control from the PC, via serial communication to the dsPIC30F4011. The servo angle is set using a 5 character long command: The first character is ‘s’. The remaining four characters, which must all … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , | 2 Comments

Simulating a Ctrl-V keystroke in Win32 (C or C++) using SendInput

This short example program simulates pressing Ctrl-V on the keyboard (the Windows shortcut for “Paste”) once every second. It’s a modified version of an earlier example I posted on keystroke simulation using the Win32 SendInput function. What’s different this time … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , | 52 Comments

Automating image creation with ImageMagick

I sometimes evangelise about how important it is for engineers to be familiar with “professional-grade” drawing software. My heart sinks when I see people drawing diagrams in MS Paint (the free drawing tool that comes with Windows). Software of that … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Posting C code on wordpress.com

I see a lot of people (including many of my students) having problems posting C code on wordpress.com blogs, even when they use the “sourcecode” shortcode which is provided for exactly this purpose (see here for details). The following are … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Short dsPIC30F4011 program to test output compare SFR values

I’ve been playing around with the output compare feature of the dsPIC30F4011 microcontroller for the last day or two and finding out some interesting things about it. There are two output compare channels (OC1 on pin 23, OC2 on pin … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

PWM Sinewave generation using output compare on dsPIC30F4011

Reader Manu Abraham wrote in with an interesting query about sinusoidal variation of PWM duty cycle using the output compare feature of the dsPIC30F4011. The 30F4011 has two output compare channels which can be used to very easily generate periodic … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , , , , | 11 Comments

Drawing Trees with PyCairo

I’ve been spending some time this evening playing around with PyCairo, which is a very handy drawing library for Python. Actually, Cairo is the underlying drawing engine and PyCairo is a set of Python bindings for it. Anyway, in this … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment