threewheeler7 wrote: > i was told by a microchip rep that i should get something from the > PIC18Fxx31 > family to have a one-chip solution to control 4 brushed dc motors > with PWM. > so i ordered myself some PIC18F2331's to get started. While it's good to get the advice of someone that knows more about these parts then you do, you are still ultimately responsible for your design and no amount of external advice is a substitute for your own brain. Ordering parts just because someone said they would work for you application is silly. You should have taken the advice as a pointer, then looked in the datasheet to see if it indeed would address your issue. > i have done PWM > with 16f chips via the CCP module. but crap, the PIC18Fxx31's use 22 > control > registers!? So? Once you read the datasheet and understand what each bit in those registers do, you will see that you won't need most of the features for your application. The vast majority of these 22 registers (taking your word that's really the number, sounds high) will be set up once at module initialization and then left alone. This is really not a big deal, assuming of course you have read the manual section on the motor control PWM module. Note that this module only has 3 independent PWM outputs. It was intended for 3 phase AC motor control or up to 3 phase switching power supplies. The 6 outputs are complimentary phases of each of the 3 PWMs. Since you are only driving brushed DC motors, you don't need the fancy complimentary PWM outputs. However, you will need to use at least one of the normal PWM (CCP module) outputs to drive 4 motors independently. You wont have exactly the same code driving all the motors, which isn't much harder but does present additional opportunity for screwing up. Have you looked at the 30F parts? I think some of them have more native PWM outputs of the same type. Do you need to drive the motors in both directions, or just variable power in a single direction? The latter will be considerably easier both in firmware and in hardware. > i am ready for a whole bunch of you to start getting mad > at me, > but i am writing this in ASM. Why do you think that is bad? It sounds like your application is a bunch of low level bit twiddling and management of the hardware, which will be easier in assembler. > besides this will be pretty small > code at first any way. The actual PWM management won't be that big, but if you need bi-directional drive you will have to wake up to write the code. The larger part of the code will be deciding the desired PWM value given inputs and a PID controller or whatever. This is certainly doable, but not what I would classify as "trivial" or "pretty small". > Besides for "just read"ing the datasheet, what > suggestions do you have for me to learn to use the pcPWM on these > beasts? It sounds like you haven't even read the datasheet yet. Until you do that, it's pointless to suggest other things. Once you've read the manual you can come back and as about specific things that didn't make sense. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist