View previous topic :: View next topic |
Author |
Message |
enyman
Joined: 09 Feb 2012 Posts: 8
|
16f1827 capacitive |
Posted: Thu Feb 16, 2012 2:21 am |
|
|
Hi, I want to use on pic 16f1827 capacitive input for some buttons and i don't know how ! Can you help me please with how can I configure pic for these inputs and how can I read these inputs ? I am using PCHD Compiler 4.126
Thank You |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
Re: 16f1827 capacitive |
Posted: Thu Feb 16, 2012 3:45 am |
|
|
enyman wrote: | Hi, I want to use on pic 16f1827 capacitive input for some buttons and i don't know how ! Can you help me please with how can I configure pic for these inputs and how can I read these inputs ? |
Did you read the datasheet that covers the CTMU?
Did you download examples from microchip's website?
Did you look at the schematics for their demonstration kits?
Did you google for anything on the topic?
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
enyman
Joined: 09 Feb 2012 Posts: 8
|
Re: 16f1827 capacitive |
Posted: Thu Feb 16, 2012 9:16 am |
|
|
bkamen wrote: | enyman wrote: | Hi, I want to use on pic 16f1827 capacitive input for some buttons and i don't know how ! Can you help me please with how can I configure pic for these inputs and how can I read these inputs ? |
Did you read the datasheet that covers the CTMU?
Did you download examples from microchip's website?
Did you look at the schematics for their demonstration kits?
Did you google for anything on the topic?
-Ben |
Yes I did, all instructions are in assembly, and I don't know assembly. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Thu Feb 16, 2012 10:21 am |
|
|
More to the point, look at #use_touchpad in the manual.
Best Wishes |
|
|
enyman
Joined: 09 Feb 2012 Posts: 8
|
|
Posted: Thu Feb 16, 2012 12:36 pm |
|
|
thank you very very much , i have some more questions but i'll try to get an answer by myself.
thanks again |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
Re: 16f1827 capacitive |
Posted: Thu Feb 16, 2012 12:41 pm |
|
|
enyman wrote: | bkamen wrote: | Did you download examples from microchip's website?
Did you look at the schematics for their demonstration kits?
|
Yes I did, all instructions are in assembly, and I don't know assembly. |
No. You didn't.
Microchip has 7 examples most if not all (I didn't look at them ALL) are written in 'C'.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
enyman
Joined: 09 Feb 2012 Posts: 8
|
Re: 16f1827 capacitive |
Posted: Thu Feb 16, 2012 2:16 pm |
|
|
bkamen wrote: | enyman wrote: | bkamen wrote: | Did you download examples from microchip's website?
Did you look at the schematics for their demonstration kits?
|
Yes I did, all instructions are in assembly, and I don't know assembly. |
No. You didn't.
Microchip has 7 examples most if not all (I didn't look at them ALL) are written in 'C'.
-Ben |
Yes, i read those examples. I understood the principle but i don't know the syntax of functions in CCS C.
I am new in pic's world. Until now i played on an Arduino with some leds for school. I've made a led cube 3x3x3.Arduino is much more simple than pic.
I have made a little program and it's not working :
Code: |
#include <main.h>
#use touchpad(threshold=5,pin_a1='J')
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_2|RTCC_8_BIT);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_1); //524 ms overflow
setup_timer_4(T4_DISABLED,0,1);
setup_timer_6(T6_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
setup_oscillator(OSC_500KHZ|OSC_TIMER1|OSC_PLL_OFF,0);
char c;
enable_interrupts(GLOBAL);
while(TRUE)
{
c='a';
if ( TOUCHPAD_HIT() )
c = TOUCHPAD_GETC();
if(c=='J')
{
output_high(pin_b7);
delay_ms(500);
Output_low(pin_b7);
}
}
}
|
this is the main.h
Code: |
#include <16F1827.h>
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES WDT_SW //No Watch Dog Timer, enabled in Software
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#use delay(int=500000)
|
Can you help me please ? |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Thu Feb 16, 2012 2:20 pm |
|
|
The bottom items are all clearly discussed in the helpfile that comes with PIC-C.
The function calls to things like
enable_interrupts and setup_timer_4 and so on are ALL explained in the help manual.
Did you read through those help file sections yet? (I'm guessing you have not.)
It sounds to me like you don't understand 'C'. I would recommend you take a class or go to the library and read up on the language.
Cheers,
-ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
enyman
Joined: 09 Feb 2012 Posts: 8
|
|
Posted: Thu Feb 16, 2012 2:53 pm |
|
|
bkamen wrote: | The bottom items are all clearly discussed in the helpfile that comes with PIC-C.
The function calls to things like
enable_interrupts and setup_timer_4 and so on are ALL explained in the help manual.
Did you read through those help file sections yet? (I'm guessing you have not.)
It sounds to me like you don't understand 'C'. I would recommend you take a class or go to the library and read up on the language.
Cheers,
-ben |
look , i'm just asking some help , the deadline for my project is arriving, i don't have time to read books of hundreds of pages . my question is simple "how can i set a pin for capacitive input" .
You can help me or not ? Can you tell me what's wrong or not ? It's simple. |
|
|
|