USING USB SUPPLY DIRECTLY FROM PC
Resistor :22 ohm from usb +ve
10 kohm -MCLR-PIN1 to+ve
100 kohm-pin 2 - down rail reference to ground
100 ohm -pin 20 -LED to connect with respect to ground
Crystal : 16MHz-pin no:13,14
LDR normal size -pin2 to+ve reference(+5v)
USING LM7805 IC REGULATOR
we dont need 22 ohms resistor here.so connect as above picture.connect 3rd pin to ic pin no 32 and ic second pin to ic pin 12.so input give 9-12 volt dc power supply from charger or battery.connect +ve to pin1 and gnd to pin no2
PROGRAM
#chip 16F877A,16
dir porta.0 in
dim reading as byte
dir portd.1 out
wait 2 s
set portd.1 on
wait 1 s
set portd.1 off
wait 2 s
Do
reading=ReadAD(an0)
if reading>10 then
set portd.1 off
end if
if reading<10 then
set portd.1 on
end if
Loop
HEX CODE
:020000040000FA
:060000008A110A12052816
:100008000900422083160313051488100230F400F7
:10001800831203133A2088140130F4003A20881020
:100028000230F4003A20A00158202108A2000A3C1E
:10003800031C88100A302202031C88141728630046
:1000480023280C30F000F00B2728F50B2528080092
:10005800F30A6C30F1000B30F000F00B3128F10B93
:100068002F28F20B2D28F30B2D280800E830F2007A
:100078000330F3002C20F40B3A28080083160313EE
:100088009F13831203131F10831603139F111F1549
:100098009F141F1007309C008312031385018601EB
:1000A8008701880189010800831603139F139F1194
:1000B8001F119F101F101F13831203139F131F1765
:1000C8009F111F129F1220189F15A0181F16201984
:1000D8009F161F140230F50025201F1500001F1958
:1000E80073281F10831603139F111F159F141F10C9
:1000F800831203131E08A100831603139F13831290
:0401080003130800D5
:02400E007A3FF7
:00000001FF
0 Comments