Searching \ for '[PIC]: What is wrong with this program??' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'What is wrong with this program??'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: What is wrong with this program??'
2001\12\19@090156 by Milan Pavlica (YU7AEC)

flavicon
face
part 0 44 bytes
his is a multi-part message in MIME format.
part 1 2425 bytes content-type:text/plain; charset=koi8-r (decoded quoted-printable)

Hello!
I am going to build a simple PIC controlled electronics for opening gate
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 opened

Also, when i want to close, again i am sending impulses, but now second
relay will act. I am using (as outs) simple NPN transistor which drive
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=1                   ' PORTB0 je input
   TRISB.4=0                   ' PORTB4 je output
   TRISB.5=0                   ' PORTB5 je output

'***DEFINIŅION 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 UP
   RELAY_CLOSE VAR PORTB.5     ' Define PORTB5 - relay for closing DOWN

'***MAIN PROGRAM


FIRST_CONDITION:
            PauseUs 35
            IF SENZOR = 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 = 1 Then  ' If there is 1 on senzor
            GoTo THIRD_CONDITION
            Else
            GoTo FIRST_CONDITION
            EndIF

THIRD_CONDITION:
            PauseUs 35
            IF SENZOR = 0 Then
            GoTo GATE_DOWN
            Else
            GoTo FIRST_CONDITION
            EndIF

GATE_DOWN:
            IF Gate_Is_Down = 1 TheN
           GoTo GATE_UP
  Else
           RELAY_CLOSE = 1
           Pause 1500
           RELAY_CLOSE = 0
           Pause 1000
           Gate_Is_Down = 1
           Gate_Is_Up = 0
           GoTo FIRST_CONDITION
           EndIF
GATE_UP:
           Gate_Is_Down = 0
           RELAY_OPEN = 1
           Pause 1500
           RELAY_OPEN = 0
           Gate_is_Up = 1
           GoTo FIRST_CONDITION
'***END OF PROGRAM



part 2 201 bytes content-type:text/x-vcard; charset=koi8-r;
(decoded 7bit)

begin:vcard
n:Pavlica;Milan
x-mozilla-html:FALSE
org:SuperSonic Systems
adr:;;;;;;
version:2.1
email;internet:spam_OUTmpavlicaTakeThisOuTspamptt.yu
title:Chief
fn:Milan Pavlica
end:vcard


part 3 144 bytes
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\12\20@015812 by dr. Imre Bartfai

flavicon
face
Hi,

I do not see where your program variables and output port bits are reset
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:

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\12\20@032827 by Milan Pavlica (YU7AEC)

flavicon
face
part 0 44 bytes
his is a multi-part message in MIME format.
part 1 4560 bytes content-type:text/plain; charset=koi8-r (decoded quoted-printable)

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:

{Quote hidden}


part 2 201 bytes content-type:text/x-vcard; charset=koi8-r;
(decoded 7bit)

begin:vcard
n:Pavlica;Milan
x-mozilla-html:FALSE
org:SuperSonic Systems
adr:;;;;;;
version:2.1
email;internet:.....mpavlicaKILLspamspam@spam@ptt.yu
title:Chief
fn:Milan Pavlica
end:vcard


part 3 131 bytes
--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...