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 CCS Technical Support

PROGRAMMING PIC16F877 TO FUNCTION AS ADC

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



Joined: 19 Jun 2006
Posts: 2

View user's profile Send private message

PROGRAMMING PIC16F877 TO FUNCTION AS ADC
PostPosted: Mon Jun 19, 2006 3:59 am     Reply with quote

Hi
I am trying to sample the ac voltage(0-5)v at about 700 points sampling rate per second using the analog channels of pic16f876 can any one help me with the codes for programming it using ccs c compiler and later wants to transfer iton to the pc using rs232 port.
Please provide me with the codes Confused
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Jun 19, 2006 7:11 am     Reply with quote

Your kidding, right? Do your homework for you?

Here are the steps:

1) Read data sheet for the microcontroller in question. Pay close attention to the section on the ADC, serial communication and the timers. VERY IMPORTANT, DO NOT SKIP THIS STEP.

2) Read the CCS manual. Notice how many of the hardware features of the chip you intend to use map nicely with functions supplied with the compiler. VERY IMPORTANT, DO NOT SKIP THIS STEP.

3) Look in the /samples and /drivers directories installed when you installed your legal (it is a legally licensed copy, isn't it?) of the compiler. DON'T SKIP THIS ONE EITHER.

4) Take a clean piece of paper (maybe splurge and a have a whole pad) and draw a block diagram, flow chart for the top level program flow, smaller flow charts for each subroutine or ISR and finally a detailed schematic. But don't jump right in a write code yet. IN FACT, DON'T SKIP ANY STEPS.

5) Now work backwards from your lowest level flowcharts and write code. You will need a small main() to let you test the code. Check that your timer ISR is popping at the right rate by toggling a bit and watching with an oscilloscope. Check that your RS232 code and circuit work by sending and receiving the alphabet, etc.

6) Keep iterating between code, test, revise until each low level block in your flowcharts work, then move up a layer and stitch together the subroutines/ISRs into a complete and finished project.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!


Last edited by rwyoung on Mon Jun 19, 2006 3:40 pm; edited 2 times in total
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Jun 19, 2006 8:12 am     Reply with quote

Good general guidelines, rwyoung. Nice work.

Last edited by treitmey on Mon Jun 19, 2006 3:17 pm; edited 1 time in total
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Jun 19, 2006 12:17 pm     Reply with quote

treitmey wrote:
Good general guidelines, rwyoung. Nice work.
(check spelling of legally)


Whoops. Got those two and one other typo fixed.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Jun 19, 2006 3:05 pm     Reply with quote

Well you might as well fix "licensed" Razz
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Mon Jun 19, 2006 3:41 pm     Reply with quote

Mark wrote:
Well you might as well fix "licensed" Razz

Yep. See any others? Rolling Eyes
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
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