PDA

View Full Version : IR detector problem



Mohamed Refky
03-24-2010, 01:14 AM
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
·

Franklin
03-24-2010, 04:10 AM
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 Refky
03-26-2010, 03:51 AM
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,[ADdata\16]
··· dispVal = ADdata ** weighFactor
RETURN

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

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

Post Edited (Mohamed Refky) : 3/25/2010 8:57:40 PM GMT

Mohamed Refky
03-28-2010, 04:11 AM
Hello Stephen

Are·you still trying to figure out the problem.

Franklin
03-29-2010, 12:20 AM
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 Refky
03-29-2010, 01:51 AM
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.



·

Franklin
03-29-2010, 04:41 AM
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 (http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/remote/List/0/SortField/4/ProductID/322/Default.aspx) It just might help.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen