you failed to mention chip type, for a 16f1825 i would employ this method
Code:;16f1825 #CONFIG __config _CONFIG1, _FOSC_INTOSC & _CP_OFF & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CLKOUTEN_OFF __config _CONFIG2, _PLLEN_ON & _LVP_OFF #ENDCONFIG DEFINE OSC 32 OSCCON=$70 ANSELA=0 ANSELC=0 TRISA = %001110 trisc = %11100010 ' set PORTC I/O Strings CON EXT i VAR BYTE Char VAR BYTE ctemp VAR WORD rand VAR WORD StringNumber VAR BYTE StartAddress VAR WORD isa VAR WORD lata.0=1 DEFINE DEBUG_REG PORTA DEFINE DEBUG_BIT 0 ; DEFINE DEBUG_BAUD 9600 DEFINE DEBUG_MODE 0 pause 2000 Debug "Start",13 ,10 Goto OverStrings ASM Strings; even length string terminates with a NULL, string cannot embed a null nor the eof chr chosen da "Set Year", 0 ; 0 da "Set Month" ; 1 da "Set Date", 0 ; 2 da "Set day of week" ; 3 da "Set Hour", 0 ; 4 da "Set Minute", 0 ; 5 ;lang 2 da "Jahr einstellen", 0 ;6+ 0 da "Set Month" ;6+ 1 da "Set Date", 0 ; 2 da "Set day of week" ; 3 da "Set Hour", 0 ; 4 da "Set Minute", 0 ; 5 lang 3 da "Definir l'annee", ; 12+ 0 da "Set Month" ; 12+ 1 da "Set Date", 0 ; 2 da "Set day of week" ; 3 da "Set Hour", 0 ; 4 da "Set Minute", 0 ; 5 dw 3 ;eof must not be in any string ENDASM OverStrings: Start: Debug "Program start",13,10 Debug "Address of first string: $", HEX4 Strings, 13 ,10 Action: for rand=0 to 5 StringNumber = rand + 0 ;0=en ,6 ge ,12 fr ' Select which language and string to print GOSUB findIndex GOSUB PrintString ' And, you guessed it, go print it. next PAUSE 1000 goto Action END findIndex: isa = Strings while StringNumber ReadCode isa, CTEMP isa=isa+1 if CTEMP ==3 then isa=0 return endif CTEMP=CTEMP&$7f if (CTEMP==0) then StringNumber=StringNumber-1 if StringNumber == 0 then return endif wend return PrintString: if isa then Debug 13,10,dec rand," " For i = 0 to 19 ' Maximum string length is 20 characters ReadCode (isa + i), CTEMP ' Get a char from string in question. Char = (CTEMP>>7) IF (Char = 0) THEN EXIT ' Break out if char is NULL Debug Char ' Otherwise print it Char = CTEMP&$7f IF (Char = 0) THEN EXIT ' Break out if char is NULL Debug Char ' Otherwise print it NEXT endif RETURN




Bookmarks