Shop OBEX P1 Docs P2 Docs Learn Events
IR detector problem — Parallax Forums

IR detector problem

Mohamed RefkyMohamed Refky Posts: 47
edited 2010-03-28 21:41 in BASIC Stamp
Hello:

In my weigh scale project·with BS2 and MA7219 to display weight reading,I use IR detector module to receive signal from universal remote.The IR detector works·well but it·slows down the display,what could be the problem. Considering that·this problem was not taking place·before with another kind of detector.

Thank You
·

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-03-23 21:10
    Could be many things. Start by linking to the datasheet for the ir detector. show us how you have things connected and attach your code to a post. From that we will be able to start figuring out where your problem lies.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2010-03-25 20:51
    Attached layout of display board where I put the IR detector.

    Here is a part of the code:

    Get_Pulses:
    ·· remoteCode = 0··················· ' Clear all bits in remoteCode

    · DO
    ··· PAUSE 30
    ··· IF counter < 15 THEN same_reading··· 'about 0.5 sec between reading.

    ··· GOSUB getdata

    same_reading:

    ··· GOSUB Maxdisplay
    ··· GOSUB control
    ··· counter = counter + 1

    ·' Wait for resting state between messages to end.
    ··· RCTIME 8, 1, irPulse
    · LOOP UNTIL irPulse > 1000

    ·· ' Measure start pulse.· If out of range, then retry at Get_Pulses.
    · RCTIME 8, 0, irPulse
    · IF irPulse > 1125 OR irPulse < 675 THEN GOTO Get_Pulses
    · RCTIME 8, 0, irPulse······································ ' Measure pulse
    · IF irPulse > 300 THEN remoteCode.BIT0 = 1······· ' Set (or leave clear) bit-0
    · RCTIME 8, 0, irPulse······································ ' Measure next pulse
    · IF irPulse > 300 THEN remoteCode.BIT1 = 1······· ' Set (or leave clear) bit-1
    · RCTIME 8, 0, irPulse···························· ' etc
    · IF irPulse > 300 THEN remoteCode.BIT2 = 1
    · RCTIME 8, 0, irPulse
    · IF irPulse > 300 THEN remoteCode.BIT3 = 1
    · RCTIME 8, 0, irPulse
    · IF irPulse > 300 THEN remoteCode.BIT4 = 1
    · RCTIME 8, 0, irPulse
    · IF irPulse > 300 THEN remoteCode.BIT5 = 1
    · RCTIME 8, 0, irPulse
    · IF irPulse > 300 THEN remoteCode.BIT6 = 1
    · ' Adjust remoteCode so that keypad keys correspond to the value
    · ' it stores.
    · IF (remoteCode < 10) THEN remoteCode = remoteCode + 1
    · IF (remoteCode = 10) THEN remoteCode = 0
    · .
    · .
    · .
    · .
    · .
    getdata:
    ··· counter = 0······· 'reset counter
    waitRDY:
    ··· IF RDY = 1 THEN waitRDY
    ··· SHIFTIN DATAout,SCLK,MSBPOST,[noparse][[/noparse]ADdata\16]
    ··· dispVal = ADdata ** weighFactor
    RETURN

    Maxdisplay:
    · FOR index = 4 TO 1
    ··· SHIFTOUT DATA_n,CLK2,MSBFIRST,[noparse][[/noparse]index]
    ··· temp = dispVal DIG(index-1)
    ··· IF index <> 4 OR ignore = 1 THEN· skip1
    ··· temp = temp + 128
    skip1:
    ··· SHIFTOUT DATA_n,CLK2,MSBFIRST,[noparse][[/noparse]temp]
    ··· PULSOUT load,5
    · NEXT
    RETURN

    control:
    ··· LOOKDOWN dispVal,<[noparse][[/noparse]400,421,441,461,481,501,521,65535],where
    ··· BRANCH where,[noparse][[/noparse]goof,LED1On,LED2On,LED3On,LED4On,LED5On,LED6On,goof]
    · .
    · .
    · .
    · .
    · return

    Post Edited (Mohamed Refky) : 3/25/2010 8:57:40 PM GMT
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2010-03-27 21:11
    Hello Stephen

    Are·you still trying to figure out the problem.
  • FranklinFranklin Posts: 4,747
    edited 2010-03-28 17:20
    Sorry but I am not. Your diagram made no sense to me. I still do not know what ir system you are using and your code was not complete enough to follow. Try writing a small code sample that reads IR data and displays the results in the debug window to make sure that part works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2010-03-28 18:51
    The normal operation inside the ·do... loop, get data from the load cell then display it and switch on some lamps·according·to·presetting weights.The operation is going well ,so it is not important the code· reading the IR signal now.What make no sense also to me is·just putting the detector in the circuit , display is slow,although it works well with another one I used before·(more than 30 detecor in my applications).Considering that code read signal from both successfully.



    ·
  • FranklinFranklin Posts: 4,747
    edited 2010-03-28 21:41
    There is info here on communicating with IR to the stamp. www.parallax.com/StoreSearchResults/tabid/768/txtSearch/remote/List/0/SortField/4/ProductID/322/Default.aspx It just might help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.