PDA

View Full Version : Moving from Arduino to PIC 18F4550



thomasantony
06-03-2010, 08:09 PM
Hello,
I have some experience working with Arduino on a variety of projects. In fact that is the only uC platform that I have worked with. Now I would like to make a USB HID peripherial. Seems to me that the easiest route would be to use an 18F4550 with on-board USB support. AVR-USB/V-USB is there, but for one, it requires a commercial license for commercial use and I don't want to be limited in case someday this goes big :). I know its an offchance .. but then if I switch to PIC, I get to learn a new platform.

So here is the thing. I have no prior experience working on the PIC. So as I need to get started somewhere, I was thinking of using this :

http://www.rhydolabz.com/index.php?main_page=product_info&cPath=67&products_id=280

The company is in my hometown so delivery would be quick. And they say that it doesn't require an external programmer as the chip comes with a bootloader. Another thing to note is that my PC lacks a serial port and I have found Serial-to-USB cables pretty unreliable.

Another thing, the programming itself. As I understand it, there is a free version of the C compiler available now from MicroChip. Though I haven't have had to deal with bitwise operations and such in case of Arduino, I think I can cope.

So, any advice for me? Are there any good alternatives? Would it be cheaper if I bought the chip, a programmer and the other components separately ?

--
Thomas

vikas
06-03-2010, 08:39 PM
Yes it will be cheaper if you bought them separately , more like 1/3 the cost.

If possible try to get a Pic chip with USB bootloader installed so even a programmer is not required ... Just wire up USB and ur all set.

V-USB works fine , but commercially i dont recommend incase you are looking for high throughput ... its USB 1.1 after all. License is cheap dont worry ... I have bought V-USB licenses.

But it depends on application a Atmega8 with just USB hid will cost Rs 60 with everything in low volume while same in Pic18f4550 would be about Rs 360.

So u can make more profits with Atmega8 ;) , since no one is bothered whats inside. End of the day its all about profits , no one cares if you did it using 74xx series inside the box.

thomasantony
06-03-2010, 09:30 PM
Hey,
Thanks for the quick reply :) . Any tips on where I can get the PIC with bootloader? Online shops preferred :D. I also found this cheaper dev board for the 18F4550 chip for around Rs. 600.

http://www.nex-robotics.com/products/microcontrollers-and-development-boards/pic-18f4550-development-board.html

In case of programmer, it seems a USB one (for PIC) will cost me in neighborhood of Rs. 700 or above.
In case of AVR, I will have to either stick to using the Arduino ( with AVR C included in program ) .. or get myself an AVR programmer for some 300 bucks.

I don't want to mess with USB-Serial cables ever again. With the arduino, on my serial boards I was constantly plagued by this "not in sync" error and the cable would occasionally "disconnect" from pc for no reason at all. Damn frustrating!

As for V-USB I guess I can get a Hobby License or something if I choose to go with it. Heck if I get into the stage where I need to make 10000+ units, I wouldn't care about initial costs anyway :D .. and I will hopefully know enough by then to make my own .. hehehe ;).

allbits
06-03-2010, 09:32 PM
4550 is feature rich, and thats why the price. You can also opt for a 2455 or a 2550 if you dont need a 40 pin chip, although the cost difference is not that much. You can get a 2550 from Roni or thomson, @cochin. Last time i bought, it cost me about 300.

If you are serious with PIC, I would strongly recommend ICD3 or a PICkit3.

The Rhydo board you can make at less than 600 on a common PCB. But in case if you dont want to take the pain then go for the board.

check this out::

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en021631
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en536561

Also check out MCHPFS USB firmware users guide.

thomasantony
06-04-2010, 03:23 AM
Hello,
Thanks again for the replies :) . About the PIC with bootloader, can you point me to any sources? Because if I get/make a programmer for the sheer purpose of loading a bootloader, isn't that kind of wasteful ?

--
Thomas

allbits
06-04-2010, 08:15 AM
Loading a bootloader is not all. what if the chip got damaged?


All depends on how much you will work on this. Microchip has all the documentations on how to get your USB working, all you need is to go through them.

http://eegeek.net/content/view/13/32/

The link was something i have bookmarked some time ago. There are some broken links, but they can be retrieved by browsing microchip.com/usb

If you dont plan to work much on PICs, or any other application in the future at all, you need not buy a programmer, you may buy the board from rhydolabz with the bootloader and forget about reading allpication notes. But if thats not the case, it is strongly recommended you go for a programmer.

If you prefer local purchace, and if you budget is less than 3k, go for microcpro, its easily available in cochin, and cost about 2.8k a couple of years ago. It can handle almost all of the 8bit ones. If you have more budget, go for the pickit3 or pickit 2. Pickits are fast, small and cool and pickit3 can handle almost most of the entire microchip product line including the 32 bit ones.

avinash_g
06-04-2010, 09:12 AM
Hi,

You may also want to have a look at this
http://shop.extremeelectronics.co.in/product_info.php?cPath=23&products_id=79

A Full Stand Alone programmer is also available.
http://shop.extremeelectronics.co.in/product_info.php?cPath=21&products_id=78

The board is fully expandable as shown here
http://extremeelectronics.co.in/microchip-pic-tutorials/making-the-lcd-expansion-board-for-pic18f4520/

If you use bootloader and if gets corrupt you are in trouble!

avinash_g
06-04-2010, 09:19 AM
Also we have free tutorials for getting started with PIC18s and more tutorials in pipeline
http://extremeelectronics.co.in/category/microchip-pic-tutorials/

While http://www.rhydolabz.com's Manual Link is Broken !

vikas
06-04-2010, 11:49 AM
U can buy programmer from avinash , bootloaders dont go corrupt just like that :) ... If they did arduino would be a failure.

But i will say again say , cut costs and make profit :) . Use AVR unless you are looking for high throughput's.

Both are very good chips and u will not go wrong with either.

thomasantony
06-04-2010, 02:26 PM
Hey guys :) . Thanks for all your responses. I have pretty much decided to go with the PIC for now. Found this rather affordable dev-board w/ chip. That seems to be the cheapest option if I choose to go with PIC.

http://www.nex-robotics.com/products/microcontrollers-and-development-boards/pic-development-boards/picusb-rp-smart-board.html

I can use it to get some headway into working on the platform. Then once I get some experience and want to do more, I can get a programmer. :)
As for AVR .. I have a bunch of ATMega8s lying around with some Serial arduino boards .. and also a Seeduino 328p USB board. As I understand it, it is possible to do "normal" AVR C programming from the Arduino IDE right? So I guess I can try that too.

--
Thomas

Ulhas
06-04-2010, 03:45 PM
You can use MikroC for PIC for cutting coding time for your USB need
Also use EasyHID.

Refer "Advance PIC microcontroller projects in C" book by Dogan Ibrahim

pratheek
06-04-2010, 07:11 PM
We sell 40 pin Basic PIC Development Boards for Rs. 250 and an optional PIC microcontroller with a serial bootloader for Rs. 140. If you are interested in board contact me at info@probots.co.in or visit www.probots.co.in .

The PIC development board is not listed on our website as of now, but will be listed shortly.

thomasantony
06-04-2010, 07:30 PM
@Ulhas Thanks for the info.

@pratheek Your site looks promising. But I have already ordered the board from the other site ( at considerably higher price ) . I will bookmark it for future use :-)

avinash_g
06-10-2010, 09:49 AM
Vikas Said

U can buy programmer from avinash , bootloaders dont go corrupt just like that ... If they did arduino would be a failure.

May be RI Guys should think before they speak.

See the image below.
http://www.extremeelectronics.co.in/temp/pic.gif
http://www.extremeelectronics.co.in/temp/pic.gif

avinash_g
06-10-2010, 09:54 AM
So you Cannot set other CONFIG values!!! Just stick with the defaults provided or Break the Bootloader.

If you go for a Real Programmer
>You can program any chip purchased from market.
>If you burn out chips you can get new from local stores
>You can easily write any CONFIG value without any fear!! That means you can run lots of code from different sources.

Yesterday without any reason I could figure, My PIC18F4550's USB's VREG stopped functioning. That means PC won't detect it. The Output on PIN18 should be 3.3 but it was NOT.

Just a reflashing from A REAL Programmer and ALL was well!

akshay66
06-10-2010, 10:08 AM
Who said bootloader don't go corrupt like that?????i have 7 P89V51RD2 chips with corrupt bootloaders all because i didn't want to buy a programmer.I have seen many times that while programming a chip through bootloader if you turn the power off or close the software or remove cable the bootloader gets corrupt.I am not sure that it is the reason.

allbits
06-10-2010, 10:20 AM
Boot loaders wont go corrupt if you code protect it. Its as simple as that !! Depends if your chip can 'code protect ' the boot block !! But code protection does not protect you from overvoltage, this, that, earthquakes, and all !!
:D

lolman_returns
06-10-2010, 11:17 AM
May be RI Guys should think before they speak.




!!!!!! Says the most immature and rude guy on Ri, LOL at the irony.

MohitM
06-10-2010, 12:07 PM
Boot loaders wont go corrupt if you code protect it. Its as simple as that !! Depends if your chip can 'code protect ' the boot block !! But code protection does not protect you from overvoltage, this, that, earthquakes, and all !!
:D

I don't know why but I'm not a big fan of bootloaders. Primarily because I would like to code protect my PICs, and having a bootloader means the code can be copied. Also, if you code-protect your PIC, I've found that the PIC starts acting funny, because the code-protection won't let the bootloader write to its memory. I think I found a way to overcome this by code protecting some blocks of program memory and unprotecting others; but still its a hassle. However, if you do not code protect the bootloader usually works fine.

But you do need a programmer, if you are serious about microcontrollers. Preferably one with USB connectivity to the PC and in-circuit programming facility.

avinash_g
06-10-2010, 12:31 PM
!!!!!! Says the most immature and rude guy on Ri, LOL at the ir

Better rude than wrong!

vikas
06-10-2010, 02:41 PM
There will always be cases where thing dont go right. But a majority of Users like millions of arduino users ... bootloaders just do fine.
But then experts would say arduino is for beginners , and on production system use OTP chips what are u doing with bootloaders.