Sorry, wrong version.
Here's the right one.
<code>
'************************************************* ***************
DEFINE LOADER_USED 1 ' If using bootloader
DEFINE OSC 20
DEFINE HSER_RCSTA 90h 'setup receive register
DEFINE HSER_TXSTA 20h 'setup transmit register
DEFINE HSER_BAUD 38400 'setup baud rate
'INCLUDE "DT_INTS-18.inc" ' Base Interrupt System
'INCLUDE "ReEnterPBP-18.inc" ' Include if using PBP interrupts
Addr var word
Char var byte
led1 var PORTC.0 'heartbeat LED
Clear
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
goto StartLoop ' Required
String1:
@ da "This is a string",0
AnotherString:
@ da "Here is another string",0
'------------GetAddress Macro - Location insensitive -------------------------
ASM
GetAddress macro Label, Wout ; Returns the Address of a Label as a Word
CHK?RP Wout
movlw low Label
movwf Wout
movlw High Label
movwf Wout + 1
endm
ENDASM
StartLoop ' This loop repeats continuously just as a test.
@ GetAddress _String1, _Addr ' Get address of String
gosub StringOut ' Send the String
hserout [13,10] ' New Line
@ GetAddress _AnotherString, _Addr ' Get address of String
gosub StringOut ' Send the String
hserout [13,10] ' New Line
pause 500
goto StartLoop ' Repeat
StringOut: ' Send the string out via Hserout
Readcode Addr, Char ' Get a character
if Char = 0 then StringDone ' Look for Null char, Stop if found
hserout [Char] ' Send char
Addr = Addr + 1 ' Point to next character
goto StringOut ' Continue with rest of the string
StringDone:
return
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
end
</code>
"It will never happen here!" just happened here.
My thoughts and prayers for Sandy Hook victims and families.
Bookmarks