View previous topic :: View next topic |
Author |
Message |
sorasit46
Joined: 07 May 2007 Posts: 69
|
how to config port A for A/D input (16F628A) |
Posted: Thu Mar 06, 2008 6:54 am |
|
|
Please help! 16F628A.
How to config port A for A/D. I try 2 ways.
1. setup_port_a(ALL_ANALOG); compile error .
2. setup_adc_ports(RA0_ANALOG); compile error
Thanks
regards |
|
|
Ttelmah Guest
|
|
Posted: Thu Mar 06, 2008 8:11 am |
|
|
Look at data sheet.
Look at peripherals listed.
Any mention of an A-D converter?.
Simple answer is that the 16F628A, does not have an ADC module present. The only 'analog' inputs, are the comparator inputs, which are controlled by the 'setup_comparators' function.
If you want an analog input, you need to choose a different chip...
Best Wishes |
|
|
kolio
Joined: 06 Feb 2008 Posts: 26
|
|
Posted: Thu Mar 06, 2008 8:14 am |
|
|
Read the datasheet and you'll find out that unfortunately the nice little 628A(my favorite PIC mcu) doesn't have A/D converter hardware.
Don't give up - there are two options:
1.If you need just few discretes then use the comparator module + internal Vref module and this can give you up to 16 analogue levels.
This is only a 4-bit A/D converter, not 8- or 10-bit after all!
2.Use PIC16F819 - it is in the same footprint and has A/D module
wish you luck. Cheaper replacement is 8-pin PIC12F675 with A/D. |
|
|
sorasit46
Joined: 07 May 2007 Posts: 69
|
|
Posted: Thu Mar 06, 2008 5:49 pm |
|
|
kolio wrote: | Read the datasheet and you'll find out that unfortunately the nice little 628A(my favorite PIC mcu) doesn't have A/D converter hardware.
Don't give up - there are two options:
1.If you need just few discretes then use the comparator module + internal Vref module and this can give you up to 16 analogue levels.
This is only a 4-bit A/D converter, not 8- or 10-bit after all!
2.Use PIC16F819 - it is in the same footprint and has A/D module
wish you luck. Cheaper replacement is 8-pin PIC12F675 with A/D. |
Thanks.
Now by your answer I can solve a problem by PIC16F819. At the right moment, in original I use 12F675. But program memory not enough (1024). Then change to 16F628-629A.
Regards |
|
|
|