CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

how to config port A for A/D input (16F628A)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sorasit46



Joined: 07 May 2007
Posts: 69

View user's profile Send private message

how to config port A for A/D input (16F628A)
PostPosted: Thu Mar 06, 2008 6:54 am     Reply with quote

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







PostPosted: Thu Mar 06, 2008 8:11 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 06, 2008 8:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 06, 2008 5:49 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group