Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use TSOP 1838 with Receiver Part with PIC Controller ?

Status
Not open for further replies.

asking

Full Member level 5
Joined
Sep 21, 2010
Messages
279
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Activity points
3,377
Hello,

I would like to make Beam Break Counter. Means whenever the beam is breaked it will count its increment value in programmed PIC16F628A Microcontroller. So any idea ? how would i use it ?

According to me:-

I have read about TSOP1838 that during no signal receive its output state is High and when signal is received for short time it will go low. So how to catch if beam is break ? if someone pass throught the IR beam...

Please guide me for this project thanks..

- - - Updated - - -



When it receives Signal from 38.3KHZ Burst Beam i get 8.70HZ signal and when there's no signal it's output is High. How to detec beam break with PIC ? Microcontroller please help...
 

You can use a interrupt on change routine for getting the event. it will help you to solve your issue
 

    V

    Points: 2
    Helpful Answer Positive Rating
Can you give me some more idea how to use it ? does PIC MCU Datasheet have data how to use it ?
 

You can connect the TSOP as shown in the tsop datasheet (Image attached) and PORTB interrupt on change function can be used to detect the pulse. refer the attachments for more

https://ww1.microchip.com/downloads/en/appnotes/00566b.pdf
TSOP.jpg
 

    V

    Points: 2
    Helpful Answer Positive Rating
But i still don't understand. Whats difference between INT and PORTB (interrupt on change). TSOP1838 output would be 8.7HZ so every 114 miliseconds there would be change ? right ? so interrupt would be generated. But i want interrupt when there's no Frequency i mean to say TSOP1838 output is straight line when some object breaks line of TSOP1838 for short period. I want to generate interrupt when some object break's beam. M confused...can you provide me little coding in C or MikroC how to implement Interrupt...as i am new to interrupts...
 

Code:
unsigned short temp = 0;  // variable to use as PORTB dump
void interrupt(void){

    if (INTCON.RBIF == 1)
       {
        PORTA = ~PORTA;         // invert PORTD
        temp = PORTB;           //Read PORTB to clear mismatch
        INTCON.RBIF = 0;        // Clear interrupt flag
       }//end intcon.RBIF if
 }//end ISR


void main() {

  OPTION_REG = 0x80;     // set internal PORTB pulls ON
    TRISA = 0;           // PORTD as output
    PORTA = 0;        // Set PORTD to 0101 0101 pattern
    TRISB = 0xFF;        // PORTB as input

    // temp = PORTB;       // read PORTB not actually required at this point
    INTCON.RBIF = 0;     // Clear interrupt flag prior to enable
    INTCON.RBIE = 1;     // enable on change interrupts
    INTCON.GIE  = 1;     // enable Global interrupts

do{

   Delay_ms(10); // just an empty loop
                 // to keep code running
   }while(1);
}// main

I have made this code for PIC16F628A, but here it works like just push to on switch. when signal comes it gets latched and when it goes down it gets down again its off. Graph of both signal (input & output) remains same. i want to count any variable when the beam is broken... any idea ? Plz help
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top