Forum Replies Created
-
AuthorPosts
-
nikitaParticipant
Thanks a lot for your reply.
For the schematic actually there is no such ckt made because i am working on touch where i made a slider and touch keys on PCB and Resistor and capacitor connection.
I am using PONYPROG for ISP programming for my atmega8 controller.
Code:
int main( void )
{
DDRB = 0xFE; //PB1,2,3 set as output
PORTB = 0xFE; //PB1,2,3 set high/*
Touch Mask
*/#define QTOUCH_STUDIO_MASKS 1
#define NUMBER_OF_PORTS 2#define SNS1 C
#define SNSK1 C#define SNS2 B
#define SNSK2 D#ifdef QTOUCH_STUDIO_MASKS //5key+slider
SNS_array[0][0]= 0x15;
SNS_array[0][1]= 0x00;
SNS_array[1][0]= 0xe1;
SNS_array[1][1]= 0x10;SNSK_array[0][0]= 0x2a;
SNSK_array[0][1]= 0x00;
SNSK_array[1][0]= 0xe1;
SNSK_array[1][1]= 0x10;
#endif
/*
*/
/*disabling all pull ups for touch application*/
SFIOR |= (1u << PUD);/* Configure the Sensors as keys or Keys With Rotor/Sliders in this function */
config_sensors();/* initialise touch sensing */
qt_init_sensing();/* Set the parameters like recalibration threshold, Max_On_Duration etc in this function by the user */
qt_set_parameters( );/* configure timer ISR to fire regularly */
init_timer1_isr();
qt_filter_callback = 0;/* enable interrupts */
__enable_interrupt();/* loop forever */
while(1)
{if( time_to_measure_touch )
{
SFIOR |= (1u << PUD);
read_touch();}
{
get_key(); //Getting the Status of Sensor
}
} //while close} //main closed
static void init_timer1_isr( void )
{
/* set timer compare value (how often timer ISR will fire) */
OCR1A = ( TICKS_PER_MS * qt_measurement_period_msec);/* enable timer ISR */
TIMSK |= (1u << OCIE1A);/* timer prescaler = system clock / 8 */
TCCR1B |= (1u << CS11);/* timer mode = CTC (count up to compare value, then reset) */
TCCR1B |= (1u << WGM12);/* Initialize counter for heartbeat */
hrtbeat=20;
}ISR(TIMER1_COMPA_vect)
{
/* set flag: it’s time to measure touch */
time_to_measure_touch = 1u;/* update the current time */
current_time_ms_touch += qt_measurement_period_msec;
//sprintf(“%u/n/r”,current_time_ms_touch);
hrtbeat–;
if(hrtbeat==0)
{
//PORTC^=(1<<PC6);
hrtbeat=20;
}
} -
AuthorPosts