;=============================================================================== ; Filename: freq_628.asm ; Date: 23/03/2004 ; File Version: 1.0 ; Orig. Files: Peter Halicky OM3CPH & Peter Halicky Jr., OM2PH ex OM2APH ; Rewrite: Vila Real para QRP BR ask from PY2RLM - RENATO ; Rielaborato per misure di periodi o impulsi positivi e negativi ;================================================================================ ; Notes: ; Remoção das rotinas de Lcd, inclusão da vdisplay.inc ; Correção da diretiva Radix ; Inclusão de pag. de memória ; Relocação de variáveis ; Recálculo de T1=241, T2=5, T3=46, T4=7, Z=2 p/ 20MHz ; T1=252, T2=11, T3=4, T4=2, Z=3 p/ 4MHz ;================================================================================ ;================================================================================ ;DIRETIVAS DE COMPILAÇÃO ;================================================================================ ; DEVICE PIC16C84, XT_OSC, WDT_OFF ; XTAL .4000000 ; include "Store:picprg/freq/p16f84a.inc" LIST P=16F84A ;list directive to define processor #INCLUDE ;processor specific variable definitions __IDLOCS 2003 ;dados a serem gravados na EEPROM ERRORLEVEL -302 ;suppress bank selection messages RADIX DEC ;set to decimal __CONFIG _CP_OFF&_PWRTE_ON&_WDT_OFF&_XT_OSC ;================================================================================= ;VARIABLE DEFINITIONS ;================================================================================= CBLOCK 20h ;endereço inicial p/ variáveis Count ;inkremental register Help ;dummy register Index ;dummy register Led0 Led1 Led2 Led3 Led4 Led5 Led6 Led7 lowB ;low byte of resulted frequency midB ;middle byte of resulted frequency higB ;high byte of resulted frequency lowR midR higR TMP ;temporary register indexH ;index register R1 ;Timing counters R2 R3 wTmp sTmp tmpReg ;devem permanecer no final delay0 ;pois ocupam 4 bytes delay1 DOT ; pozizione del punto decimale MUL ; prefisso per megahertx o kilohertz FNZ ; flag per la funzione scelta SW ; switch per misure d'impulsi ENDC ;================================================================================= ;PAGINAÇÃO DE MEMÓRIA ;================================================================================= #define BANK0 BCF STATUS, RP0 ;seta bank0 de memória #define BANK1 BSF STATUS, RP0 ;seta bank1 de memória #define jmpc btfss STATUS, C #define jmpnc btfsc STATUS, C #define jmpz btfss STATUS, Z #define jmpnz btfsc STATUS, Z #define DB4 PORTB, 7 #define DB5 PORTB, 6 #define DB6 PORTB, 5 #define DB7 PORTB, 4 #define Ena PORTA, 0 #define R_S PORTA, 1 #define fInput PORTA, 3 #define pInput PORTB, 0 #define tLed PORTB, 1 #define P1 PORTB, 2 #define P2 PORTB, 3 ;================================================================================= ;Timing Loop values ; QRP BR - AQUI SÃO OS AJUSTES ;================================================================================= T1 equ .11 ;first timing loop T2 equ .4 ;second timing loop T3 equ .235 ;third timing loop T4 equ .248 ;last timing loop ;================================================================================= ;Vetor de Reset ;================================================================================= org 000h movlw 1 movwf FNZ goto init nop org 004h ; gestione interrupt movwf wTmp swapf STATUS, w movwf sTmp BANK1 bsf OPTION_REG, T0CS ; TOCS=1 fermo conteggio BANK0 bcf INTCON, GIE bcf INTCON, INTE swapf sTmp, w movwf STATUS swapf wTmp, f swapf wTmp, w retfie ;================================================================================= ;Inicialização ;================================================================================= init clrf STATUS ;Do initialization, Select bank 0 clrf INTCON ;Clear int-flags, Disable interrupts clrf PORTA ;ALL PORT output should output Low. clrf PORTB clrf Index clrf lowB clrf midB clrf higB BANK1 movlw 00011000b ;RA0..RA3 outputs movwf TRISA ;RA4 input movlw 00001101b ;RB0..RB5 outputs, rest inputs movwf TRISB movlw 01100111b ;Prescaler -> TMR0, movwf OPTION_REG ;1:256, rising edge BANK0 ;================================================================================= ;Initialization of LCD display call lcdInit call lcdClear call getFunz ;================================================================================= goto showFreq ;================================================================================= ; Numeric routines ;================================================================================= ; 3 byte substraction of the constant from the table which sets carry if ; result is negative ;================================================================================= subC24 clrf TMP ;it will TEMPorary save C movf Index, w ;pointer to low byte of constant movwf indexH ;W -> indexH call decTable ;W returned with low byte of constant bsf STATUS, C ;set C subwf lowB, f ;lowB - W -> lowB jmpnc ;if underflow -> C=0 goto step1 bsf STATUS, C movlw 1 subwf midB, f ;decrement midB jmpnc ;if underflow -> C=0 goto step1 bsf STATUS, C movlw 1 subwf higB, f ;decrement higB jmpnc ;if underflow -> C=0 goto step1 bsf TMP, C ;set C step1 decf indexH, f movf indexH, w ;pointer to middle byte of const call decTable bsf STATUS, C subwf midB, f ;midB - W -> midB jmpnc ;if underflow -> C=0 goto step2 bsf STATUS, C movlw 1 subwf higB, f ;decrement higB jmpnc ;if underflow -> C=0 goto step2 bsf TMP, C ;set C step2 decf indexH, f movf indexH, w ;pointer to middle byte of constatnt call decTable bsf STATUS, C subwf higB, f ;higB - W -> higB jmpnc ;if underflow -> C=0 goto clarCf bsf STATUS, C goto subEnd clarCf rrf TMP, C ;C -> STATUS subEnd retlw 0 ;================================================================================= ; 3 byte addition of the constant from the table which sets carry if ; result overflows ;================================================================================= addC24 clrf TMP ;register for TEMPorary storage of C movf Index, w ;pointer to lower byte of const into W movwf indexH ;save it into indexH call decTable ;W contains low byte of const bcf STATUS, C ;clear C addwf lowB, f ;W + lowB -> lowB jmpc ;test overflow goto add2 incfsz midB, f goto add2 incfsz higB, f goto add2 bsf TMP, C ;store C add2 decf indexH, f ;pointer to middle byte into W movf indexH, w call decTable bcf STATUS, C addwf midB, f ;W + midB -> midB jmpc goto add3 incfsz higB, f goto add3 bsf TMP, C add3 decf indexH, f ;pointer to higher byte into W movf indexH, w call decTable bsf STATUS, C addwf higB, f ;W + higB -> higB, jmpc goto clearCf bsf STATUS, C goto addEnd clearCf rrf TMP, C ;C -> STATUS addEnd retlw 0 ;================================================================================= ;Tables for 3 byte constants ;Table of decades ;================================================================================= decTable addwf PCL, f ;W + PCL -> PCL retlw 0 ;10 retlw 0 ; retlw 00Ah ; retlw 0 ;100 retlw 0 ; retlw 064h ; retlw 0 ;1 000 retlw 003h ; retlw 0E8h ; retlw 0 ;10 000 retlw 027h ; retlw 010h ; retlw 001h ;100 000 retlw 086h ; retlw 0A0h ; retlw 00Fh ;1 000 000 retlw 042h ; retlw 040h ; retlw 098h ;10 000 000 retlw 096h ; retlw 080h ; ;================================================================================= ;Entry point for main cycle ;================================================================================= ;Routine for the conversion of 3 byte number into 7 decimal numbers ;================================================================================= hex2dec movlw 7*3-1 ;pointer to dec. table movwf Index ;6*3-1 -> Index movlw .9 movwf Count ;9 -> Count movlw Led7 ;Led6 -> W movwf FSR clrf INDF divide call subC24 ;substract untill result is negative, jmpnc ;add last substracted number goto add24 ;next digit incf INDF, f decf Count, f jmpz goto divide movlw 3 subwf Index, f goto next add24 call addC24 movlw 003h subwf Index, f next movlw .9 movwf Count decf FSR, f clrf INDF movlw 1 addwf Index, w jmpz goto divide movf lowB, w movwf Led0 ;the rest -> Led0 return ;================================================================================= ;registers Led0..Led6 are filled with values - ready to be displayed ;================================================================================= showFreq clrf PORTA BANK1 movlw 01100111b ;Prescaler -> TMR0, movwf OPTION_REG ;1:256, rising edge BANK0 call hex2dec movlw 10000000b ;Locate LCD cursor on row 1, col 0 call sendCmd movlw ' ' call sendChar movlw Led6 movwf FSR movlw 'M' movwf MUL movlw .2 movwf DOT movf Led6, w ;freq. >= 1 MHz ? addwf Led5, w jmpz goto oInit ; si movlw .5 ; no movwf DOT ; setto per frequenza in KHz movlw 'K' movwf MUL oInit movlw .1 ; routine che elimina gli zeri iniziali subwf DOT, w jmpnz goto ledCycle movf INDF, w jmpz goto ledCycle movlw ' ' call sendChar decf FSR, f decf DOT, f goto oInit ledCycle movf INDF, w ;LED(0..6) -> W iorlw 030h call sendChar ;Display character decfsz DOT, f goto noDot movlw '.' ;this can be ' ' or ', ' ...... call sendChar ;Display character noDot movf FSR, w sublw Led0 jmpnz goto cycleEnd decf FSR, f goto ledCycle ;continue with next number cycleEnd movlw '0' call sendChar movlw ' ' call sendChar ;Display character movf MUL, w call sendChar ;Display character movlw 'H' call sendChar ;Display character movlw 'z' call sendChar ;Display character btfsc P1 goto newMisura loopP1 movlw .10 ;se P1 premuto salto a scelta funzione call lcdDelay btfsc P1 goto getFunz goto loopP1 ;================================================================================= ;It is time to prepare new measuring cycle ;================================================================================= newMisura clrf higB clrf TMR0 nop ;it is SUGGESTED... nop movlw T1 ;set initial counter values movwf R1 movlw T2 movwf R2 movlw T3 movwf R3 clrf INTCON ;global INT disable, TMR0 INT disable ;clear TMR0 overflow bite ;================================================================================= ;start measurement: RA3 + RA4 set input ;================================================================================= movlw 00010000b ;all ports set L, RA4 set H movwf PORTA BANK1 movlw 00011000b ;RA0..RA4 input movwf TRISA BANK0 ;================================================================================= ;It is opened now... ;================================================================================= Cycle btfss INTCON, T0IF ;1 Test for TMR0 overflow goto nothing ;3 incf higB, f ;3 bcf INTCON, T0IF ;4 goto nxt ;6 nothing nop ;4 nop ;5 nop ;6 nxt decfsz R1, f ;7 goto Cycle ;9 movlw T1 ;9*T1 movwf R1 ;9*T1+1 decfsz R2, f ;9*T1+2 goto Cycle ;9*T1+4 movlw T2 ;9*T1+4)*T2 movwf R2 ;(9*T1+4)*T2+1 decfsz R3, f ;(9*T1+4)*T2+2 goto Cycle ;(9*T1+4)*T2+4 ;================================================================================= ;Final test for TMR0 overflow ;================================================================================= movlw T4 ;((9*T1+4)*T2+4)*T3 movwf Help ;((9*T1+4)*T2+4)*T3+1 cycle2 btfss INTCON, T0IF ;1 goto not2Do ;3 incf higB, f ;3 bcf INTCON, T0IF ;4 goto nx ;6 not2Do nop ;4 nop ;5 nop ;6 nx decfsz Help, f ;7 goto cycle2 ;9 nop ;((9*T1+4)*T2+4)*T3+1+9*T4+Z ;================================================================================= ; Z times fine tuning nops ;altere aqui os nop para calibrar, nop ;aumentando ou diminuindo. nop nop ;================================================================================= ; Stop the measurement ;================================================================================= clrw ;1 movwf PORTB ;2 movlw 00010000b ;3 RA0..RA3 = 0 movwf PORTA ;4 W -> PORTA ;((9*T1+4)*T2+4)*T3+1+9*T4+Z+4 BANK1 movlw 00010000b ;RA3 output movwf TRISA ;RA0..RA2, RA4 input BANK0 ;================================================================================= ; Analyse precounter and store counted value in registers ;================================================================================= movf TMR0, w movwf midB ;TMR0 -> midB clrf lowB countIt decf lowB, f bsf fInput ; _| false impulz bcf fInput ; |_ bcf INTCON, T0IF movf TMR0, w ;actual TMR0 -> W bcf STATUS, Z subwf midB, w jmpnz goto countIt goto showFreq ;start new cycle ;================================================================================ ;Rotina de retardo, onde w=tempo em ms - clock=20MHz ;================================================================================= lcdDelay movwf delay1 ;duas variáveis em uma clrf delay0 delayLoop nop decfsz delay0, f ;dec. o prim. cont. goto delayLoop decfsz delay1, f ;dec. o seg. cont. goto delayLoop return ;================================================================================= ;Rotinas de controle do LCD ;================================================================================= lcdInit movlw .30 ;Wait 30 ms call lcdDelay bcf R_S ;Set LCD command mode bsf DB4 ;0011->48 bsf DB5 bcf DB6 bcf DB7 call lcdPulse_E ;sequência de reset call lcdPulse_E call lcdPulse_E bcf DB4 ;0010->32 bsf DB5 bcf DB6 bcf DB7 call lcdPulse_E movlw 00101000b ;Set 4 bit data bus length ***** call sendCmd movlw 00000110b ;Entry mode set, increment, no shift call sendCmd movlw 00001100b ;Display ON, Curson OFF, Blink OFF call sendCmd lcdClear movlw 00000001b call sendCmd movlw .2 ;Wait 2 ms call lcdDelay movlw 11000000b call sendCmd return sendChar bsf R_S goto sendByte sendCmd bcf R_S sendByte movwf tmpReg ;Send a byte to LCD by 4 bit data bus bcf DB4 ;Send highter four bits bcf DB5 bcf DB6 bcf DB7 btfsc tmpReg, 4 bsf DB4 btfsc tmpReg, 5 bsf DB5 btfsc tmpReg, 6 bsf DB6 btfsc tmpReg, 7 bsf DB7 call lcdPulse_E bcf DB4 ;Send lower four bits bcf DB5 bcf DB6 bcf DB7 btfsc tmpReg, 0 bsf DB4 btfsc tmpReg, 1 bsf DB5 btfsc tmpReg, 2 bsf DB6 btfsc tmpReg, 3 bsf DB7 lcdPulse_E bsf Ena ;Enables LCD movlw 1 ;Wait 1ms call lcdDelay bcf Ena ;Disabled LCD movlw 1 ;Wait 1ms call lcdDelay return ;=============================================================================== ; show string frequenza ;=============================================================================== freqStr movlw 11000000b call sendCmd movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw 'f' call sendChar movlw 'r' call sendChar movlw 'e' call sendChar movlw 'q' call sendChar movlw 'u' call sendChar movlw 'e' call sendChar movlw 'n' call sendChar movlw 'z' call sendChar movlw 'a' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar return ;=============================================================================== ; iPerMils inizializza per la misura del periodo in millisecondi ;=============================================================================== iPerMils BANK1 movlw 00010000b movwf TRISA movlw 01000001b ; pullup=on, INTEDG=on, prescaler=1:8 movwf OPTION_REG BANK0 clrf SW ; switch none goto tMils ;=============================================================================== ; iPerMics inizializza per la misura del periodo in microsecondi ;=============================================================================== iPerMics BANK1 movlw 00010000b movwf TRISA movlw 01000111b movwf OPTION_REG BANK0 clrf SW goto tMics ;=============================================================================== ; iPulMics inizializza per la misura di impulsi in microsecondi ;=============================================================================== iPulMics BANK1 movlw 00010000b movwf TRISA movlw 01000111b btfss FNZ, 3 movlw 00000111b movwf OPTION_REG BANK0 clrf SW bsf SW, INTEDG goto tMics ;=============================================================================== ; iPulMils inizializza per la misura di impulsi in millisecondi ;=============================================================================== iPulMils BANK1 movlw 00010000b movwf TRISA movlw 01000001b btfss FNZ, 4 movlw 00000001b movwf OPTION_REG BANK0 clrf SW bsf SW, INTEDG goto tMils ;=============================================================================== ; tMics misura del tempo in microsecondi ;=============================================================================== tMics call waitStr clrf lowB clrf midB clrf higB movlw .2 movwf DOT bcf INTCON, INTF tMics0 btfss INTCON, INTF goto tMics0 bcf INTCON, INTF bcf INTCON, T0IF bsf INTCON, GIE ; abilito interrupt generele bsf INTCON, INTE ; abilito interrupt RB0 clrf TMR0 BANK1 movf SW, w xorwf OPTION_REG, f ; inverto senso di transizione per pulse BANK0 tMics1 btfsc INTCON, INTF goto endMics btfss INTCON, T0IF goto tMics1 bcf INTCON, T0IF bcf tLed btfss higB, 2 bsf tLed incfsz higB, f goto tMics1 goto overStr endMics movf TMR0, w movwf midB countMics decf lowB, f bsf fInput ; _| false impulz bcf fInput ; |_ movf TMR0, w ; actual TMR0 -> W bcf STATUS, Z subwf midB, w ; sub to previous TMR0 jmpnz goto countMics bcf tLed call hex2dec goto showTime ;=============================================================================== ; tMils misura del tempo in millisecondi ;=============================================================================== tMils call waitStr clrf lowB clrf midB clrf higB clrf lowR clrf midR clrf Help movlw .5 movwf DOT bcf INTCON, INTF tMils0 btfss INTCON, INTF goto tMils0 bcf INTCON, INTF bcf INTCON, T0IF bsf INTCON, GIE ; abilito interrupt generele bsf INTCON, INTE ; abilito interrupt RB0 clrf TMR0 BANK1 movf SW, w xorwf OPTION_REG, f ; cambio senso di transizione per pulse BANK0 tMils1 btfsc INTCON, INTF goto endMils btfss INTCON, T0IF goto tMils1 bcf INTCON, T0IF bcf tLed btfsc midB, 0 bsf tLed movlw 018h addwf lowR, f jmpnc incf midR, f incMils incfsz lowB, f goto addMils incfsz midB, f goto addMils incfsz higB, f goto addMils goto overStr addMils btfss midR, 2 goto tMils1 movlw 0E8h subwf lowR, f ; quando midR=4 lowR è senz'altro clrf midR ; inferiore a 0E8h quindi clrf midR goto incMils endMils clrf Help bcf STATUS, C rlf TMR0, f rlf Help, f rlf TMR0, f rlf Help, w addwf midR, f movf TMR0, w addwf lowR, f jmpnc incf midR, f clrf TMR0 ; per interrompere la reiterazione movlw .3 subwf midR, f jmpnc goto incMils ; se midR >= 3 incremento conteggio endMils0 movf lowB, w movwf lowR movf midB, w movwf midR movf higB, w movwf higR call hex2dec clrf indexH clrf Index goto div10k mil2sec incfsz Index, f ; divide per 10000 per ottenere il goto div10k ; multiplo delle decine di secondi incfsz indexH, f ; che viene salvato in Index e indexH div10k bcf Help, 0 movlw 010h subwf lowR, f jmpc bsf Help, 0 movlw 027h ; se non c'è riporto btfsc Help, 0 movlw 028h ; se c'è riporto subwf midR, f jmpnc goto mil2sec movlw .1 ; c'è stato un riporto subwf higR, f jmpnc goto mil2sec ; se non c'è riporto ripeti clrf lowR clrf midR goto div06 div6 incfsz lowR, f ; per avere il totale dei minuti goto div06 ; salvato in lowR e midR incf midR, f div06 movlw .6 subwf Index, f jmpnc goto div6 movlw .1 subwf indexH, f jmpnc goto div6 movlw .6 addwf Index, w ; ed il modulo della divisione movwf Led4 ; equivale alle decine di secondi clrf Led7 goto div60 + 1 div60 incf Led7, f ; divido per 60 ed ottengo le ore movlw .60 subwf lowR, f jmpnc goto div60 movlw .1 subwf midR, f jmpnc goto div60 movlw .60 ; ed il modulo della divisione addwf lowR, f ; sono i minuti clrf Led6 goto div10 + 1 div10 incf Led6, f ; divido per 10 ed ottengo movlw .10 ; le decine di minuti subwf lowR, f jmpnc goto div10 movlw .10 ; ed il modulo equivale addwf lowR, w ; alle unità dei minuti movwf Led5 bcf tLed ; call hex2dec goto showTime ;=============================================================================== ; showTime visualizza il tempo misurato eliminando gli zeri iniziali ;=============================================================================== showTime movlw 10000000b ; mostra il tempo misurato call sendCmd movlw Led7 movwf FSR movf FNZ, w andlw 01010100b jmpz goto zInit movlw ' ' call sendChar zInit movlw .1 ; routine che elimina gli zeri iniziali subwf DOT, w jmpnz goto lcdCycle movf INDF, w jmpz goto lcdCycle movlw ' ' call sendChar decf FSR, f decf DOT, f goto zInit lcdCycle movf INDF, w ; LED(0..7) -> W iorlw 030h call sendChar ; Display character decfsz DOT, f goto dotNo movlw '.' ; this can be ' ' or ', ' ...... call sendChar ; Display character dotNo movf DOT, w sublw .4 jmpz goto dotNo0 movlw 'h' call sendChar dotNo0 movf DOT, w sublw .2 jmpz goto dotNo1 movlw 'm' call sendChar dotNo1 movf FSR, w sublw Led0 jmpnz goto endCycle decf FSR, f goto lcdCycle ;continue with next number endCycle movlw ' ' call sendChar movlw 's' call sendChar movlw 'e' call sendChar movlw 'c' call sendChar movlw '.' call sendChar loop0 btfsc P2 ; se P2 premuto ripete goto loop1 ; la misura precedente movlw .10 call lcdDelay btfss P2 goto loop0 btfsc FNZ, 1 goto iPerMics btfsc FNZ, 2 goto iPerMils btfss FNZ, 3 btfsc FNZ, 5 goto iPulMics btfss FNZ, 4 btfsc FNZ, 6 goto iPulMils loop1 btfsc P1 ; se P1 premuto ritorna alla goto loop0 ; scelta funzione movlw .10 ; ritardo antirimbalzo call lcdDelay btfsc P1 goto getFunz goto loop1 ;=============================================================================== ; getFunz permette di sceglie tra le varie funzioni disponibili ;=============================================================================== getFunz call lcdClear ; gestione scelta funzione loopPuls btfss P1 call gestP1 btfsc FNZ, 0 call freqStr btfss FNZ, 1 btfsc FNZ, 2 call perStr movf FNZ, w andlw 00000111b jmpnz call pulStr btfsc P2 ; la pressione di P2 avvia goto loopPuls ; la funzione prescelta btfsc FNZ, 0 goto showFreq btfsc FNZ, 1 goto iPerMics btfsc FNZ, 2 goto iPerMils btfss FNZ, 3 btfsc FNZ, 5 goto iPulMics btfss FNZ, 4 btfsc FNZ, 6 goto iPulMils goto loopPuls ;=============================================================================== ; gestP1 con la pressione del pulsante si passa da una funzione all'altra ;=============================================================================== gestP1 movlw .10 ; cambio funzione call lcdDelay btfss P1 goto gestP1 bcf STATUS, C rlf FNZ, f btfss FNZ, 7 return clrf FNZ bsf FNZ, 0 return ;=============================================================================== ; waitStr visualizza la stringa Wait ;=============================================================================== waitStr movlw 10000000b call sendCmd movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw '*' call sendChar movlw 'W' call sendChar movlw 'a' call sendChar movlw 'i' call sendChar movlw 't' call sendChar movlw '*' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar return ;=============================================================================== ; perStr mostra la stringa seguita dall'unità di misura scelta ;=============================================================================== perStr movlw 11000000b ; cursore riga 2 colonna 1 call sendCmd movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw 'p' call sendChar movlw 'e' call sendChar movlw 'r' call sendChar movlw 'i' call sendChar movlw 'o' call sendChar movlw 'd' call sendChar movlw 'o' call sendChar movlw ' ' call sendChar movlw 11100100b ; simbolo del micro btfsc FNZ, 2 movlw 'm' call sendChar movlw 's' call sendChar movlw ' ' call sendChar return ;=============================================================================== ; pulStr mostra la stringa seguita dal segno e unità di misura scelta ;=============================================================================== pulStr movlw 11000000b ; cursore alla riga 2 colonna 1 call sendCmd movlw ' ' call sendChar movlw ' ' call sendChar movlw 's' call sendChar movlw 'e' call sendChar movlw 'm' call sendChar movlw 'i' call sendChar movlw 'p' call sendChar movlw 'e' call sendChar movlw 'r' call sendChar movlw '.' call sendChar movlw '-' btfss FNZ, 3 btfsc FNZ, 4 movlw 00101011b call sendChar movlw ' ' call sendChar movlw 11100100b ; simbolo del micro btfss FNZ, 4 btfsc FNZ, 6 movlw 'm' call sendChar movlw 's' call sendChar return ;=============================================================================== ; overStr mostra la stringa in caso di fuori campo ;=============================================================================== overStr movlw 10000000b ; cursore alla riga 1 colonna 1 call sendCmd movlw ' ' call sendChar movlw ' ' call sendChar movlw ' ' call sendChar movlw '*' call sendChar movlw 'o' call sendChar movlw 'v' call sendChar movlw 'e' call sendChar movlw 'r' call sendChar movlw 'f' call sendChar movlw 'l' call sendChar movlw 'o' call sendChar movlw 'w' call sendChar movlw '*' call sendChar ovLoop btfsc P1 goto ovLoop movlw .10 ; ritardo antirimbalzo call lcdDelay btfsc P1 goto getFunz goto ovLoop END