-- -- 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: 2024/11/9 14:38,
18.218.123.16:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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? <A HREF="http://linistepper.com/techref/microchip/language/jal/doc/e0002.jal"> microchip language jal doc e0002</A> |
Did you find what you needed? |