Pozdrav!
trebao bi spojit IR senzor na ulaz pica, i na osnovu primljenog signala aktivirat željeni pin.
Jel možda imao neko već posla sa sličnim problemima da mi može pomoć? inače, koristim pic basic pro, znam da bi zapravo samo trebalo definirat par IF petlji al bio bih zahvalan ako mi neko ko je stručiji od mene može pomoć.
Hvala unaprijed!
PIC 16F628 i IR
Moderators: pedja089, stojke369, [eDo], trax
Re: PIC 16F628 i IR
EXPERIMENTING WITH THE PICBASIC PRO COMPILER
- Attachments
-
- _IR.ZIP
- (5.87 KiB) Downloaded 382 times
Re: PIC 16F628 i IR
Probaj ovo radi odlicno ..
Re: PIC 16F628 i IR
za sto sluzi toj posledniot fajl?Toj sony?Dali moze so PIC16Fxxx da raboti?
Re: PIC 16F628 i IR
Lepi primeri,pogotovo ovaj sa INCLUDE FILE.
Re: PIC 16F628 i IR
fala.. sad ću se preko vikenda zabavljat s tim da vidim hoće li šta proradit.
pozdrav
pozdrav
Re: PIC 16F628 i IR
Neznam sta mislis koristiti kao predajnik za taj IR?! Ako namjeravas koristiti standardni daljinski upravljac, onda se pripremi za zej*ciju sa vremenima. Potrazi RC5 standard i informisi se o njemu. On mi je bio najjednostavniji za koristenje ali ga ne koriste svi! Mislim da sam ja koristion neki Philipsov daljinski od linije! Ako budes isao na tu verziju, javi, ja mislim da imam jos uvijek negdje kod (mislim da je u micro C-u) za ovaj projekat. Koliko se sjecam upravljao sam nekim DC motoricem (iz CD drajva) sa ovim daljinskim koristeci PWM.
Re: PIC 16F628 i IR
išao sam preko rc5 protokola, evo koda pa možda nekom pomogne ko bude radio sličnu stvar. hvala svima na odgovorima
DEFINE OSC 20
DEFINE LOADER_USED 1
DEFINE HSER_BAUD 2400
Y VAR WORD ' Holds 12-bit RC5 code
Loop VAR BYTE ' Loop variable
PIN VAR PORTB.0 ' RB.0 input pin reading data
TRISB.0=1 ' Set RB.0 direction to input
OPTION_REG.7 = 0 ' Internal pull-ups = on
Home:
IF PIN = 1 THEN Home ' Wait for low going pulse
PAUSEUS 100 ' Short delay
IF PIN = 1 THEN Home ' Was it noise?
PAUSEUS 1350 ' Pause to read 2nd half of 1st bit period
Y.0[13] = PIN ' Record 1st synch period bit value
FOR Loop = 12 to 0 STEP - 1 ' 13 pulses MSB to LSB
Y.0[Loop] = PIN ' Y.Bit.Loop = data bit
PAUSEUS 1800 ' Wait 1.8mS to read next RC5 bit
NEXT Loop ' in middle of 2nd bit period
IF Y.LowByte = $FF THEN Home ' Was it noise?
Y = ~Y & $003F ' Mask upper 10-bits to return 6-bit data
' in lower 6-bits of word result
HSEROUT ["Key Pressed = ",DEC Y,13,10]
Y=0 ' Clear key codes
PAUSE 250 ' Used for testing only
GOTO Home ' Return Home
DEFINE OSC 20
DEFINE LOADER_USED 1
DEFINE HSER_BAUD 2400
Y VAR WORD ' Holds 12-bit RC5 code
Loop VAR BYTE ' Loop variable
PIN VAR PORTB.0 ' RB.0 input pin reading data
TRISB.0=1 ' Set RB.0 direction to input
OPTION_REG.7 = 0 ' Internal pull-ups = on
Home:
IF PIN = 1 THEN Home ' Wait for low going pulse
PAUSEUS 100 ' Short delay
IF PIN = 1 THEN Home ' Was it noise?
PAUSEUS 1350 ' Pause to read 2nd half of 1st bit period
Y.0[13] = PIN ' Record 1st synch period bit value
FOR Loop = 12 to 0 STEP - 1 ' 13 pulses MSB to LSB
Y.0[Loop] = PIN ' Y.Bit.Loop = data bit
PAUSEUS 1800 ' Wait 1.8mS to read next RC5 bit
NEXT Loop ' in middle of 2nd bit period
IF Y.LowByte = $FF THEN Home ' Was it noise?
Y = ~Y & $003F ' Mask upper 10-bits to return 6-bit data
' in lower 6-bits of word result
HSEROUT ["Key Pressed = ",DEC Y,13,10]
Y=0 ' Clear key codes
PAUSE 250 ' Used for testing only
GOTO Home ' Return Home