hello,
after reading the board for string handling, again the solution is DT fantastic examples..
but trying to combine interuptmodule ( macro) and the getaddress module ( for string handling) the compiler generates errors.
duplicate macro name ( getaddress)
is it not possible to use more than one macro ?
the Hserout is not needed - just copy - paste to try ...
used pic is 18F4525
'*****************************************
'* Name : STRINGS-16.PBP *
'* Author : Darrel Taylor *
'* Date : 6/12/2005 *
'* Note: Strings must be NULL Terminated *
'****************************************
DEFINE LOADER_USED 1 ' If using bootloader
DEFINE OSC 4
DEFINE HSER_TXSTA 24h ' Use this for Higher Baud Rates
DEFINE HSER_SPBRG 25 ' 9600 Baud at 4mhz
Addr var word
Char var byte
Clear
'************************************************* ********
' include special interupts
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
INCLUDE "Elapsed_INT-18.bas" ; Elapsed Timer Routines
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
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ClockCount, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
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
end
rgds
harry
Bookmarks