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
  • Advertise
You are here: Home / Topics / touchscreen

touchscreen

|

Microcontroller › 8051 › touchscreen

  • This topic has 2 replies, 2 voices, and was last updated 12 years ago by Boris.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • December 7, 2013 at 11:11 am #2753
    Boris
    Participant

    Hello, could someone help me with sample code for touch screen with TSC2046 touch screen controler. My microcontroller is C8051f022.

    December 9, 2013 at 7:20 am #10707
    AJISH ALFRED
    Participant

    Hi Boris,

    The complexity of the touchscreen interface has been reduced by that touchscreen controller, now the touchscreen can be simply interfaced to the SPI port of the microcontroller. 

    It dosen’t sounds that complex, suggest you to give a try yourself and keep posting, we will help you to finish the project.

    February 12, 2014 at 5:54 pm #11017
    Boris
    Participant

    Hello, I write a part of code for SPI interface but I can’t understant how to read from the TSC2046.

     

    #include “c8051F020.h”
    #include “touchscreen.h”

    /*
    C8051f022

    DCLK P0_0
    CS (hardware to GND)
    DIN P0_1 TSC out controler in
    DOUT P0_2 Controler out TSC in
    IRQ P0_7

    SPI0CN = 0x03; 
    XBR0 = 0x02; 
    XBR2 = 0x40;
    SPI0CKR = 0x3F;
    SPI0CFG = 0x80; // data center on second edge

    WDTCN = 0xDE; 
    WDTCN = 0xAD;
    OSCICN = 0x07; // internal 16MHz

    Mode_send = 0x90; // S A2 A1 A0 mode (12 bit) SER PD1 PD0 0b10010000

    SPI0DAT = Mode_send;

    */

    #define DCLK P0_0
    #define DIN P0_1
    #define DOUT P0_2
    #define IRQ P0_7

    unsigned char mode_send = 0x90;

    void SPI0_init()
    {
    SPI0CFG = 0x80; 
    SPI0CN = 0x03; 
    SPI0CKR = 0x3F;

    }

    void Port_init()
    {
    P0MDOUT = 0x07; // DCLK, DIN, DOUT – push-pull,
    EIE1 = 0x01; // Enable SPI interupt

    }

    void Oscillator_Init ()
    {
    OSCICN = 0x07; // Set the internal oscillator to 16MHz

    }

    void Watchdog_Init ()
    {
    WDTCN = 0xDE; // Disable the Watchdog Timer
    WDTCN = 0xAD;
    }

    void Initialization_device ()
    {

    SPI0_init();
    Port_init();
    Oscillator_Init ();
    Watchdog_Init ();

    }

    void SPI_Write()
    {

    SPI0DAT = mode_send;

    while (SPI0DAT!=0)
    {

    }
    }

    void SPI_Read()
    {

    }

    void SPI_start()
    {

    Initialization_device();
    SPI_Write();
    SPI_Read();

    }
     

     

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Arduino standalone minimal February 16, 2026
  • analog logic of shmidt trigger bjt circuit February 16, 2026
  • Harman Kardon radio module BMW noise February 16, 2026
  • CR2/CR123A Batteries In Projects February 16, 2026
  • Math problem February 15, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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
  • Advertise