;----------------------------------------------------------------------------- ; 4/25/2006 sjd ; ; ; ; FILE NAME : INOUT01.ASM ; TARGET MCU : C8051F120 ; DESCRIPTION : This program illustrates how to configure the ; Crossbar, read and write to port 0 & 1 ; 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 ; P0 input, P1 output. Make sure jumpers J3 & J1 are removed to ; use all 8 bits on port P1. The on-board LED D3 and SW2 are connected ; to P1.6 and P1.7 ; loop. Loop: mov R7, P0 ; read port 0 mov P1, R7 ; write port 1 jmp Loop ;----------------------------------------------------------------------------- ; End of file. END