de b’00000101’ ; h’01’ PWR_KEY_ADR
de b’00001100’ ; h’02’ PWR_KEY_CMD
;--- Definitions [all Mixed Case] -----------------------------------------------------------------
#define ATX_C_out cmcon,7 ; comparator 2 output
#define IRin porta,0 ; input for IR receiver chip (active low)
#define IRinTris trISA,0 ; tris register bit for IRin
#define IR_C_out cmcon,6 ; comparator 1 output
#define LEDred portb,0 ; output for bicolor LED red anode
#define LEDgrn portb,1 ; output for bicolor LED green anode
#define PWRout portb,2 ; output to drive transistor for MB ATX pwr on/off
#define RESETout portb,3 ; output to drive transistor for MB reset
#define PWRin portb,4 ; input for PC pwr switch
#define TestOut portb,5 ; debug output for scope
#define TurnOnDelay d’9’ ; turn on delay when pressing remote pwr key to
; wake up from standby (9 makes approx. one second)
#define RebootDelay d’15’ ; additional reboot delay (in seconds)
#define RC5_Flag FLAGS,0 ; 0: RC_5 code valid, 1: RC_5 code invalid
#define Reboot_Flag FLAGS,1 ; 0: normal boot delay, 1: additional delay needed
;--- Macros [all Mixed Case] ----------------------------------------------------------------------
Bank_0 macro
bcf status,5
bcf status,6
endm
Bank_1 macro
bsf status,5
bcf status,6
endm
Test macro
bsf TestOut
bcf TestOut
endm
LED_red macro
bsf LEDred
bcf LEDgrn
endm
LED_grn macro
bsf LEDgrn
bcf LEDred
endm
LED_off macro
bcf LEDred
bcf LEDgrn
endm
;--- Reset ----------------------------------------------------------------------------------------
org h’00’
goto init ; reset -> init
;--- Interrupt ------------------------------------------------------------------------------------
org h’04’
goto init ; no interrupt
;**************************************************************************************************
; Initialization
;**************************************************************************************************
init
; configuration of porta and portb ----------------------------------------------------------------
Bank_0
clrf porta ; clear porta register
clrf portb ; clear portb register
Bank_1
MOVlw b’00000111’ ; RA0...RA2 input, RA3...RA7 output
MOVwf trisa
MOVlw b’00010000’ ; RB0...RB3 output, RB4 input, RB5...RB7 output
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] 下一页
本文关键字:程序 PIC单片机,单片机-工控设备 - PIC单片机