;----------------------------------------------------------------------------- ; 10/20/2004 sjd ; ; ; ; FILE NAME : INOUT23.ASM ; TARGET MCU : C8051F000 ; 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 (c8051f000.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. ; Enable the Port I/O Crossbar Main: mov XBR2, #40h mov PRT2CF, #0FFh ;push-pull mov PRT3CF, #0FFh ;push-pull ;P2 input, P3 output. ;loop. Blink: mov R7, P2 ;read port 2 mov P3, R7 ;write port3 jmp Blink ;----------------------------------------------------------------------------- ; End of file. END