list p=12F509 ; list directive to define processor
#include <p12F509.inc> ; processor specific variable definitions
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS
temp EQU 0x07 ;example variable definition
;**********************************************************************
ORG 0x3FF ; processor reset vector
; Internal RC calibration value is placed at location 0x3FF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
start
nop ; example code
movlw 0xFF ; example code
movwf temp ; example code
; remaining code goes here
END ; directive 'end of program'
list p=12F508 ; list directive to define processor
#include <p12F508.inc> ; processor specific variable definitions
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS
temp EQU 0x07 ;example variable definition
;**********************************************************************
ORG 0x1FF ; processor reset vector
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
start
nop ; example code
movlw 0xFF ; example code
movwf temp ; example code
; remaining code goes here
END ; directive 'end of program'
ORG 0x3FF ; processor reset vector
Filename: serial.asm *
; Date: *
; File Version: *
; *
; Author: Burt E Ratliff *
; Company: *
; *
; *
;**********************************************************************
; *
; Files Required: P12F508.INC *
; *
;**********************************************************************
; *
; Notes: *
; *
;**********************************************************************
list p=12F508 ; list directive to define processor
#include <p12F508.inc> ; processor specific variable definitions
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC
; pin assignments
#define TX GPIO,0 ; transmit pin on GP0
;***** VARIABLE DEFINITIONS
UDATA
buffer res 1
counter res 1
Count res 1
;**********************************************************************
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
RESET CODE 0x000 ; effective reset vector
movwf OSCCAL ; update OSCCAL with factory cal value
goto init ; jump to main program
init
movlw b'00000000' ; set I/O
tris GPIO
bsf TX
movlw 'b' ; sets text to loads buffer with
call start
movlw 'e'
call start
movlw '8'
call start
movlw '0'
call start
movlw 'b'
call start
movlw 'e'
call start
movlw ' '
call start
movlw 'w'
call start
movlw 'a'
call start
movlw 's'
call start
movlw ' '
call start
movlw 'h'
call start
movlw 'e'
call start
movlw 'r'
call start
movlw 'e'
call start
movlw 0x0A
call start
movlw 0x0D
call start
goto init ;loop for ever
start
movwf buffer
movlw 0x08
movwf counter ; counts the 8 bits
bcf TX ; set TX low
call BItdelay ; delay to get a 9600 bit rate
TXLoop
rrf buffer ,f ;send one bit
btfss STATUS ,C ;
bcf TX ;
btfsc STATUS ,C ;
bsf TX ;
call BItdelay ;
decfsz counter,f ;test if all done
goto TXLoop ;
bsf TX ;
call BItdelay ;
return
BItdelay ; timing delay
movlw 0x17
movwf Count
Wait
nop
decfsz Count ,f
goto Wait
return
END ; directive 'end of program'
movwf buffer
movlw 0x08
movwf counter ; counts the 8 bits
bcf TX ; set TX low
call BItdelay ; delay to get a 9600 bit rate
TXLoop
rrf buffer ,f ;send one bit
btfss STATUS ,C ;
bcf TX ;
btfsc STATUS ,C ;
bsf TX ;
call BItdelay ;
decfsz counter,f ;test if all done
goto TXLoop ;
bsf TX ;
call BItdelay ;
return
BItdelay ; timing delay
movlw 0x17
movwf Count
Wait
nop
decfsz Count ,f
goto Wait
return
END ; directive 'end of program'
Yes, the program in post #68 is putting text onto the term. The 12F508 doesnt have the UART built in so this technique is called bit bangging.Generally.
Is it possible to put in a few lines to send to the terminal?
Think I found Terminal in MPLAB X IDE.
Idea is to make sure compile works and all that.
Code sample for 12F509. IF somebody knocks it out.
DEBUG. So to speak.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
K | RS232 Framing Errors (Resolved) | Programming & Languages | 5 | |
8051 need help with code:CCC | Microcontrollers | 6 | ||
What address does it save in EEPROM ? | Digital Design | 8 | ||
M | Recommendations for good 68HC11 assembler? | Programming & Languages | 2 | |
S | PIC Assembler Program | Microcontrollers | 7 |
by Aaron Carman
by Jake Hertz
by Aaron Carman
by Jake Hertz