Thanks again for everyone help. I think I got many of you confused. I am sorry about that. What I meant was I want to drive two L298 ICs, so that's 4 full-bridges in total. Mike Young wrote: =93I missed the preceding discussion, so don't know what was suggested. You can drive each half using just one PWM per bridge =85=94 James: Yes, but I am using TWO L298 ICs and each IC has two full-bridges. So the total is =934 half=94, which means I will need 4 PWM channels, right? Julio Jumpa wrote: =93you set an interruption every 8us=85=94 James: This would work, but the PIC will have to spend a lot of time servicing the interrupts. It might not have enough time to update the LCD, read encoder, do some math, serial comm, etc. I am thinking of a dedicated PIC just to drive the two L298 ICs=85 --- Mike Young wrote: > From: "Gerhard Fiedler" >=20 >=20 > > James James wrote: > > > >> Thank you everyone for your reply. I just want > to clarify that the L298 > >> is a DUAL Full-Bridge driver. Driving 2 of them > means I need 4 PWM > >> channels. >=20 > I missed the preceding discussion, so don't know > what was suggested. You can=20 > drive each half using just one PWM per bridge. > Modulate the enable line with=20 > PWM, while holding steady levels on the two In pins. > The In pins select=20 > direction, while Enable modulates speed. That's two > digital output lines per=20 > bridge, plus one PWM line. >=20 > I find it odd that the Fig. 6 truth table is set up > that way. Enable would=20 > be more sensibly useful as a current sense limiter, > except modulating the In=20 > lines would cause braking rather than free-wheel > coasting during the off=20 > periods. Ick. >=20 > > > > I'm not sure, and please excuse me if I'm wrong, > but I don't think you > > understood the suggestions about how to reduce the > number of PWM channels > > required. > > > > The pairs of inputs for each channel are not > driven independently. In > > normal PWM operation, one is the inverse of the > other. Look at figure 6 in > > > http://www.st.com/stonline/products/literature/ds/1773.pdf, > for example.=20 > > It > > is easier to provide this type of encoding with > hard-wired logic (or a > > CPLD) than with the PIC's CCP modules. It would > have one PWM input, an > > enable and possibly a break input, and two outputs > for the driver inputs, > > and in between a few gates. >=20 > I wouldn't bother putting gates in there for that. > You still need a third=20 > state for braking, so it needs a second digital line > for full control=20 > anyway. >=20 > > To me, it seems that providing the required > signals using the PIC's CCP > > modules is not exactly easy: they are designed to > set their outputs all > > high at the same time. (The, or maybe some, ECCP > modules have a polarity > > selection, but not the CCP modules.) >=20 > ECCP doesn't add much for Fig. 6 control. > Full-bridge mode can drive the=20 > L298 In lines for direction control, but you would > need an OR or XOR gate to=20 > modulate the B-D lines on the Enable pin. The only > real gain is using the=20 > auto-shutdown comparators as a current limiter. > Alas, I don't believe any of=20 > any mid-range or 18F come with dual ECCPs, at most > one each of the enhanced=20 > and regular. >=20 > To conclude, I think all you need is two > independent, plain, ordinary CCPs.=20 > Each PWM line modulates the Enable line on one > channel for speed control.=20 > You'll control the In lines directly for direction > and braking. >=20 > --=20 > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist >=20 =09 =09 __________________________________=20 Yahoo! Mail - PC Magazine Editors' Choice 2005=20 http://mail.yahoo.com --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist