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

Level sensor with pic12F1822

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



Joined: 25 Jun 2012
Posts: 1

View user's profile Send private message

Level sensor with pic12F1822
PostPosted: Tue Jun 26, 2012 10:11 am     Reply with quote

Hi, I must to do a level sensor for a bottle.
I would like to use the mtouch system.
For first thing, I write this program below: it is for a simple keypad. When the water in the bottle reaches the sensor, the led switch on for 100ms and after switch off.

Now, I need that when the water reach the level of my sensor, the output must to stay on and it must to switch off only when the level of water drops under the sensor. Is possible to do it with ccs library?
I have the PCWHD compiler 4.120 version.
Best regards,
pietro
Code:

#include "12F1822.H"
#use fast_io(A)
 
#fuses INTRC_IO,MCLR,NOWDT,NOPROTECT,PUT,BROWNOUT
#use delay(clock=8000000)
#USE TOUCHPAD (THRESHOLD=5, PIN_A2='5')

#define CY_OFF   output_high(PIN_A4)
#define CY_ON  output_low(PIN_A4)
 
void main(void)
{
unsigned int8 c=0;
//port_a_pullups (0xFF);ATTENZIONE! se si mette il pullup sul pin del touch non funziona piĆ¹!
set_tris_a(0b00000100);//RA2 input
TOUCHPAD_STATE(1);           
enable_interrupts(GLOBAL);
delay_ms(500);

for(;;)
    {
    while(TOUCHPAD_HIT())
         {
         if(touchpad_getc()=='5')
              CY_ON;
         delay_ms(100);
         }
              CY_OFF;
    }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 26, 2012 2:16 pm     Reply with quote

I think you are asking if the CCS touchpad library can do more than just
detect a keypress event. You want to know if it can detect keydown (or
hold), and key release events.
For example, AN1202 describes "continuous touch" detection:
http://ww1.microchip.com/downloads/en/AppNotes/01202A.pdf

Based on the description in the CCS manual, the CCS library only
supports a keypress event. You would have to write your own driver
(or translate Microchip driver code) to get your desired featues.
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