With help from Rob Curtis
it is a good way to count pin_b7s but when you forget your finger on it 8)) it counts by it self I don't want it (when you count a wheels spin it is slow. ok decreasing debounce_delay works but when wheel stops on the button you couldn't see the spins count ) for my job my code is better than yours 8))
-- name : counter.jal
-- authors : M.YALIN DUYUR & ROB CURTIS
-- date : August 2000
include 16f84_4
include jlib
include jseven
port_b_direction = all_output
port_a_direction = all_output
var byte a, b, c, d, x
var byte pincount
var byte debounce_delay
pincount = 0
debounce_delay = 5
a = 0
b = 0
c = 0
d = 0
procedure display (byte in d4, byte in d3, byte in d2, byte in d1) is
port_a = 0b_0111
port_b = seven_from_digit (d4)
delay_1ms (5)
port_a = 0b_1011
port_b = seven_from_digit (d3)
delay_1ms (5)
port_a = 0b_1101
port_b = seven_from_digit (d2)
delay_1ms (5)
port_a = 0b_1110
port_b = seven_from_digit (d1)
delay_1ms (5)
end procedure
procedure count is
a = a + 1
if a == 10 then
a = 0
b = b + 1
end if
if b == 10 then
b = 0
c = c + 1
end if
if c == 10 then
c = 0
d = d + 1
end if
if d == 10 then
d = 0
end if
end procedure
-- Thanks ROB
procedure TestPort is
pin_b7_direction = input
if pin_b7 & pincount < debounce_delay then
pincount = pincount + 1
if pincount == debounce_delay then Count end if
else
pincount = 0
end if
end procedure
forever loop
TestPort
display (d, c, b, a)
end loop
Questions:
Hi I want to make 4 digit Counter(counter.JAL) But I cant convert the file (counter.JAL)to hex file please E-mail me the Hex file by E-mail My E-mail:hossam_saied@hotmail.com+
| file: /Techref/piclist/jal/counter-mydrb.htm, 2KB, , updated: 2005/3/15 05:02, local time: 2025/10/25 22:46,
216.73.216.22,10-3-83-201:LOG IN
|
| ©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.piclist.com/techref/piclist/jal/counter-mydrb.htm"> PIC JAL IO Routine Counter</A> |
| Did you find what you needed? |
|
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
|
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.