--
-- 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 13:17, local time: 2012/2/10 14:00,
38.107.179.233:LOG IN |
| ©2012 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/microchip/language/jal/doc/e0002.jal"> microchip language jal doc e0002</A> |
| Did you find what you needed? |
|
The PICList shop now offers mugs, steins and... T-Shirts!!! |
Robotics nuts!Check out http://users.frii.com/dlc/robotics/projects/botproj.htm from Dennis Clark. This guy ROCKS! He has made (and sells but also releases code, docs, etc...) for a number of cool little robotic modules including whiskers, IR proximity detect and remote control, Sonar proximity detect, PWM, Servo, compass. Most of these use the little PIC 12C508 controller which costs basically nothing and is soooo tiny.The 4 servos, 2400 baud serial servo controller is a wonder of magic and he sells the programmed chip for $8. Wow! |
.