sábado, 6 de novembro de 2010

How to Use Blekko to Rock at Your Job

How to Use Blekko to Rock at Your Job: "

blekkologo.jpgThe author of the web's first worm-virus, teamed with a man who dresses as a medieval warrior and goes to battle on the weekends and a woman who follows World of Warcraft, acupuncture and ballet, have raised $24 million dollars to storm the gates of the Google Castle. They got incredible press coverage when their new search engine, called Blekko, launched this week - but they are probably going to get slaughtered.



In the meantime, they have provided an opportunity for countless other freaks and geeks to use the magical tool they've built to grow our stature wherever we work; to cut through information overload, to shine a bright light on opportunities and to augment our minds with the snap of a finger. Read on for my advice about how to use Blekko and we'll use it well - for as long as it lasts.


Sponsor



blekkoskrenatascoble.jpg

Blekko CEO Rich Skrenata, photo by Robert Scoble



What is Blekko?



Blekko was the name of company CEO Rich Skrenta's first networked computer. Skrenta was 15 years old when he wrote the Elk Cloner virus that infected Apple II machines in 1982; it is believed to have been the first large-scale self-spreading personal computer virus ever created. Skrenta went on to work on the Amiga at Commodore, then at Sun Microsystems, then co-founded the Netscape-acquired Dmoz and the Tribune/Gannett/Knight Ridder-acquired local news search engine Topix.



Now he's raised funding from a group of investors that include Marc Andreeson, to build Blekko. His band of freaky geeks include CTO and Society for Creative Anachronisms member Greg Lindahl and community manager Cheralyn Watson, who prioritized being ready for the WoW and ballet communities in the days leading up to Blekko's launch. (I found that quite charming.) The entire Blekko team includes more than 20 people.



What have these people built?



Blekko, simply put, is a social Custom Search Engine creation service with RSS feeds. It lets users curate and subscribe to mini-search engines that return results only from selected websites, thus increasing the signal to noise ratio and tightly controlling the context of search results.



If you've used Google Custom Search, really used it, that very powerful tool has been improved upon in Blekko because the latter was built to search large groups of sites and to have those groups shared and edited.



I used Google Custom Search all day, every day, to query my defined sets of blogs from technology analysts, geolocation specialists, semantic web scientists, youth marketing bloggers, English-language Asian tech bloggers and more, about whatever topics we're writing about here at ReadWriteWeb.



These Custom Search Engines are like dynamic reference books, populated by the blog archives of topical experts. They are things of magic - but Google CSE has never caught on beyond its widespread use as an embedded search box for a single website. That's tragic, if inevitable: the most powerful magic on the web will never be appreciated in its making, only in its results. Those of us who appreciate its making get to make some it ourselves. But more on that in a minute.



Blekko launched this week to big write-ups in the Wall St. Journal, the New York Times, TechCrunch and a flood of other outlets all over Techmeme. Frankly, I think it got all that press because it's backed by Andreeson, makes big claims about improving on Google, talks smack about red-hot content farm Demand Media as part of its pitch, has founders with very credible pedigrees and has good PR. But the general response to the company's product has been confusion and doubt.



As a regular and heavy user of Custom Search Engines, I've got some ideas about why most people are unlikely to appreciate the beauty and power of Blekko. But cynicism is cheap. Strategic advice on how to most effectively use a good tool is far more valuable and interesting.



How to Be a Blekko Power User, For Fun and Profit



blekkoapis.jpg



I'd like to share a few thoughts about how I'm planning on using Blekko, based on the strengths and weaknesses of Google Custom Search. But first some assumptions:

  • I'm going to assume that you work in a field where high-quality information is valuable.


  • I'm going to assume that you can imagine the value of first mover's advantage, when it comes to information.



I believe that everyone works in a field like that, most people just don't know it.



First step, compile yourself a magic collection.



A searchable collection of your industry's top blogs and websites allows you to quickly put any topic in context, based on what the most knowledgeable people in your field have written about that topic in the past.



I've built scores of Custom Search Engines, but the first one I put into production is something I call my Magic Search. It's a collection of 25 of the top Web 2.0 news and review blogs on the web - all our competitors here at ReadWriteWeb.



I do a Magic Search whenever I see a new company or website, to see if and what our competitors have written about it. Last week, for example, someone sent us a link to the incredible website MapCrunch (like StumbleUpon for world-wide Google Street View views, try it!) and I was impressed. I did a Magic Search for it and with a snap of my fingers found that two of our biggest competitors had already written about it 3 weeks prior. (I hate to tell you how the sausage is made, readers, but if any of the leading tech blogs finds out that something has been written about by a competitor 3 weeks ago, then that would mean that we are 3 weeks behind if we write about it afterwords. There is nothing a leading tech blogger hates more than being considered behind the times. So I tweeted about it, and I'm telling you about that wonderful site now.)



If I'm writing about a company and I am being a good blogger who wants to mention competitors in providing the same type of search, I Magic Search it. For example, this week Nick Bilton wrote about the new email snooze-button service Nudgemail at the New York Times and got slammed in comments for failing to mention another service that had been providing the same kind of service for years. I reviewed Nudgemail after Bilton, and I made sure not to make the same mistake. I Magic Searched the neglected competing company and found that it had been written about by my competitors a number of times, along with still other companies providing the same type of service. So I included links to all of them in my write-up and I think it made for a pretty snazzy article.



If I want to know what startups provide a particular kind of service, I Magic Search it. If I want to know what my competitors have written about a person in our sector, I Magic Search them. If I want background on anyone or anything I'm looking at, background drawn from the archives of specialists in my field, I Magic Search it.



It's awesome. I've got it on my phone, I've got it on my browser toolbar and I've got it a couple of other places I won't mention here.



I've built that and my other Custom Search Engines with Google CSE, but Blekko is a very nice alternative. It provides a clean, sharable URL. It can be collaboratively edited. It handles search across hundreds of domains in one collection very nicely. It offers date-based search in a click. Blekko is a better service than Google CSE and I plan on moving all my engines there, as soon as the company offers a way for me to share them privately with my co-workers and no one else. Blekko's management says that's on the development road-map but not available yet.



Quick tips:

  • Build a collection of top blogs on any topic using any of these methods, or others - or just Google for 'top blogs in X' and grab someone else's list to turn into a custom search engine.


  • If you find a list on a page - try putting that page through LinkLeecher or some other way to quickly scrape the URLs off the page and into your Custom Search Engine creation tool. Sometimes I'll open a text editor next to a browser page, drag the URLs onto the text editor, then find and replace all instances of 'http' with '[linebreak] http'.


  • If you've got a collection of the top blogs on any topic built, there are any number of things you can do with that, if you're creative.



Next step: Building Collections on the fly.

Content on the public web is searchable and the savvy searcher will manipulate that content to search it the way they want it.



Both Blekko and Google CSE are well-suited for carefully curated collections. Blekko in particular encourages the creation and maintenance of high-quality custom search engines with its easy collaborative editing, subscription to updates and more.



Sometimes you've got to do it quick and dirty, though.



Here's a story. This Spring I was hired to be one of the official event bloggers at a crazy conference called Techonomy. Bizarrely creative and accomplished people from all around the world came to speak at the event about how to use technology to solve the world's great problems (water, food, poverty, pollution, etc.)



The night before the event, a co-worker and I scraped the names and associated URLs from the pages listing the speakers at the event. I then threw those URLs into a Custom Search Engine that I used to do super-fast research while blogging on the conference floor. 'Speaker X says A,B and C. That's something that Organization Y, also participating at the event today, has posted the following white papers about in their website archives.' That worked really well.



While I was at it, I also put the names and URLs into a .csv file, uploaded them into Amazon's Mechanical Turk and paid $50 to have people around the world collect the Twitter handles, country-of origin and gender for each of the several hundred event participants. It took them about 90 minutes. I then created Twitter lists of all the participants, the women participants and the international participants, in part so I could put all three lists into Tweetdeck and make sure that as I was covering the event, I could track what people with different backgrounds were saying about the day. I also envisioned those lists being loaded into Flipboard, so you could have an iPad magazine made up of all the links shared by women who had attended the Techonomy conference, for example.



A few years prior, I did the same thing (and more) with companies launching at the DEMO conference, so whenever I was thinking about one, I could quickly search the websites of all the others and determine who else was working in the same sector.



Last week my mother emailed me to ask if I knew the educational technology speaker visiting her school that day. I didn't, but it took about 5 minutes to create an EdTech CSE and find what some of the most respected edtech bloggers online had said about the man. He and my mom ended up having lunch together and talking about the internet, which was pretty cool.



These on-the-fly CSEs are particularly well-suited to Blekko because anyone can then suggest revisions later. More importantly: it's a social community where you may find that someone else has already built the engine you're looking for and you can just grab it and go.



Quick Tips:

  • I've trained myself to see a list of anything and think CSE. If you've got, or want to create, folders in an RSS reader - it's relatively simple to export your subscriptions, open the OPML file in a text editor, see how simple it is and delete all the subscriptions except for the topic folder in question. Resave it, then you can upload the new .OPML file into Blekko. That's a very nice feature, OPML import.


  • The more you think in terms of URLs, the content they hold, the other URLs they are linked-to and the feeds that are associated with them - the more permutations for searching you can think of. The sky is the limit and it's a very rational system.



Finally, CSEs plus RSS equals a key to any inner sanctum. RSS feeds have been my bread and butter since becoming a professional blogger, and they are really what captured my interest more than anything when I first discovered social media. When I was just getting started (ok, sometimes I still do this), I would take the RSS feed of one or more blogs I really admired and I'd run them through an RSS to Instant Messaging service. These days, my favorite is Notify.me.



I'd get an IM within minutes of any post going up on a blog I really admired, and if I could make a meaningful value-add to the conversation, I'd jump right over and be the first person to leave a comment on the post. I'd do that just often enough to get their attention but not often enough to be annoying. (But where do you find interesting things to add to the conversation? If only there was some way to quickly search for keywords and tidbits in the archives of a collection of topical experts in any field!)



I used to do a whole lot of hitch-hiking and developed the ability to listen and converse with just about anyone, regarding just about anything. Participating in blog conversations is a much safer way to do that.



So - let's say you've got a good collection of topical expert blogs built up and you've got it put into Blekko so you can search against their archives. Guess what? Blekko offers RSS feeds for your search queries! That's awesome.



Take what parts of this you will, but I'll tell you what I'm going to do: I'm going to make sure that all the hundreds of geolocation experts who blog online know that I'm interested in geofencing and history because I'm going to subscribe to a feed for those two search terms in my big Blekko search engine of geolocation blogs. I'm going to read everything they write on the topic and I'll probably leave a comment whenever I can do so appropriately. Thank you, Blekko.



Google Custom Search does not offer RSS feeds. It has to be given a cookie and told to roll over just to get it to try to show you something close to the most recent search results inside your collection.



What Does it Mean?



These are just the ways that I intend to use Blekko, based on my experience using Google Custom Search and the ways that the two services are different. Maybe you've got other strategies in mind.



But here's how I see the three strategies above:



This is how I will assemble a magic reference book, a Dictionary, Encyclopedia and Atlas of the Past, Present and Future of...any topic I want.



This is how I will see a field, or a group of people and companies described online, and with a quick scrape be able to query deep into their online histories. Imagine looking at a set of people's names online, using find and replace to build a set of Google Social Graph query URLs to discover their blogs, bookmarks, Twitter accounts and more, then putting those URLs into Blekko. If that works, that's like 5 minutes of set-up to enable yourself to ask 'who in this room has ever bookmarked or tweeted a web page about topics X, Y or Z?' Hello dreamy social search engine!



This is how I will hone in on conversations in the future, among any set of experts, on any topics of interest to me. That's going to be very high signal and very low noise. That's like pulling a sliver of knowledge from the future and putting it straight into your brain - then sliding down it to arrive exactly where the conversations emerge, so that you can participate in them.



Will Blekko Succeed?



Clearly, only the ten people still reading this article and I are ever going to do the above - and we're going to have to click on a whole lot of ads to keep this puppy in business!



The rest of the world is unlikely to build Blekko-collections of their own because the cognitive overhead of curation is of a fundamentally different quantity and quality than the simpler requirements of consumption. People have compared Blekko to the recently launched Cuil because of the hype, but better comparisons could be made to the valiant but failed roll-your-own search engines like Rollyo, Swicki and Hittery. Not enough people with good intentions (not spammers) were willing to put the time in to use these tools well.



Blekko will attempt to compensate for this by automatically serving up search results from hand-curated custom search engines on big popular topics. That will help direct searchers to the Mayo Clinic's webpage for 'cure for the common cold' instead of Demand Media's eHow page on the subject, which is of clear commercial intent and questionable worth if you ask the Blekko team. Mayo Clinic doesn't have SEO people on staff, but Demand Media does, Blekko points out - so they built a health 'slashtag' that includes Mayo's site but excludes Demand sites. Health search queries are performed inside that slashtag by default.



Will that matter, though? Will millions of people rush with open arms into the unfamiliar, even if it's clearly superior upon the slightest investigation? Will people choose what's best for them? Will they choose what's most powerful and beautiful, instead of that which is easy and must remind itself constantly to 'Not be Evil?'



I would submit that if people were likely to make such choices, the world would be a very different place than it is today.



But in the meantime, fellow benevolent hackers, fellow dreamers of antiquity who find ourselves on the web, fellow fans of ballet, acupuncture and other romantic, unorthodox pursuits --- when we find ourselves with a need to search, in a cruel and banal world, may we use tools like Blekko. May we use them to dive deep into the archival knowledge of the finest writers and thinkers in our respective fields. To survey quickly what any set of people online have said before. And to track what our most trusted sources say regarding any topic, anytime in the future.



Even if no one else understands. They don't all need to understand, because in the hyper-linked, flash-curated, streaming social world of the future - those of us who know how to dance among the links and the fleeting, beautiful startups that overestimate most of humanity's capacity for intellectual engagement before crumbling into craven ad networks just to keep the lights on - those of us who can do the power user's dance in those circumstances will know that our positions are secure and that the web will be ours to create on. And we'll treasure beautiful things like Blekko, whether the rest of the world does or not.


Discuss



"

Edward Horsford's Popped Water Balloons

Edward Horsford's Popped Water Balloons: "


Edward Horsford takes photographs of water balloons being popped. The results create the impression of water hanging in midair:


“My camera is really the least important part of the shots,” Horsford writes in an e-mail. The trick seems to be in the timing of the flash. He sets a timer on his camera to take a long exposure of 1 to 2 seconds, and if the flash fires within that time, he gets an image. He uses a special gizmo with a microphone that triggers the flashes when it picks up a certain level of sound (i.e., the pop of a balloon).


You can view eleven more photographs at the link.


Link via Ace of Spades HQ

"

sexta-feira, 5 de novembro de 2010

Happy Birthday, Android! A History, in Screenshots and Video

Happy Birthday, Android! A History, in Screenshots and Video: "

Google's mobile operating system known as Android was officially unveiled on November 5th, 2007, making today Android's 3rd birthday. It's fair to say that this mobile platform has taken the world by storm - in just a few years time, it's gone from a non-dominant player in the mobile OS market to the top smartphone platform in the U.S. and number two in the world. There are even predictions that it will overtake Nokia for the top slot worldwide by 2014.



Let's see how it got there, shall we?


Sponsor





November 5th, 2007: Android Debuts



After months of speculation, Google finally squashed rumors of its so-called 'GPhone,' a direct iPhone competitor, gloriously mocked up by Internet enthusiasts to look like this:





But that was just an imaginative design. The real Android looked a lot more utilitarian when it finally debuted.



'This is the droid You're Looking For'



The famous blog post headline on November 12th, 2007 introducing Android's first SDK (software development kit) still gets repeated by bloggers today. Meanwhile, we got our first look at Android itself, thanks to a YouTube video dubbed 'Android Demo.'





Wow, That's Ugly!



After all the anticipation, Android's reveal at Mobile World Congress in February 2008 was a bit of downer. All that was on display were crude prototypes that were the antithesis of the iPhone. These weren't sleeky and sexy devices, they were science projects!






Luckily, smart journalists saw the potential:



Charlie Sorrel wrote for Wired's gadget lab: 'it's not fair to laugh at the huge circuit boards: These are design prototypes and will of course be shrunk down to a fraction of this size.' He was right.



Apps Emerge



By fall (Oct. 2008), Android apps were starting to emerge, and frankly, they looked hot. We drooled over imeem, BooRah and MySpace apps, remember?



Soon after, a company called AppLoop launched a DIY Android app generator. Today, Google has one of its own.



1.5 Cupcake



In February 2009, Android 1.1 debuted followed by 1.5 'Cupcake' in April, beginning the long list of named flavors of Android OS versions. Cupcake delivered video recording, YouTube uploads, widgets and more.



android-g1.jpg







1.6 Donut



September 2009 brought Donut and with it an improved Android Market, better photo gallery and voice search, better home screen search, text-to-speech, support for CDMA/EVDO, 802.1x, VPNs, WVGA resolutions, turn-by-turn navigation and more. Oh, and some rather interesting Android skins started to appear, too.



504x_donut4.jpg



android-hero-new-1.jpg





2.0 Éclair



Éclair came out in late October 2009, to make things prettier. More screen sizes and resolutions were supported, Android got a revamped UI and browser UI, the background's contrast ratio was improved as was the virtual keyboard and the fun 'Live Wallpapers' feature was introduced. Android became more corporate-ready with Micrsoft Exchange support at this time.



Android-2.0-Eclairjpg.jpg





2.2 Froyo



Released in May 2010, Froyo has yet to make it to all phones, but those that do have it in all its glory can enjoy USB tethering and Wi-Fi hotspot functionality, contact sharing over Bluetooth, voice dialing, Adobe Flash, support for installing apps to expandable memory, an improved app launcher and even more Exchange support, to name a few things.



samsung-galaxy-s-android-froyo.jpg





Coming Soon: Gingerbread



Now we're waiting on the first Gingerbread (Android 2.3) device to be revealed. We expect to see it next week at Samsung's press event. Gingerbread will deliver WebM video playback, better social networking features and better copy-and-paste support. Rumored features include an Android Market music store, media streaming from a PC, a new UI, 3D games support, video calls, support for WebP images and Google TV support. We have our fingers crossed!


Discuss



"

How Are Smartphone Users Perceived? [HUMOR]

How Are Smartphone Users Perceived? [HUMOR]: "


This image has no alt text

Have you ever wanted to know how the world sees you holding your Android or how you really see yourself when you use an Android phone? What about users of Blackberry and iOS? C-Section Comics has done extensive research and come up with the answers to all of those questions.


iPhone-BlackBerry-Android-csection-660x933


How accurate do you think this is? [via IntoMobile]

"

quinta-feira, 4 de novembro de 2010

Review: Atlas of Science, Visualizing What We Know

Review: Atlas of Science, Visualizing What We Know: "

Network tree diagram

Katy Börner, professor of information science, catalogs visualization and science in Atlas of Science: Visualizing What We Know.


Cartographic maps have guided our explorations for centuries, allowing us to navigate the world. Science maps have the potential to guide our search for knowledge in the same way, helping us navigate, understand, and communicate the dynamic and changing structure of science and technology. Allowing us to visualize scientific results, science maps help us make sense of the avalanche of data generated by scientific research today.


At first glance, without reading anything, it looked a lot like a general scientific visualization book. Sort of like the opposite of Data Flow. Where the visuals lack in aesthetics, they make up for with richness in data and detailed explanations of what you're looking at. There are a lot of network diagrams, some geographic maps, and a handful of traditional statistical graphics.



Taking a closer look though, I realized that it's actually much more specific than just a visualization catalog. It really is about 'visualizing what we know.' As in: cataloging scientific knowledge. Think of all the books, resources, and academic papers you might find in a library and on the Web, and then think of interfaces and visualizations to access all of that in a meaningful way. That's what Atlas of Science is about, from the point of view of an information scientist.



All of the visualizations are in color, which is nice, and the book is large at over a foot wide and almost a foot tall, leaving lots of space for full page images.


The strength of the book is that each visual is accompanied by a thoughtful description about the data, how the visualization was built, and what we should see in the picture.


While the book was written for a general audience, I have a feeling the topic might be a little too, for lack of a better word, sciencey for some. There are some very beautiful images in it though, and at under $20 on Amazon, the 288-page hard cover, in-color atlas is a steal if you're at all interested in the subject. If anything, you'll learn a thing or two.



For a better idea of the insides, you can actually view all of the high-res images online for free.


Comment to win a copy


Lucky for you there's a free copy up for grabs. Leave a comment below by Sunday, November 7, 8pm PST, and I'll randomly select a winner. Complete this sentence. Data is _________. Good luck.




"

How-to: Program PICs using Linux

How-to: Program PICs using Linux: "


Arguably, Microchip’s PIC microcontrollers do not get enough posts here. One of the drawbacks for some of us is that Linux support for PICs is not very well known. The information is out there, but no one has laid out the process of going from writing C code to programming a chip. Written for Linux users that are familiar with microcontrollers, basic circuits, the C programming language, and can read a datasheet, this how-to should get you up and programming a PIC quickly with Linux.



The Compiler:


The Small Device C Compiler, sdcc is what will be used to create the .hex file needed to program a PIC. Support for PICs is still growing, and still in beta, so be aware that things outside the code and chips of this article may need some debugging. However, like every other open source project out there, more contributing users will help the project. Best of all, it is free, with ports to Windows and MacOS X, this is a compiler that handles many architectures and devices without the program limit of free versions of for-pay compilers that are limited to Windows. Sdcc is available through various distributions’ package managers including Ubuntu and Fedora.


To install sdcc on Ubuntu:


sudo apt-get install sdcc

To install sdcc on Fedora:


sudo yum install sdcc

The Chips:


Three different PIC chips were used in the writing of this tutorial: the 40 pin PIC16F887, the 14 pin PIC16F688, and the 8 pin PIC12F675. You can follow along with any of these chips as well as other chips.


The Programmer:


We will be using two programmers, Olimex’s PICStart+ compatible PIC-MCP-USB programmer, and Microchip’s PICkit 2. Both programmers have been tested to work with the three chips used here.


The PICStart+ programmers use the picp program. Most any PICStart+ compatible programmer will work with picp. Easily installed in Ubuntu with:



<pre>sudo apt-get install picp

For Fedora and other distributions may have to download and install it from source. So, in an empty directory of your choosing:


wget http://home.pacbell.net/theposts/picmicro/picp-0.6.8.tar.gz
tar -xzf picp-0.6.8.tar.gz
cd picp-0.6.8
make
sudo make install

The source is on [Jeff Post]‘s Development Tools for PIC programmers page along with other programming options.


If you will be using the PIC16F887 and picp, you will need to modify your /etc/picp/picdevrc file by adding the following lines:


[16F887]
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
PICSTART

[16F887:def]
20 00 3f ff 3f ff 00 7f
00 7f 3f ff 3f ff 00 ff
00 ff 00 00 00 00 00 00
0D 10 20 00 04 20 07 02
00 00 01 00 00 00 00 00
00 01 22 0f

[16F887:defx]
3f ff 07 00 00 00 00 00
00 00 00 00 00 00 00 00
3f ff 07 00 00 00 00 00
00 00 00 00 00 00 00 00

The above lines are modified parameters for PIC16F886 found in a post by [Al Williams]. For chips not already in /etc/picp/picdevrc, additional parameters will need to be added to /etc/picp/picdevrc.


PICkit 2 programmers will work with another program called pk2cmd hosted by Microchip here. You will need to install pk2cmd from source. so in a directory of your choosing:


wget http://ww1.microchip.com/downloads/en/DeviceDoc/pk2cmdv1.20LinuxMacSource.tar.gz
tar -xzf pk2cmdv1.20LinuxMacSource.tar.gz
cd pk2cmdv1.20LinuxMacSource
make linux
sudo make install

Note that Microchip touts the PICkit 3 as a replacement for the PICkit 2. It is not a replacement for the PICkit 2 as there are no Linux drivers for the PICkit 3, so do not buy the PICkit 3 thinking it will work in Linux.


There is also another program that claims to work with a range of DIY PIC programmers: PICPgm. We have not tried this program or any of the DIY programmers at this point. We know there are other PIC programmers out there, both cheap and expensive, that have not been mentioned. Perhaps a PIC programmer roundup is in need of writing.


The Code:


The code for this how-to is a kind of hello world program using LEDs. The code for this is hosted on Github, you can follow along with the blink.c file for the PIC16F887, PIC16F688, or PIC12F675. Also included are working .hex files. Here is the PIC16F887 code as a reference as we walk through each major operation:


//Simple program to get started programming
//PIC microcontrollers in Linux.
//Written by Devlin Thyne.
//Released to the public domain.

#include "pic/pic16f887.h"

//Use these configuration words:
//0x2ff4 0x3fff

//Set the configuration words:
unsigned int at _CONFIG1 configWord1 = 0x2FF4;
unsigned int at _CONFIG2 configWord2 = 0x3fff;

//To compile:
//sdcc -mpic14 -p16f887 blink.c

//To program the chip using picp:
//Assuming /dev/ttyUSB0 is the serial port.

//Erase the chip:
//picp /dev/ttyUSB0 16f887 -ef

//Write the program:
//picp /dev/ttyUSB0 16f887 -wp blink.hex

//Write the configuration words (optional):
//picp /dev/ttyUSB0 16f887 -wc 0x2ff4 0x3fff

//Doing it all at once: erasing, programming, and reading back config words:
//picp /dev/ttyUSB0 16f887 -ef -wp blink.hex -rc

//To program the chip using pk2cmd:
//pk2cmd -M -PPIC16f887 -Fblink.hex

//Setup variables
unsigned char ucharCount = 0;
unsigned int uintDelayCount = 0;

void main(void)
{
//Set PORTC to all outputs
TRISC = 0x00;

ucharCount = 0;
uintDelayCount = 0;

//Loop forever
while ( 1 )
{
//Delay Loop
while ( uintDelayCount < 10000 )
{
//Increment the loop counter
uintDelayCount++;
}

//Reset delay loop counter
uintDelayCount = 0;

//Increment the count
ucharCount++;

//Display the count on the PORTC pins
PORTC = ucharCount;

}

}

The first line is the #include for the header file of the particular chip you will be using. It tells the compiler which registers are available and where they are located in memory. In most systems, the header files will be in /usr/share/sdcc/include.


Then we setup the configuration word or words fuses. They are only able to be written when the chip is programmed, but we can define them here so we don’t have to manually program them later. The PIC16F887 has the address for the configuration words defined in its header file as _CONFIG1 and _CONFIG2. The PIC16F688 and PIC12F675 do not have the configuration word address defined in their header (we said sdcc was in beta, didn’t we?), so we just use the address of the configuration word: 0×2007. The configuration words are specific to the chip model and application and are described in the chapter “Special Features of the CPU” in each of the respective chips’ datasheets. In the blink.c samples, the configuration word is just a 16bit hexadecimal word, but the word can be made more human readable by ANDing together the configuration options. Check out the chips’ header files for the names of the options.


Next, we setup some global variables, one for the value that will be output on the LEDs and the other for a delay counter.


In the void main(), we set the PORTC tristate register, TRISC to all outputs. The PIC12F675 has only one port, GPIO, and its tristate register is TRISIO. After setting the tristate register, we enter an infinite loop with while(1). Inside that loop is a delay loop so that we can see the LEDs changing. Following the delay loop, the display counter is incremented and then written to PORTC (or GPIO) for display on the LEDs.


Compiling the Code:


Now that we have reviewed the code, it is time to turn it into something a PIC can use. sdcc will take the blink.c file and make a bunch of files. One of these files will be blink.hex which will be what the PIC device programmer will be writing to the PIC. Here’s how:


For the PIC16F887:


sdcc -mpic14 -p16f887 blink.c

For the PIC16F688:


sdcc -mpic14 -p16f688 blink.c

For the PIC12F675:


sdcc -mpic14 -p12f675 blink.c

The -mpic14 option tells sdcc that it will be compiling for the 14-bit instructions of the PIC16 and PIC12 families. The second option is the specific chip that code will be compiled for. The last thing on the line is the file containing the C code that will be compiled.


Programming the Chip:


To program a chip you will take your device programmer and connect the chip you want to load with your program. Unless you are using a socket programmer like the PIC-MCP-USB, you will need to consult the datasheets of the programmer and the chip to be programmed for the proper connection. Once properly connected, you will need to run the program to run the programmer:


For a PICStart+ programmer on /dev/ttyUSB0 programming a PIC16F887 :


picp /dev/ttyUSB0 16f887 -ef -wp blink.hex -rc

For a PICkit 2 programmer programming a PIC16F887:


pk2cmd -M -PPIC16f887 -Fblink.hex

If you are programming another chip, or the PICStart+ programmer is on a port besides /dev/ttyUSB0, you will need to make corresponding changes to the commands.


Note: The code provided for the PIC16F887 disables low-voltage programming. Some of the programmers available but not directly mentioned only perform low-voltage programming. If you have one of these programmers, you will need to change the code so that the low-voltage programming bit in the configuration words allows for low-voltage programming. The low-voltage programming pin on the microcontroller will also need to be pulled low during normal operation.


Wire the Circuit:


The circuit for this project with the code provided is really simple to breadboard. Below are the schematics for the three chips:



Start out by connecting the Vdd pins to a positive voltage source between 4.5 volts and 6 volts and the Vss pin to ground. The 40 pin PIC16F887 and the 14 pin PIC16F688 will both need a pullup resistor on their master clear pin. To any one or all of the PORTC pins (or GPIO pins for the PIC12F675), connect LEDs with current-limiting resistors to ground. Note that pin 4 of the PIC12F675 is only an input and will not light an LED. The current out of any pin of the three chips used is limited to 20mA, so the current-limiting resistors are optional for most cheap jellybean LEDs. What you should see when you power up the circuit are blinking LEDs. The LEDs should be lighting to a binary count.


Your turn!


Now that we have given you a start with programming PICs using Linux, we hope to see more projects using these chips and the tools we have mentioned above. Though this article was written for Linux users, Windows and MacOS X users should be able to use sdcc for their PIC programming needs.


Image information: The Tux logo is by Larry Ewing, Simon Budig, and Anja Gerwinski, via Wikimedia Commons. The Microchip logo is a registered trademark of Microchip Technology Incorporated.




Filed under: linux hacks, Microcontrollers

"

Minha lista de blogs