IR detector problem
Mohamed Refky
Posts: 47
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
·
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
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
Are·you still trying to figure out the problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen