# Which PIC to use :O)

Status
Not open for further replies.

#### James77

##### New Member
Hi all,

I am new to the forum... (I can sense the groaning and cringing from here.)

Some years back I briefly played around with PIC 16F84A's, which is the extent of my knowledge.

I am (re)learning all the basics in order to eventually build myself some single channel low voltage (12v) halogen, hardware based PWM dimming modules.

If I can get my head around everything I would like to include CAN-bus network control of the device / module.

Would someone please suggest which PIC would be best suited for the job.

Specs:

Used to control a single 12v Halogen dichroic light (found in the ceiling of most modern houses) I believe most are either 20W or 50W's these days.

I'd prefer to use on board hardware-based PWM

CAN-bus connectivity (on board or interfaced via USART. On board preferred for ease of use.) Each module/light uniquely addressable within the network, etc.

The control of said lights/modules would come from a PC and/or a wall plate (also PIC based.)

I have read various different spec sheets for PIC's however I don't want to buy a Ferrari when a middle of the range processor will do the job just as well. If I like what I create I will build 40 or 50 of these to occupy the ceiling space of my house.

Cost is not a major factor, flexibility and future expansion is.

Any and all help is greatly appreciated.

James

#### blueroomelectronics

##### Well-Known Member
I'd recommend the 18F series and give Microchips MAP selector a try. UART, PWM and CAN can be selected and it'll even let you see side by side features.

#### 3v0

##### Coop Build Coordinator
Forum Supporter
I have not done CAN.

In general I like the 18F family. Free C compiler and I am told it is easier to program in assembly. There are versions with CAN bus support and I recall Microchip has a ECAN stack you can download. The PIC18F2585 is a 28 pin chip with CAN support.

Chips are maybe $3 to$6. You did not fill in your location on the CP. If you are in the US Newark has the best prices on PICS.

#### atferrari

##### Well-Known Member
18f4585

I used the 18F4585 and tested all possible ways of CAN. They all worked in the first try.

Just follow exactly what the manual says to configurate every register and it will work.

Against all reccomendations I did set up a network with three nodes of mine instead of hooking one to a working network. It also worked with little difficulty.

Just one caveat: the manual describes wrongly the way to access the CAN-related registers through the "window" specific for that.

I had no time for posting about but could it in the future. Traveling as much as I do, leaves little time for all this.

Buena suerte.

PD: do not forget to include the transceivers, otherwise it will be not complete. And start your tests in "loopback" mode.

I work in Assembler. I have the feeling that it helps to understand the whole thing, but that is me.

Last edited:

#### pcbheaven.com

##### New Member
16f88 is very nice for me

#### 3v0

##### Coop Build Coordinator
Forum Supporter
The 18F4585 is the 40 pin version and the 18F2585 is the 28 pin version of the same chip. They share a commond datasheet.

@atferrari
I am glad it went well. I plan to give it a try using C this summer.

#### atferrari

##### Well-Known Member
In my case

To the original poster:

If you have the will to check the instruction sets for the 16F and 18F family you will easily realize that several bad things (for the 16F) were solved. I doubt I would use any of them again. In fact I ported already ALL my macros and canned routines to the 18F.

I started with the 16C57, then the 16F84A so I can say that things were really improving. Digression is over.

@atferrari
I am glad it went well. I plan to give it a try using C this summer.
Yes, I am glad too!!. I decided to be strict in my progress and forget anxiety. It worked.

I still resist the idea of learning C because I feel quite well knowing what is actually going with the innards of the chip. (Please do not take this as an attempt to start another stupid war. I never participate!!!).

Right now, in the same disciplined way I started to test the Power control PWM section of the 18F4431 with good success. Step by step I am saving time at the end.

I expect some two weeks testing a pair of ideas I have and then I will see what could I do with the board that collected so many answers from another post of mine.

Be well.

Last edited:

#### Russ Hensel

##### New Member
There are many who think that asm is the way to go so you will understand the chip. You do not hear that much for PCs. I think that a high level lang. is the way to go:

Use C for PIC Programming - Open Circuits!

Status
Not open for further replies.