hello
i want simulate a cycle rpm sensor for automotive.
http://www.geea.org/IMG/swf/capteur_vitesse_6.swf
the frequency must be able.
i ve test this code (!!! it s not the same cycle of the picture)
' _!-!_!-!__!--!_!-!_!-!
' pic16F877
' Variable
W0 var word
W1 var word
i var byte
up var PORTB.4
dn var PORTB.5
w0=0
i=0
'DN Define frequency down button
'UP Define frequency up button
PO con 3 ' Define pulse output pin
low PO ' Initialize output polarity
inc:
If (up = 1) Or (W0 = 10000) Then decr ' Increment freq on button
W0 = W0 + 10
decr:
If (dn = 1) Or (W0 = 0)Then pulse ' Decrement freq on button
W0 = W0 - 10
pulse:
for i =1 to 38
Pulsout 3,W0 ' Generate pulse
Pause W0/100 ' Intra-pulse delay
next i
Pulsout 3,W0
W1=W0*2
Pause W1/100
Pulsout 3,W1
Goto inc ' Forever
this code is ok but not optimized with button
how do? use pulsout or pwm?
thank
Bookmarks