This is a multi-part message in MIME format. --------------DB5148087B04430EE092D68C Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ns1.ptt.yu id fBK8QLs28527 I solved it - there was a problem with RB0 because he is also a RB0/INT = pin! I just moved it to RB1 and now works perfect! "dr. Imre Bartfai" wrote: > Hi, > > I do not see where your program variables and output port bits are rese= t > upon program start. As long as you set TRIS only output state will be > undetermined. > > I hope this helps. > > Regards, > Imre > > +----------------------------------------------------------------------= -+ > | The information transmitted is intended only for the person or entity= | > | to which it is addressed and may contain confidential and/or = | > | privileged material. Any review, retransmission, dissemination or = | > | other use of, or taking of any action in reliance upon, this = | > | information by persons or entities other than the intended recipient = | > | is prohibited. If you received this in error, please contact the = | > | sender and delete the material from any computer. = | > +----------------------------------------------------------------------= -+ > > On Wed, 19 Dec 2001, Milan Pavlica (YU7AEC) wrote: > > > Hello! > > I am going to build a simple PIC controlled electronics for opening g= ate > > on garage. > > Using PIC16F84 @4MHZ > > Idea is that: > > With IR TV remote control i am sending impulses to SFH506, he send > > impulses to PIC, he will start first relay for opening - this relay > > starting one contactor, which now will hold it self until gate is ope= ned > > > > Also, when i want to close, again i am sending impulses, but now seco= nd > > relay will act. I am using (as outs) simple NPN transistor which driv= e > > small 12V relay with only R in base - no PulUp or PullDown > > Problem is that when i start PIC, he start to open-close respectively > > first ans second relay.... > > What is problem?? > > THANKS! > > p.s. I am using PBP compiler > > > > '***DEFINITION OF I/O PORTS > > > > TRISB.0=3D1 ' PORTB0 je input > > TRISB.4=3D0 ' PORTB4 je output > > TRISB.5=3D0 ' PORTB5 je output > > > > '***DEFINI=F0ION OF VARIABLES > > > > GATE_IS_UP VAR BYTE ' Show us that gate is up > > GATE_IS_DOWN VAR BYTE ' Show us that gate is down > > SENZOR VAR PORTB.0 ' Define PORTB0 as SENZOR > > RELAY_OPEN VAR PORTB.4 ' Define PORTB4 - relay for opening U= P > > RELAY_CLOSE VAR PORTB.5 ' Define PORTB5 - relay for closing D= OWN > > > > '***MAIN PROGRAM > > > > > > FIRST_CONDITION: > > PauseUs 35 > > IF SENZOR =3D 0 Then ' If there is 0 on senzor > > GoTo SECOND_CONDITION: ' Go on Second_condition > > Else > > GoTo FIRST_CONDITION > > EndIF > > > > SECOND_CONDITION: > > PauseUs 35 ' Wait for impulses > > IF SENZOR =3D 1 Then ' If there is 1 on senzor > > GoTo THIRD_CONDITION > > Else > > GoTo FIRST_CONDITION > > EndIF > > > > THIRD_CONDITION: > > PauseUs 35 > > IF SENZOR =3D 0 Then > > GoTo GATE_DOWN > > Else > > GoTo FIRST_CONDITION > > EndIF > > > > GATE_DOWN: > > IF Gate_Is_Down =3D 1 TheN > > GoTo GATE_UP > > Else > > RELAY_CLOSE =3D 1 > > Pause 1500 > > RELAY_CLOSE =3D 0 > > Pause 1000 > > Gate_Is_Down =3D 1 > > Gate_Is_Up =3D 0 > > GoTo FIRST_CONDITION > > EndIF > > GATE_UP: > > Gate_Is_Down =3D 0 > > RELAY_OPEN =3D 1 > > Pause 1500 > > RELAY_OPEN =3D 0 > > Gate_is_Up =3D 1 > > GoTo FIRST_CONDITION > > '***END OF PROGRAM > > > > > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. --------------DB5148087B04430EE092D68C Content-Type: text/x-vcard; charset=koi8-r; name="mpavlica.vcf" Content-Description: Card for Milan Pavlica (YU7AEC) Content-Disposition: attachment; filename="mpavlica.vcf" Content-Transfer-Encoding: 7bit begin:vcard n:Pavlica;Milan x-mozilla-html:FALSE org:SuperSonic Systems adr:;;;;;; version:2.1 email;internet:mpavlica@ptt.yu title:Chief fn:Milan Pavlica end:vcard --------------DB5148087B04430EE092D68C-- -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.