Searching \ for 'test 4' 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/index.htm?key=test
Search entire site for: 'test 4'.

Truncated match.
PICList Thread
'test 4'
1999\02\10@071709 by Glen

flavicon
face
part 0 10045 bytes
<P>i am testing this sensor input by simple applying a 1 or 0 to the input.

<P>i will replace this with an ldr (cost)then using the vin-vo level&nbsp;
to&nbsp; control counters
<BR>next step.i will also try cap with ldr next.
<BR>i'm not sure which will be the best untill i test the midpoint hysterisis
of the i/p pin

<P>couple of problems
<BR>-it won't go on initially for the 10secs &amp; go off.(???)
<BR>-when it's high it times out for the 20secs &amp; lamps on , like it
should&nbsp; (ok)
<BR>-but when i change the input pin to low the lamps wont go off&nbsp;
.i don't know if it is timing out !(???)
<BR>i'm not sure if the delay(del) lamp on &amp; off timers are reseting
either.

<P>if night, keep delay counting (del) if a 0&nbsp; or if day = 1 reset
delay(del) &amp; start day delay(del1) &amp;
<BR>visaversa

<P>any help / advice would be greatly appreciated with my 1st project.
<BR>i need to get this working correct so i can then use pin 8 to synchronise
to AC LINE ( 0 crossing)
<BR>i would like to upgrade from a relay to use a triac to control some
fluro lts
<BR>, i would like be able to control the firing angle of the triac.

<P>i can build this out of discreet components (no problem),but , software
control (a challenge)

<P>below is my program attempt.

<P>thanks , once again.
<BR>glen
<BR>&nbsp;
<BR>&nbsp;

<P>' Title&nbsp; ltsw.bas
<BR>'date&nbsp;&nbsp; 990204
<BR>'-------------- Progran Description -------------------
<BR>'using the 16f84 pic
<BR>'at startup , outputs on for 10 secs, sense an ldr for night or day,
<BR>'sense ldr pin change &amp; if pin same input after 20 secs , output
on
<BR>'
<BR>' pic connections
<BR>'
<BR>' pin 1 - ra2
<BR>' pin 2 - ra3
<BR>' pin 3 - ra4/toc1
<BR>' pin 4 - !mlcr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
resistor to 5v
<BR>' pin 5 - vss&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;
to gnd
<BR>' pin 6 -&nbsp; rb0/int
<BR>' pin 7 -&nbsp; rb1
<BR>' pin 8 -&nbsp; rb2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;
ac input
<BR>' pin 9&nbsp; - rb3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;
sensor input
<BR>' pin 10 - rb4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
out1a
<BR>' pin 11 - rb5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
out1b
<BR>' pin 12 - rb6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
out2a
<BR>' pin 13 - rb7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
out2b
<BR>' pin 14 - vdd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;
to 5v
<BR>' pin 15 - osc1/clkin
<BR>' pin 16 - osc2/clkout
<BR>' pin 17 - ra0
<BR>' pin 18 - ra1

<P>'----------- Constants -----

<P>symbol sensor = 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'senses
ldr changes
<BR>symbol&nbsp; out1a = 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'assign
pin 10 for label output
<BR>symbol&nbsp; out1b = 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'assign
pin 11 for label output
<BR>symbol&nbsp; out2a = 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'assign
pin 12 for label output
<BR>symbol&nbsp; out2b = 13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'assign
pin 13 for label output
<BR>symbol&nbsp; ac = 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;
'assign pin 8 for label ac (line sensing)
<BR>&nbsp;
<BR>symbol night = 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'sensor
pin 9 i/p = 0 , night
<BR>symbol day = 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'sensor pin 9 i/p = 1 , day
<BR>&nbsp;
<BR>'----------- Variables -------------
<BR>&nbsp;
<BR>symbol&nbsp; sense = b0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'temporary
variable&nbsp; lights on night
<BR>symbol&nbsp; sense1 = b1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'temporary
variable&nbsp; lights off day
<BR>'------------ Iniialisation ---------
<BR>&nbsp;
<BR>&nbsp;'pins&nbsp; 131211109876
<BR>&nbsp;'bits = 76543210
<BR>&nbsp;dirs = %00001100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
'direction pins for portb(0=op,1=ip)
<BR>&nbsp;'pins = 0C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'13,12,11,10 outputs.9,8 inputs.7,6 outputs
<BR>&nbsp;'*** pin 8 for AC LINE sychronise ***

<P>'------------ Main Code ----------
<DL>start:&nbsp;&nbsp;&nbsp;&nbsp; gosub lton&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'turn the 4 output pins on
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pause 10000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'delay
for 10 seconds
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
gosub lton&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
'turn the 4 output pins off
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pause 1000
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
goto main</DL>
main:&nbsp;&nbsp;&nbsp;&nbsp; if sensor = night then del&nbsp;&nbsp;&nbsp;&nbsp;
'if sensor=0 go to on_timeout loop
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if sensor = day then del1&nbsp;&nbsp;&nbsp; 'if sensor=1 go to off_timeoutloop

<P>del:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for sense = 1 to 20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pause 1000
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
next sense
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
gosub lton
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
goto main
<BR>&nbsp;
<BR>del1:&nbsp;&nbsp;&nbsp;&nbsp; for sense1 = 1 to 10
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pause 1000
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
next sense1
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
gosub ltoff
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
goto main
<BR>&nbsp;
<BR>'&nbsp; end
<BR>'------------ Sub routines -----------
<BR>lton:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; high out1a
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
high out1b
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
high out2a
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
high out2b
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return

<P>ltoff:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; low out1a
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
low out1b
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
low out2a
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
low out2b
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return
<BR>'----------------
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;</HTML>

</x-html>

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