please dont rip this site

PIC JAL IO Routine


by M. Yalin Duyur

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
-- 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
  pincount = 0
end if

end procedure

forever loop
display (d, c, b, a)
end loop


file: /Techref/piclist/jal/counter-mydrb.htm, 2KB, , updated: 2005/3/15 05:02, local time: 2024/6/22 06:35,

 ©2024 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?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> PIC JAL IO Routine Counter</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, 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.

Welcome to!