Sie sind auf Seite 1von 5

--************************************************

--* JAL 2.4j


*
--* File name: LED_Two-Ports.jal
*
--* Author: Win Htet Win
*
--* Date: 9 March 2013 ; 15 March 2013
*
--* Processor: 16F877A
*
--* 20MHz Crystsl Oscillator
*
--* Chasing LEDa in Step and Progressive Modes *
--* in PortB and PortD
*
--* Compiler: JAL Editor
*
--************************************************
include 16F877A_bert
--definitions
pin_b0_direction = output
pin_b1_direction = output
pin_b2_direction = output
pin_b3_direction = output
pin_b4_direction = output
pin_b5_direction = output
pin_b6_direction = output
pin_b7_direction = output
pin_d0_direction
pin_d1_direction
pin_d2_direction
pin_d3_direction
pin_d4_direction
pin_d5_direction
pin_d6_direction
pin_d7_direction

=
=
=
=
=
=
=
=

output
output
output
output
output
output
output
output

forever loop
-- RIGHT TO LEFT in Step mode
pin_b0 = high
pin_d0 = high
_usec_delay(500_000)
pin_b0 = low
pin_d0 = low
pin_b1 = high
pin_d1 = high
_usec_delay(500_000)
pin_b1 = low
pin_d1 = low
pin_b2 = high
pin_d2 = high
_usec_delay(500_000)
pin_b2 = low
pin_d2 = low
pin_b3 = high
pin_d3 = high
_usec_delay(500_000)
pin_b3 = low
pin_d3= low
pin_b4 = high

pin_d4 = high
_usec_delay(500_000)
pin_b4 = low
pin_d4 = low
pin_b5 = high
pin_d5 = high
_usec_delay(500_000)
pin_b5= low
pin_d5 = low
pin_b6 = high
pin_d6 = high
_usec_delay(500_000)
pin_b6 = low
pin_d6 = low
pin_b7 = high
pin_d7 = high
_usec_delay(500_000)
pin_b7 = low
pin_d7 = low
portb = 0
portd = 0
_usec_delay(500_000)
-- LEFT TO RIGHT in Step mode
pin_b7 = high
pin_d7 = high
_usec_delay(500_000)
pin_b7 = low
pin_d7 = low
pin_b6 = high
pin_d6 = high
_usec_delay(500_000)
pin_b6 = low
pin_d6 = low
pin_b5 = high
pin_d5 = high
_usec_delay(500_000)
pin_b5 = low
pin_d5 = low
pin_b4 = high
pin_d4 = high
_usec_delay(500_000)
pin_b4 = low
pin_d4= low
pin_b3 = high
pin_d3 = high
_usec_delay(500_000)
pin_b3 = low
pin_d3= low
pin_b2 = high

pin_d2 = high
_usec_delay(500_000)
pin_b2= low
pin_d2 = low
pin_b1 = high
pin_d1 = high
_usec_delay(500_000)
pin_b1 = low
pin_d1 = low
pin_b0 = high
pin_d0 = high
_usec_delay(500_000)
pin_b0 = low
pin_d0= low
portb = 0
portd = 0
_usec_delay(500_000)
-- RIGHT TO LEFT in Progressive mode
pin_b0 = high
pin_d0 = high
_usec_delay(500_000)
pin_b1 = high
pin_d1 = high
_usec_delay(500_000)
pin_b2 = high
pin_d2 = high
_usec_delay(500_000)
pin_b3 = high
pin_d3 = high
_usec_delay(500_000)
pin_b4 = high
pin_d4 = high
_usec_delay(500_000)
pin_b5= high
pin_d5 = high
_usec_delay(500_000)
pin_b6 = high
pin_d6 = high
_usec_delay(500_000)
pin_b7 = high
pin_d7= high
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)

-- LEFT TO RIGHT in Progressive mode


pin_b7 = high
pin_d7= high
_usec_delay(500_000)
pin_b6 = high
pin_d6= high
_usec_delay(500_000)
pin_b5 = high
pin_d5= high
_usec_delay(500_000)
pin_b4 = high
pin_d4= high
_usec_delay(500_000)
pin_b3 = high
pin_d3= high
_usec_delay(500_000)
pin_b2 = high
pin_d2= high
_usec_delay(500_000)
pin_b1 = high
pin_d1= high
_usec_delay(500_000)
pin_b0 = high
pin_d0= high
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
--PORTB OFF PORTD ON
portb = 0
portd = 255
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
--PORTB ON PORTD OFF
portb = 255
portd = 0
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
--PORTB ON PORTD OFF

portb = 255
portd = 0
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
--PORTB OFF PORTD ON
portb = 0
portd = 255
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
--PORTB ON PORTD ON X THREE TIMES
portb = 255
portd = 255
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
portb = 255
portd = 255
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
portb = 255
portd = 255
_usec_delay(500_000)
portb = 0
portd = 0
_usec_delay(500_000)
end loop

Das könnte Ihnen auch gefallen