Good point!!!
Take 2.2 .....................
I based this off of Mr_E's simple print-string routine originally written for an LCD, adapted for my GLCD, now adapted to copy a string within the source over to a string array...basically so I can send it out with a serout or lcdout command.
Set up for use with PIC18Fxxxx series PICs using PBP 2.50 and above (PBPL).
Now the statement:Code:string var byte[255] : stringpos var byte : addr var long : char var byte 'if using PIC with less than 64K flash, don't need to use PBPL, can change 'addr from LONG to WORD ASM 'macro must be placed in program before its first use copystr macro stringcopy local thestringcopy , overthestring bra overthestring thestringcopy data stringcopy , 0 overthestring MOVE?CW thestringcopy , _addr ;It is necessary to use CN in place of CW to cover the case when the ;copystring statement is located above 64K (i.e. PIC18F4685, '8722, etc.etc.) L?CALL _copystring endm ENDASM copystring: stringpos = 0 copystringloop: READCODE addr , char : if char = 0 then copystringdone string[ stringpos ] = char : addr = addr + 1 stringpos = stringpos + 1 if stringpos < 255 then copystringloop copystringdone: string[ stringpos ] = 0 : stringpos = stringpos + 1 if stringpos < 254 then copystringdone return
@ copystr "TEST STRING"
Should result in the variable array STRING with "TEST STRING" with the remainder of the array zero'd.[/QUOTE]




Bookmarks