Ported to work on chipKIT

Made some changes to make work with chipKIT boards.  Didn't back test to Arduino, but I'm pretty sure it will work.