--
-- name : e0002.jal
-- author : Wouter van Ooijen
-- date : 05-May-1998
-- purpose : jal example
--
-- This program shows a night-rider style LED on port B
--
-- target configuration: 16f84 with 10 Mhz Xtal
include 16f84_10
-- standard library
include jlib
-- jal has no enumerate, so use constants
const byte to_right = 1
const byte to_left = 0
-- determine a new direction d when x has hit a boundary,
-- shift x one step in the good direction
procedure night( byte in out x, byte in out direction ) is
-- hit left border?
if ( x & 0b_1000_0000 ) != 0 then
direction = to_right
end if
-- hit right border?
if ( x & 0b_0000_0001 ) != 0 then
direction = to_left
end if
-- shift in current direction
if direction == to_right then
x = x >> 1
else
x = x << 1
end if
end procedure
-- port b all pins output
port_b_direction = all_output
var byte x = 0b_0000_0001
var byte d = to_left
-- main loop
forever loop
-- set port b
-- for active-low LEDs remove the --
port_b = x -- ^ 0xFF
-- delay 200mS
delay_100ms( 2 )
-- shift x one step in the current direction
night( x, d )
end loop
| file: /Techref/microchip/language/jal/doc/e0002.jal, 1KB, , updated: 1998/12/23 14:17, local time: 2025/10/25 16:17,
216.73.216.180,10-8-63-169: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://techref.massmind.org/techref/microchip/language/jal/doc/e0002.jal"> microchip language jal doc e0002</A> |
| Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.