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

CVD mtouch by using 16f877a

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



Joined: 05 Nov 2010
Posts: 1

View user's profile Send private message MSN Messenger

CVD mtouch by using 16f877a
PostPosted: Fri Nov 05, 2010 12:53 pm     Reply with quote

I am trying to make a capacitive push button by using 16f877a. According to the Microchip application note (AN1298), most of the devices which have adc can be used. I used lcd to show the value of adc but the result was randomly jump between 0 to 5v (abnormal).

Here is my coding:
Code:

#include <16F877A.H>
#device adc=10
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, NOPUT, NOLVP
#use delay(clock=4000000)
#include "flex_lcd.c"
#byte adcon0=01F

//============================
void main()
{
   int16 adc_value;
   float volts;
 
   lcd_init();
   output_low(pin_a0);
   delay_us(100);
   set_tris_a(0b11111111);
   setup_adc_ports(AN0_AN1_AN3);
   setup_adc(ADC_CLOCK_DIV_32);

while(true)
 {
   adcon0=0b10001001;
   delay_us(100);
   adcon0=0b10000001;
   delay_us(20);
   adc_value = read_adc();
   volts = (float)(adc_value * 5)/1023.0;   
   printf(lcd_putc, "\f%3.2f", volts);
   delay_ms(50);   
 }
}

Pin AN1 was connected to Vdd.
Pls help....Thx!!!
ran2rg



Joined: 02 Aug 2011
Posts: 6

View user's profile Send private message

did it worked?
PostPosted: Wed Aug 03, 2011 4:05 am     Reply with quote

HI
Did your code work ?
Can you post it if it did ?

I did something similar to yours and it does not work.
This method seems to me as almost impossible, because the SNR between changes are so small relative to noise.
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