PIC lights on, Assembly Language

Assignment Help:
errorlevel -302 ;prevents error code for this chipset
__config 0x373A ;chip config PIC spec page 146
processor 16F877A ;chipset

reset code 0x00
pagesel start ;Chooses pages from goto
nop ;does nothing
goto start

;**************************************************************************
code ;LABEL
start ;Label
clrf STATUS ;clear status from regester(Z is in status regester)
clrf PORTA ;clear port A
clrf PORTB ;clear port B
movlw 0x03 ;move literal into w
movwf PORTA ;move w into f

bsf STATUS, RP0 ;bit set f status, Regestry bank 0
movlw 0x07 ;move literal into w
movwf ADCON1
clrf TRISA ;clear register TriState regestry port A
clrf TRISB ;clear register TriState regestry port B
clrf TRISD ;clear register TriState regestry port D

CLRF STATUS
;*******************************************************************************
loop ;Start a Loop function
call LCD_update ;Calls LCD_Update function
call delay ;Calls delay function for time
goto loop ;Returns to loop


LCD_update_code code ;LAbEL
LCD_update ;LABEL

;IF CONTROL
sw1 btfsc PORTB, 1
goto display1
btfsc PORTB, 0
goto display2
display1
bcf PORTB, 0x01 ;turn Off LED 2
movlw 0xF9 ;Set number 1
movwf PORTD ;move w to f set PORTD
bsf PORTB, 0x00 ;turn On LED 1
goto finish_display

sw2 btfsc PORTB, 0
goto display2
btfsc PORTB, 1
goto display3
display2
bcf PORTB, 0x00 ;turn off LED
movlw 0x24 ;Set number 2
movwf PORTD
bsf PORTB, 0x01 ;turn on LED 2
goto finish_display


sw3 btfsc PORTB, 1
goto display3
btfsc PORTB, 0
goto display4
display3
bcf PORTB, 0x04 ;turn off LED 4
movlw 0x30 ;Set number 3
movwf PORTD
bsf PORTB, 0x02 ;turn on LED 3
goto finish_display


sw4 btfsc PORTB, 0
goto display3
btfsc PORTB, 1
goto finish_display
display4
bcf PORTB, 0x02 ;turn off LED 3
movlw 0x8D ;Set number 4
movwf PORTD
bsf PORTB, 0x04 ;turn on LED 4
goto finish_display

finish_display
RETURN

;*****************************************************************
;Variables for delay function

delay_udata udata ;LABEL
x res 2 ;x reserves 2 bytes

.delay code
delay
banksel x
clrf x
movlw 20
movwf x + 1
decfsz x, 1
goto $-1
decfsz x + 1, 1
goto $-3
return

end

Related Discussions:- PIC lights on

Modes of 8254-microprocessor, Modes of 8254 :   Mode 0 (Inter...

Modes of 8254 :   Mode 0 (Interrupt on Terminal Count)-GATE which value is 1 enables counting and GATE  which value is 0 disables counting, and GATE put not effect on

Odd and even numbers, hi, i''m new to assembly language and my teacher told...

hi, i''m new to assembly language and my teacher told us to look for an example of the odd and even numbers program using debug.exe in ms dos as a guide since we just started. plea

Schematic circuit diagram of system, Perform an extensive web search of pop...

Perform an extensive web search of popular microcontroller manufacturers (some of the major players) to select a suitable device for the system to control the lighting of a typical

Display triangular shape using stars, write an assembly program to display ...

write an assembly program to display triangular star like shape

Register organization of 8086-microprocessor, Register Organization of 8086...

Register Organization of 8086 8086  has  a great  set  of registers  containing  special  purpose and general  purpose  registers.  All the 8086 resisters are 16-bit registers.

Progframmw, write a programme the addition two 3*3 matrix and stored in fro...

write a programme the addition two 3*3 matrix and stored in from list

Comparison between 8086 and 8088, Comparison between 8086 and 8088 All ...

Comparison between 8086 and 8088 All the changes in 8088 above 8086 are indirectly or directly related to the 8-bit, 8085 compatible data and control bus interface. 1) The p

Evolution of microprocessor , EVOLUTION OF MICROPROCESSOR : ...

EVOLUTION OF MICROPROCESSOR : The digital circuits and systems may be broken into two part: 1) Sequential Circuit and 2) Combinational Circuits     Norm

C#, * * * * **** ...

* * * * **** * * * * * How can i print this help me pls

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd