PDA

View Full Version : A/D's in 16F628A



MARAD75
- 19th November 2006, 21:07
Hi, I plan to use a 16F628A and have both A/D's on to load B0 and B1 respectively. I only need 8 bit conversions for 0-255 values. Can anyone help me with sample code to set these up? Also, how do I change the reference voltage swings to allow for, say, 0 to 3.5 V to produce 0 to 255 values internally?
I also want to try to multiplex the PWM output to 4 inputs to a couple of H bridges to control two motors in both directions. (will use a 74LS08 quad AND gate using other outputs from PIC to bring one side of each gate high to enable that channel. The PWM out will drive all four AND gates.)
I'm pretty sure how to use the PWM module, but need to know if I can change the duty cycle fast enough to operate all four AND gates properly and independantly.
Any and all suggestions and sample code will be welcomed!
Thanks a bunch!
Ron

mister_e
- 19th November 2006, 23:18
uneless you want to waste your time, use another PIC as there's no ADCs in 16F628 but only analog comparator.

And there's only 1 CCP module... 1 PWM output

There's few PIC dedicated to Motor Control. Those have built-in ECCP. AND they provide some nice dead-time feature

The smaller i know... 16F690 AND it have ADCs too. Big deal :D

MARAD75
- 20th November 2006, 11:48
Guess I was suffering from brain shutdown or something. I just read this morning that the 628 has comparitor modules AND NOT A/D - Dahhhh!!!
I'll look at the 690 Thanks again.
Ron