;----------------------------------------------------------------------------- ; 4/25/2006 sjd ; ; ; ; FILE NAME : INOUT23.ASM ; TARGET MCU : C8051F120 ; DESCRIPTION : This program illustrates how to configure the ; Crossbar, read and write to port 2 & 3 ; I/O pins. ; ; ; NOTES: ; ; (1) This note intentionally left blank. ; ; ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; EQUATES ;----------------------------------------------------------------------------- $include (c8051f120.inc) ; Include register definition file. ;----------------------------------------------------------------------------- ; VARIABLES ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; RESET and INTERRUPT VECTORS ;----------------------------------------------------------------------------- ; Reset Vector cseg AT 0 ljmp Main ; Locate a jump to the start of code at ; the reset vector. ;----------------------------------------------------------------------------- ; CODE SEGMENT ;----------------------------------------------------------------------------- Code_Seg segment CODE rseg Code_Seg ; Switch to this code segment. using 0 ; Specify register bank for the following ; program code. ; Use SFRs on the Configuration Page Main: mov SFRPAGE, #CONFIG_PAGE ; Enable the Port I/O Crossbar mov XBR2, #40h ; P2 input, P3 output. ; loop. Loop: mov R7, P2 ; read port 2 mov P3, R7 ; write port 3 jmp Loop ;----------------------------------------------------------------------------- ; End of file. END