EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Replies / Thanks a lot for your

Thanks a lot for your

|

Microcontroller › AVR › How to make PB2 & PB3 pin high in atmega8 › Thanks a lot for your

January 15, 2013 at 4:33 am #8959
nikita
Participant

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;
    }
}

RSS Recent Posts

  • How to power up two stereo audio amplifiers from a single source of power supply August 13, 2022
  • WXmeteo in APRS at 144.8MHz project schematic question August 13, 2022
  • uc3843 Buck-boost August 13, 2022
  • Add a low power indicator LED August 13, 2022
  • ESP32/Arduino OTA problems August 13, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools