What's new
What's new

Any software gurus? Looking to write simple software for PIC programming

viper

Titanium
Joined
May 18, 2007
Location
nowhereville
We are doing some playing with PIC driven devices and are considering writing a bit of software to select certain options or functions and rewrite the PIC via USB cable from either a laptop or PDA. This is new territory for us so wondering if there is a software creator out there that specializes in writing new software like this from scratch? We have access to labview for certain functions but we see this as an opportunity to try something new.
 
There may be some folks here, but if not, I wonder if you'd get some useful responses by joining one or more of the many PIC related groups on Yahoo and asking there. (I'm not using PIC's, and not a member of any of the groups, so don't have one to recommend -- maybe someone else here can offer a recommendation.)
 
We are doing some playing with PIC driven devices and are considering writing a bit of software to select certain options or functions and rewrite the PIC via USB cable from either a laptop or PDA. This is new territory for us so wondering if there is a software creator out there that specializes in writing new software like this from scratch? We have access to labview for certain functions but we see this as an opportunity to try something new.

2 of my ex-staff can do this, both of them are university graduates in electronic engineering with years of experience. Neither work particularly cheaply though. Labview is OK but very limited IMO which is why we wrote all our own software - I was a bit higher up the food chain on code development myself.

PM me if you don't find anyone closer and I'll flick it to one of the guys.

PDW
 
We are trying to build our knowledge base to do this stuff in house. Not looking to outsource at this point due to the level of tuning we will have to do. We write dynamic websites and currently do PIC programming but programming software is new to us. Hoping to find some good resources.
 
Are you familiar with Basic Stamp computers? They have a PIC with a ROM programmed in the Basic language. They are ridiculously simple to program.

Bill
 
I did quite a lot of embedded systems work with PIC's a few years ago, both in the chip and the PC based control software which talked to it. I've never had much confidence in burning the chips- the programmers we used were never as reliable as we could wish- though I didn't experiment much with them. Instead we put an spi eeprom on the board w/ the pic and stored "non-volatile" stuff in there. That had the advantage of letting us develop/test/debug a single binary image that was always burned the same way and not subject to dynamic modifications. That was very helpful in our situation at least- we released 3 major revs of the firmware w/ field upgrades of existing customers, etc- a well-defined checksum of the part helped a lot on several occasions.

The PICs are nice enough I guess but I never cordially liked them. The native instruction set is dreadful and the bank-switched code & data was often a nuisance. Nice and fast though, with a 10mhz or better clock you can do quite a bit with them.

Greg
 
depending on what you want to do, how complex it needs to be
and how many units you look to see, will have some bearing on which microprocessor and programming language you want to go with.

pbasic with parallax' BS2 stamps are very well supported, excellent forum that is very helpful and their kit for learning is reasonably priced and easy to pickup especially if you know what you want done before you start.

the processors cost a bit more than a pic, but it is an all together solution that is much easier to work with in my opinion.

go to parallax and check into their products and their forum.

bob g
 
I do it for a living (along w/ lots of other processors.) There are no NEW pic processors that aren't flash based. Program them over and over and over... 18F family has a real hardware multiply and pointers for a sw stack so it works excellent w/ C. There is a free student version C compiler avail on their website. You can buy a PIC w/ ethernet on board for <$4, I don't see why anyone would use anything w/ runtime basic (unless you REALLY just don't want to learn C.) The processor is basically 'free' compared to the development time of either.
 
I do a lot of Pic programming. If you are looking to use USB, I'd recommend the 24 series 16 bit as they come with USB libraries in C. First you want to go to the microchip.com website. Click on Forums and join up. That's where your questions belong. Invest in an Explorer 16 experiment board. Then go back to the microchip website and look under training. They have a 2 day seminar for USB and they are absolutely excellent !!! $200 US for both courses. You can buy an Explorer 16 at the training site at a special reduced price. Nobody's going to write the entire program for you for free though and if they see you asking 50 questions on the Forums you might become pretty unpopular on the boards. You can PM me with a few general questions but I'm up to my neck in my own projects. I'm not going to go beyond a few general questions uncompensated. Lucio Dijasio's book Programming 16 bit Microcontrollers in C is excellent but you need that board to do his labs.
 
I own a Basic Stamp 2...collecting dust.I'm not aware that they have any libraries for USB though.
 
I may not have understood your question.....all the programmers use a USB interface but do you not already have a programmer ? If not, get the PicKit 2... its better than the PicKit 3. I still don't know what you are saying though in your post. It's quite vague. I consider it to mean you are already programming PICs ergo you must already have a programmer.
 
So, if I understand correctly, what you're looking for is software that can be used to re-configure certain parameters of a PIC powered piece of hardware?

If that is the case, re-programming the program memory is doing it wrong; 'configurable' values such calibration values, set points, etc. should be stored in the PIC's onboard EEPROM or on a external EEPROM. If you intend on putting the functionality you describe in the hands of your customers, you're giving away the keys to the bank -- you're making it dead easy to rip off your firmware. The other missing component is programming hardware -- what are you using right now? There is something sitting between your PC and your PIC that is making the magic happen.

If you are in fact convinced that you need to re-program the PIC for your needs, there is open source software out there that can talk to most of the common PIC programmers available. Being open source makes it easy for you to script, modify and customize the software to your heart's content -- as long as you follow the stipulations you are bound to by the open source license of the software you use.

If my understanding as outlined in the first paragraph is indeed correct, then the simplest thing to do would be to configure those options via a serial port. Almost all PICs these days have a built in USART, so implementing a serial port is dead easy. If you're dead set agains good old RS-232, throw a FTDI or Prolific serial to USB converter chip in to your design as well. Or, if you're really committed to this project, go with a PIC with built in USB and write your own drivers.

Now, for software on the PC side, there's always the Visual Basic route (*barf*). I'm partial to a program called Runtime Revolution. It makes writing and maintaining software a snap, and it produces binaries that can work on any platform. But I'm not going to wear off the surface of my keyboard any more until I know better what you're trying to do :)
 
We are using a 16F chip right now with 8 bit processing and EEPROM. We had planned to use the EEPROM for variable changes. It was not our intent to give full reprogram ability, but rather offer variable changes through locked down software. I will admit that I am missing some knowledge at this point. This will not ultimately be my job anyway. I was just hoping that one could get to a point of programming the EEPROM without additional hardware by creating a specific USB driver to support it. We would use power from the USB programming device to power the chip for variable changes.



The answer the questions above, yes, we are already programming the PICs through a hardware system but looking to alter certain variables of the chip direct from a USB interface. I am sure it is possible and I think the chips of today support it rather easily but I am trying to get up to speed as to how it is typically done.
 
What Keelan said...

This is a stand alone device - correct? Not a USB device that remains connected to a PC

If so ten I think Keelan is on the right track - you want to burn the firmware at your place while building your product. That way you can lock down your IP and store configuration info in a way that is easily updateable.

Does the hardware have any UI? A button or two you can press/hold to place the device in 'programming' mode? If so then a simple bit of config software on the PC/PDA can talk serial to the PICs onboard USART (or over a USB-Serial cable). It can send down the new config and the PIC can then store in whatever EEPROM you have. If all you need is a features 1 - N, on or off then the on chip EEPROM should be plenty to store the bitmask.

If you're worried about people hacking the features you can burn a GUID or half of a key pair in the EEPROM at manufacture and use it as a key to unlock an encrypted/obfuscated bitmask.
That way you can have your customer download your 'generic' programming software and email the user a config string - have them paste it in the app and click a button to download. A system like that will deter/prevent them from sharing the config string with others or using it on multiple devices.

If you have other customizable data - strings, bitmaps, etc., then a larger capacity dedicated EEPROM may be your best bet. The software for configuring and downloading the payload will be a bit more involved but still not too bad.

All in all, this is very basic stuff you're asking about, you might have a look over at sparkfun.com - they cater to the hobbyist and inventor crowd, look around the forums there for a freelance developer/engineer.

It's also the right time of year to find a college kid looking for a summer internship. They could probably knock this out for you as long as you have someone to mentor them who understands and can maintain the project after they're gone.
 
Basic stamps can be expensive if you plan on using a lot of them. The Microchip PICs are nice but you need to add all the components and I/O structure. The BS is nice because much of this is inherent in the design of the chip.
Applications for writing code can be cheap to extremely expensive. If you plan on using this in a business they try to force you to a production license which adds to the cost. Personnal development on PICs and BSs can be cheaper.
If you have never done any programming or do not know you way around a computer I would say forget it. BS programming is a little easier but you are limited on the number of functions available (sometimes is the amount of code as the limit).
Make sure you know what you are getting into. While I encourage anyone to learn programming PICs it can be very frustrating.
 
We are doing some playing with PIC driven devices and are considering writing a bit of software to select certain options or functions and rewrite the PIC via USB cable from either a laptop or PDA. This is new territory for us so wondering if there is a software creator out there that specializes in writing new software like this from scratch? We have access to labview for certain functions but we see this as an opportunity to try something new.
There is a FREE compiler for the family of PIC's. It is called SDCC. It can be used
along with FlashMagic which is also FREE. FlashMagic is a tool that downloads your
software object program onto the PIC. SDCC also supports a lot of other
processors as well. Been using this stuff for years.
 
Easiest Route

I'm still a little foggy on what you have, what you know already and what you are doing. The PICKIT 2 will provide the necessary power to the pic and programming signals. With a 5 pin header (or is it 6) you turn your power off to your unit, plug your little $40 PicKit 2 into the header and away you go. They also sell a $300 In Circuit Serial Debugger but even one Microchip insider says they are no better than a PicKit 2 unless you are doing some high production stuff. He also warned me against buying a newer PicKit 3 because, as I recall, they don't provide power to the Pic during programming. Now, can you afford a 50 cent header ? I think so. If you wanted to provide an extra layer of protection, in case you forget to power off your item, you can just throw in a switch or two. What I would do myself on a short run project is just plug your Pic into a ZIF socket. That way the pic can be removed and reinserted easily for programming changes. If I'm understanding you correctly, you don't need a USB socket on your project. It's dead simple to program a PIC that's already installed. I don't want to get World War Three happening here, but I highly recommend you stay away from any non-Microchip product of any sort because they are seldom available for software upgrades when they put out new product lines and they are as cheap as any of the wannabees out there. I think all of us who have responded would like some clearer idea of what you are doing. Can you please clarify it for us. Your posts are rather vague.
 
BTW... If you are an absolute Newbie, then please say as much. There is no shame in that at all. The PicKit 2 comes with programmer, USB cable, the IDE (software where you write your programs), the PK2 programmer software, a small project board, the 16F628 PIC (I think that's the model #) and a short Getting Started tutorial. At that point, we can meet again where your post best belongs, the Microchip User Forums at Microchip.com. Cheers.
 
... and furthermore....

I agree with the poster above who said that the newer PICs have loads of memory available on them. I have my own company centered on the PIC and neither I nor anyone else I know have ever had the need to add an extra eeprom. If you are worrying about someone just hooking up a programmer to your board and ripping you off for your software, there is a bit you can set in one of the registers that will keep anyone, except perhaps the CIA, from lifting your software.
 
Our product used the 16C 8 bit processors, all but about 16 bytes of the code space was used. The spi eeprom could be written from the pic itself under software control so there wasn't much needed in the PC side software- just a way to command the processor to write the data.

We used melab's basic compiler for the "userspace" code in the chip; ie the arithmetic, control loops, etc and assembly in the interrupt service code was where all the complicated stuff is (btw the product is still being sold after 10 years or so, no major bugs in the firmware have shown up.. ) The first rev of the product used Basic Stamps but they were way too slow, limited and expensive, so we moved on. The melabs basic compiler is pretty good though integrating it with assembly does require a thorough understanding of the runtime characteristics of the processor- bank switching and addressing for code and data.

IIRC- in the isr we had a software uart outputting commands to a PWM controller, another one receiving data from weather sensors, quadrature encoder servicing, switch debouncing, periodic adc sampling, digital input debounce, and timebase computation.

fp emulation code was too big in codespace so we did our own fixed point, thankfully we didn't need much of that, just simple arithmetic.

Nowadays I'd try to move up the food-chain to some of the 68k cpu's, total form factors are not too much bigger and the processors are vastly more capable. You can get away from the proprietary tools as well, which often is a big help.

Greg
 
Last edited:








 
Back
Top