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 / Help me

Help me

|

Microcontroller › PIC › Help me

  • This topic has 5 replies, 2 voices, and was last updated 13 years, 2 months ago by AJISH ALFRED.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • July 13, 2013 at 5:09 pm #2537
    Hung
    Participant

    Hi there.

     I want to design the project IR  .

    That is mean inftrared data transmisstion with the PIC microcontrller.

     so i saw some projects  and i saw the code, but i dont understand 

     

    the  value of clock . i mean how many. the value of Crystal . 3Mhz, 4Mhz….so on. please help me.

     

     the code:

    #include<p18f452.h>
    #pragma config OSC=HSPLL, WDT=OFF,BOR=OFF,PWRT=ON
    voidputch(char byte)
    {
    while (!PIR1bits.TXIF);
    TXREG = byte;
    }
    chargetch(void)
    {
    while (!PIR1bits.RCIF);
    return RCREG;
    }
    voidwait800us(void)
    {
    int x = 610;
    while(x–);
    }
    voidmain(void)
    {
    //initializevariables
    charinput, whichBit,temp, total;
    //initializeserial registers
    TXSTAbits.TXEN = 1;
    RCSTAbits.SPEN = 1;
    RCSTAbits.CREN = 1;
    SPBRG = 0x40;
    //Setup PORTB
    INTCON2bits.RBPU= 0;
    TRISB = 0x0F;
    PORTB = 0;
    //Setup Timer2
    T2CON = 0x79; //PRE= 4 POST= 16
    PR2 = 187;
    putch(‘R’);
    putch(‘x’);
    putch(0x0D);
    putch(0x0A);
    while(1)
    {
    while(!PORTBbits.RB0);
    T2CONbits.TMR2ON= 1;
    whichBit= 0;
    total= 0;
    while(whichBit< 8)
    {
    while(!PIR1bits.TMR2IF);
    PR2 = 125;
    PIR1bits.TMR2IF= 0;
    if(PORTBbits.RB0== 0)
    {
    temp= 1 << whichBit;
    total += temp;
    }
    whichBit++;
    }
    putch(total);
    T2CONbits.TMR2ON= 0;
    PR2 = 187;
    }
    }
    July 14, 2013 at 5:07 pm #10143
    AJISH ALFRED
    Participant

    Hi Hung,

    The code is written for a particular hardware. Unless you post the circuit diagram or block diagram it would be difficult for some one to help you with it.

    July 15, 2013 at 4:12 pm #10147
    Hung
    Participant

     

    this is circuit. please help me. i simulated in the proteus but it did not work. so i think that i dont know  exactly the the  value of clock . 

     

    please answer me as soon as possible.

     

     

     

     

    wysiwyg_imageupload:9424:

    July 16, 2013 at 3:31 am #10148
    AJISH ALFRED
    Participant

    Hi Hung,

    You can use 4Mhz crystal. Try to do real hardware other than wasting your time in a simulation software, especially when you are doing wireless data transmission circuits.

    July 16, 2013 at 4:53 am #10152
    Hung
    Participant

    Thank you so much. thanks for your help. 

    July 18, 2013 at 7:11 am #10162
    AJISH ALFRED
    Participant

    You are welcome Hung. Please feel free to post your further queries.

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

RSS feed: Recent Posts Recent Posts

  • Will this solenoid actuator work as intended? September 13, 2026
  • NE602/SA602 Bias and Buffer circuit September 13, 2026
  • Rotary encoder with push function September 12, 2026
  • How much does generator frequency stability matter for sensitive electrical equipment? September 12, 2026
  • differential line loss question September 11, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 Arrowfly 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 Arrowfly
Privacy Policy | Advertising

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