Picbasic -usart - interrupt - pic16f876

ho problemi a gestire l'interrupt sulla usart del pic16f876 con il picbasic, se uso il comando serin2, il programma non esce dalla subroutine dell'interrupt. qualcuno ha riscpntrato lo stesso problema? qualcuno ha qualche consiglio a darmi? grazie

Reply to
G.Paolo
Loading thread data ...

"G.Paolo" ha scritto nel messaggio news:47c86787$0$16025$ snipped-for-privacy@news.tiscali.it...

Puoi postare il codice per vedere se c'e' qualche errore?

Reply to
Enzo

il pic(16f876a) deve ricevere 2 cifre esadecimali dalla usart e in funzione della seconda cifra iviare un tono dtmf. il codice in PicBasic e':

DEFINE OSC 20

DEFINE HSER_RCSTA 90H DEFINE HSER_TXSTA 20H DEFINE HSER-BAUD 9600 DEFINE HSER_SPRG 25 DEFINE HSER_CLROERR 1 OPTION_REG.7 = 1 ;RCSTA.7 = 1 ;RCSTA.4 = 1

TAST VAR WORD TAST2 VAR WORD DATO var word dato = 0 TAST = 0 tast2 = 0 RCREG = 0 A1 VAR WORD TONO VAR PORTB.0 PTT VAR PORTC.3 RX var PORTC.7 TX VAR PORTC.4 su var word ON INTERRUPT GOTO INTERR INTCON = %11000000 PIE1 = %00100000 RCSTA = %10011000

OUTPUT TONO OUTPUT PTT INPUT RX OUTPUT TX LOW PTT LOW TONO

HIGH PTT DTMFOUT TONO,500,0,[2] ENABLE

INIZIO: IF TAST2 = 16 THEN HIGH PTT DTMFOUT TONO,10,0,[2] GOTO INIZIO ENDIF

IF TAST2 = 32 THEN HIGH PTT DTMFOUT TONO,10,0,[8] GOTO INIZIO ENDIF

...................... ......................

goto inizio

interr: DISABLE SERIN2 RX,84,100,INIZIO,[HEX TAST,HEX TAST2] resume INVIA enable

invia : SEROUT2 TX,84,["DATO = ", TAST, " - ",DEC TAST2, 10, 13]

GOTO INIZIO

END

grazie a chiunque voglia contribuire

"Enzo" ha scritto nel messaggio news:47ca7d7a$0$16040$ snipped-for-privacy@news.tiscali.it...

Reply to
G.Paolo

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.