}. ' }. | ' | ^ ' /\ / \ ' \\\\\\ / \ / .[ \ ' (-O-O-) / - \ / .; \ ' \(-)/ / \ /=----- "\ '*---------00o0--W----0o00-------* / ] \ ^ | / \ | '@ project name: counter-propic @ / . |__ \ / \ | | | | '@ programmed by : HATEM @ / __ ' \ / \ _| | | |_ '@ DATE : @ /J^..| | 4_|_||\ |= | <<==-=-=-=-===>> '@ COUNTRY LEBANON @ / . [ ,. \ |[ ]| \___ ___ _/ help?? '@ language name: propic @ /::::::::::::::::: \_;__|__ | | p '@ EMAIL: STAMPIC@YAHOO.COM @ ({{{{{{{{{{ }}}}}}}}})=-=-=-> | # [] | /|\ '@ VOLTS = 5 DC @ | ] ^ [ | .|/ | | /\ '@ you may use this pro only for @ | / \ l | | |[*] | | '@study purpose and hobby you may@ | ' / \ _ | ; | | ; | '@copy it but as it with no @ | , / \ _ |. | | __ | '@change to its contents @ | __ / \ _| []| | - | '@copy right @ | ;( ) | | | |- | '@ @ |00000|~~~~~~~|00000| - | | _ | '@ @ | -- | | | |---|;\ | __ | '@ @ | | {|} |. | -__ \ | ' | '@ @ | . | | |. | _-_ -- -\ | __ | '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@---|_____|___|___|_____|____--- ___/ .... \____ '------------------------------------------------------------------------------------------------
'this is a pro pic compiler pro
'the function of this counter is to get a pulse from a proximity sensor the pulse is sended to
'opto isolator the opto send the pulse to the counter pin.1 if power is failed the counter will
'use the stored charge in the capacitor to save the word number in two consecutive memory cells
'using alises variabel counter(counter var word)(cat VAR COUNTER.BYTE0 )+(tiger 'VAR COUNTER.BYTE)
' and the the pic will sense the power frailer by sensing the power line by looping to a comand
'line (if memory = 0 then save ) don't be mislead .memory = pin5 (memory var portb.5)
'the capacitor charge will be holded thank to the diode acting as one way valve so no current will
'came back from the capacitor to the supply line
'when re powered it will regain the last number from the eeprom and display it on lcd and will be in 'stand by mode for counting from the last number unless you want to reset the counter pressing pin 'porb,2
' if you count more then 50hz the lcd will blear '2000-7-17 11 at night ' my next plan is to use at the binging the comand 'count for one second to determine the speed of the counter so i can 'determine the speed of display so the lcd will be 'up dated only once a second that is by placing a 'counter so that the display will be updated according 'to the counted number for one second 'this counter is perfect it has been working on a tap edge
' machine for about 4manth with no frailer '2000-8-17 memory var portb.5 tango var word counter var word cat VAR COUNTER.BYTE0 'to save a word number in eeprom as two byts tiger VAR COUNTER.BYTE1 'to save a word number in eeprom as two byts setpoint VAR WORD input portb.1 ' counting pin"proximty" input memory ' saving pin portb.5 input portb.2 ' reset pin OUTPUT PORTB.4 ' RELAY_STOP OUTPUT portb.6 ' HART BEATING a led conected to pin6+7 OUTPUT portb.7 ' HART BEATING PORTB.4 = 0 ' TO MAKE SURE THAT PIN 4 = 0 AT START portb.6 = 0 portb.7 = 0 clear HART_BEATING: 'this sub is to verify that the proseser is functioning ok 'it is a must tactic with lcd's in case a problem with lcd
portb.7 = 0 portb.6 = 1 pause 70 portb.7 = 1 portb.6 = 0 pause 50 tango = tango + 1 if tango = 20 then loop goto HART_BEATING loop: Lcdout $fe, 1 'well com message Lcdout "hi hello" Pause 1500 Lcdout $fe, 1 Lcdout "TAPE EDG COUNTER" PAUSE 1500 Lcdout $fe, 1 Lcdout "COUNTER READY" PAUSE 1500 RECOLL: read 10,cat 'remember the last saved number read 11,tiger write 10,0 ' and reset the memory to zero write 11,0
START_AGAIN: setpoint = counter / 125 'operating alarm or stoping the machine( using relay) lcdout $fe, 1 ,#counter," meter=",#setpoint go_on: if portb.2 = 1 then zeero 'to zero the counter if memory = 0 then save 'if the supling power is of the remained if portb.1 = 1 then go_on 'charged in the capacitor will save the counted nuber counter = counter + 1 setpoint = counter / 125 lcdout $fe, 1 ,#counter," meter=",#setpoint' dec (counter/125) hold: if portb.2 = 1 then zeero if memory = 0 then save if portb.1 = 0 then hold IF COUNTER >12500 THEN ALARM ' set point in the counter as alarm goto go_on save: write 10,cat 'saving sub is to save the counter (word) as two byte's write 11,tiger 'in two consecutive locations end 'don't let the counter go to wonder lands stop her!!!!! zeero: write 10,0 'the title say it all write 11,0 counter = 0 Lcdout $fe, 1 lcdout #counter goto go_on ALARM: 'the title say it all COUNTER = 0 Lcdout $fe, 1 lcdout #counter PORTB.4 = 1 PAUSE 2000 PORTB.4 = 0 GOTO START_AGAIN 'this is the circuit connections diagram