User`s guide
Getting Started with MPLAB SIM
© 2006 Microchip Technology Inc. DS51519B-page 227
; software is owned by the Company and/or its supplier, and is
; protected under applicable copyright laws. All rights are reserved.
; Any use in violation of the foregoing restrictions may subject the
; user to criminal sanctions under applicable laws, as well as to
; civil liability for the breach of the terms and conditions of this
; license.
;
; THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
; WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
; TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
; PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
; IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;
;***********************************************************
; PIC18F452 EXAMPLE CODE FOR PICDEM 2
;
; TITLE: USART Demonstration
; FILENAME: usart.asm
; REVISION HISTORY: A 5/13/00 jb format change
; B 2/28/05 em update for example
; HARDWARE: PICDEM 2 board
; FREQUENCY: 4MHz
;
;************************************************************
; This program demonstrates basic functionality of the USART.
;
; Port B is connected to 8 LEDs.
; When the PIC18F452 receives a word of data from
; the USART, the value is displayed on the LEDs and
; is retransmitted to the host computer.
;
; Set terminal program to 9600 baud, 1 stop bit, no parity
list p=18f452 ; set processor type
list n=0 ; supress page breaks in list file
include <p18f452.inc>
;************************************************************
; Reset and Interrupt Vectors
org 00000h ; Reset Vector
goto Start
org 00008h ; Interrupt vector
goto IntVector
;************************************************************
; Program begins here
org 00020h ; Beginning of program EPROM
Start
clrf LATB ; Clear PORTB output latches
clrf TRISB ; Config PORTB as all outputs
bcf TRISC,6 ; Make RC6 an output
movlw 19h ; 9600 baud @4MHz
movwf SPBRG
bsf TXSTA,TXEN ; Enable transmit