Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16F628A A/D input question

Status
Not open for further replies.

rshprd

New Member
All,

OK, stupid newbie question.

I am trying to get/assign a variable value by reading one of the inputs on the 16F628A and not having much success. All of the A/D example I can find reference the 16F877 and as such, some of the syntax in PIC Basic Pro is not supported on the 16F628A.

Basically, all I want to do is have for example, a a variable voltage source connected to PORTA.0, take samples of that port and assign a value to a variable based on those samples.

When I use routine examples based on the 16F677, I get a variety of errors on compiling, most related to ADCON0.

These same routines do work on the 16F877, but I don't want or need that chip as to the best I can tell, the 16F628A does support analog inputs on RA/AN 0-3.

I'm not sure if I'm initializing the port wrong or what! :confused:

Any Help would be appreciated!

Assembly or basic examples are fine, I can do either.

Thanks,
Bob
 
rshprd said:
... to the best I can tell, the 16F628A does support analog inputs on RA/AN 0-3.

Analog Yes, ADC no. The analog inputs of 16F628A are for voltage comparator function only.
 
As eblc1388 says, there are NO analogue inputs on the 16F628, however it does have comparator inputs, and a (fairly basic) analogue output - you can configure these, and with a little programming, make low resolution analogue inputs.

It would be far better though, to simply use an 18 pin PIC that does have analogue inputs, such as the 16F819 or 16F88.
 
Ok, that explains it! Figures I was misinterpreting the specifications. I use Oshonsoft simulator (and recently the compiler), so when the A ports kept coming up with analog inputs, I was confused. The datasheet was a bit confusing as well. Still in hindsight I should have known better as the code did work on the 16F677.

Thanks Much for the fast feedback guys!

Bob
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top