Futura Sciences
Image de la rubrique en cours

Forum FS Generation

Précédent   Vous êtes ici : Forum FS Generation » Futura Technique » Électronique

Découvrir d'autres sujets sur ces thèmes :


Réponse
Vieux 03/06/2007, 05h29   Sujet 16f84 à 16f877 - Message #1
sdow
 
Date d'inscription: avril 2005
Messages: 290
16f84 à 16f877
salut

est ce que vous pouvez m'aider à adapter ce code à 16f877.

Code:
RESET_V EQU 0x0000 ; Address of RESET Vector ISR_V EQU 0x0004 ; Address of Interrupt Vector OSC_FREQ EQU D'4000000' ; Oscillator Frequency is 4 MHz LCD_DATA EQU PORTB ; LCD data lines interface LCD_DATA_TRIS EQU TRISB LCD_CTRL EQU PORTA ; LCD control lines interface LCD_LINE0 EQU 0x000 LCD_LINE1 EQU 0x040 LCD_LINE2 EQU 0x014 LCD_LINE3 EQU 0x054 ; PORTA bits LCD_E EQU 2 ; LCD Enable control line LCD_RW EQU 1 ; LCD Read/Write control line LCD_RS EQU 0 ; LCD Register-Select control line ; PORTB bits DB7 EQU 7 ; LCD dataline 7 (MSB) DB6 EQU 6 ; LCD dataline 6 DB5 EQU 5 ; LCD dataline 5 DB4 EQU 4 ; LCD dataline 4 DB3 EQU 3 ; LCD dataline 3 DB2 EQU 2 ; LCD dataline 2 DB1 EQU 1 ; LCD dataline 1 DB0 EQU 0 ; LCD dataline 0 (LSB) ; misc. LCD_TEMP EQU 0x020 ; LCD subroutines internal use TABLE_INDEX EQU 0x021 ; Index to table strings COUNT EQU 0x022 ; A counter DELAY equ 0x023 ; Used in DELAYxxx routines X_DELAY equ 0x024 ; Used in X_DELAYxxx routines ORG 0x000 ; processor reset vector nop ; nop required for icd goto START ; go to beginning of program TABLE_MSG MOVLW 0 ; Startindex of table message DISP_MSG MOVWF TABLE_INDEX ; Holds message address CALL MSG1 ANDLW 0x0FF ; Check if at end of message BTFSC STATUS, Z ; (zero returned at end) GOTO TABLE_MSG_END CALL LCDPUTCHAR ; Display character MOVF TABLE_INDEX, W ; Point to next character ADDLW 1 GOTO DISP_MSG TABLE_MSG_END RETURN TABLE_MSG1 MOVLW 0 ; Startindex of table message DISP_MSG1 MOVWF TABLE_INDEX ; Holds message address CALL MSG2 ANDLW 0x0FF ; Check if at end of message BTFSC STATUS, Z ; (zero returned at end) GOTO TABLE_MSG_END1 CALL LCDPUTCHAR ; Display character MOVF TABLE_INDEX, W ; Point to next character ADDLW 1 GOTO DISP_MSG1 TABLE_MSG_END1 RETURN TABLE_MSG2 MOVLW 0 ; Startindex of table message DISP_MSG2 MOVWF TABLE_INDEX ; Holds message address CALL MSG3 ANDLW 0x0FF ; Check if at end of message BTFSC STATUS, Z ; (zero returned at end) GOTO TABLE_MSG_END2 CALL LCDPUTCHAR ; Display character MOVF TABLE_INDEX, W ; Point to next character ADDLW 1 GOTO DISP_MSG2 TABLE_MSG_END2 RETURN TABLE_MSG3 MOVLW 0 ; Startindex of table message DISP_MSG3 MOVWF TABLE_INDEX ; Holds message address CALL MSG1 ANDLW 0x0FF ; Check if at end of message BTFSC STATUS, Z ; (zero returned at end) GOTO TABLE_MSG_END3 CALL LCDPUTCHAR ; Display character MOVF TABLE_INDEX, W ; Point to next character ADDLW 1 GOTO DISP_MSG3 TABLE_MSG_END3 RETURN TABLE_VIT MOVLW 0 ; Startindex of table message VIT MOVWF TABLE_INDEX ; Holds message address CALL MSG5 ANDLW 0x0FF ; Check if at end of message BTFSC STATUS, Z ; (zero returned at end) GOTO TABLE_VIT_END3 CALL LCDPUTCHAR ; Display character MOVF TABLE_INDEX, W ; Point to next character ADDLW 1 GOTO VIT TABLE_VIT_END3 RETURN ;========================================================= ; LCDINIT ; Initilize LC-Display Module ; Should be modified to your needs (i.e. display type, cursor on/off, etc.) ; OK ;========================================================= LCDINIT ; Busy-flag is not yet valid CLRF LCD_CTRL ; ALL PORT output should output Low. ; power-up delay MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS ; Busy Flag should be valid from here MOVLW 0x038 ; 8-bit-interface, 2-lines CALL LCDPUTCMD MOVLW 0x000 ; disp.off, curs.off, no-blink CALL LCDDMODE CALL LCDCLEAR MOVLW 0x004 ; disp.on, curs.off CALL LCDDMODE MOVLW 0x002 ; auto-inc (shift-cursor) CALL LCDEMODE RETURN ;========================================================= ; LCD_ENABLE ; Pulses LCD enable pin ; OK ;========================================================= LCD_ENABLE BSF LCD_CTRL, LCD_E ; LCD E-line High BCF LCD_CTRL, LCD_E ; LCD E-line Low RETURN ;========================================================= ; LCDBUSY ; Returns when LCD busy-flag is inactive ; OK ;========================================================= LCDBUSY BSF STATUS,RP0 ; Select Register page 1 MOVLW 0x0FF ; Set PORTB for input MOVWF LCD_DATA_TRIS BCF STATUS, RP0 ; Select Register page 0 BCF LCD_CTRL, LCD_RS; Set LCD for command mode BSF LCD_CTRL, LCD_RW; Setup to read busy flag BSF LCD_CTRL, LCD_E ; LCD E-line High MOVF LCD_DATA, W ; Read busy flag + DDram address BCF LCD_CTRL, LCD_E ; LCD E-line Low ANDLW 0x80 ; Check Busy flag, High = Busy BTFSS STATUS, Z GOTO LCDBUSY LCDNOTBUSY BCF LCD_CTRL, LCD_RW BSF STATUS, RP0 ; Select Register page 1 MOVLW 0x000 MOVWF LCD_DATA_TRIS ; Set PORTB for output BCF STATUS, RP0 ; Select Register page 0 RETURN ;========================================================= ; LCDCLEAR ; Clears display and returns cursor to home position (upper-left corner). ; ;========================================================= LCDCLEAR MOVLW 0x001 CALL LCDPUTCMD RETURN ;========================================================= ; LCDHOME ; Returns cursor to home position. ; Returns display to original position (when shifted). ; ;========================================================= LCDHOME MOVLW 0x002 CALL LCDPUTCMD RETURN ;========================================================= ; LCDEMODE ; Sets entry mode of display. ; Required entry mode must be set in W ; b0 : 0 = no display shift 1 = display shift ; b1 : 0 = auto-decrement 1 = auto-increment ; b2-7 : don't care ; OK ;========================================================= LCDEMODE ANDLW 0x003 ; Strip upper bits IORLW 0x004 ; Function set CALL LCDPUTCMD RETURN ;========================================================= ; LCDDMODE ; Sets display control. ; Required display mode must be set in W ; b0 : 0 = cursor blink off 1 = cursor blink on ; b1 : 0 = cursor off 1 = cursor on ; b2 : 0 = display off 1 = display on (display data remains in DDRAM) ; b3-7 : don't care ; OK ;========================================================= LCDDMODE ANDLW 0x007 ; Strip upper bits IORLW 0x008 ; Function set CALL LCDPUTCMD RETURN ;========================================================= ; LCDSCGA ; Sets Character-Generator-RAM address. CGRAM is read/written after ; this setting. ; Required CGRAM address must be set in W ; b0-5 : required CGRAM address ; b6-7 : don't care ; ;========================================================= LCDSCGA ANDLW 0x03F ; Strip upper bits IORLW 0x040 ; Function set CALL LCDPUTCMD RETURN ;========================================================= ; LCDSDDA ; Sets the Display-Data-RAM address. DDRAM data is read/written after ; this setting. ; Required DDRAM address must be set in W ; b0-6 : required DDRAM address ; b7 : don't care ; OK ;========================================================= LCDSDDA IORLW 0x080 ; Function set CALL LCDPUTCMD RETURN ;========================================================= ; LCDGADDR ; Returns address counter contents, used for both DDRAM and CGRAM. ; RAM address is returned in W ; ;========================================================= LCDGADDR BSF STATUS,RP0 ; Select Register page 1 MOVLW 0x0FF ; Set PORTB for input MOVWF LCD_DATA_TRIS BCF STATUS, RP0 ; Select Register page 0 BCF LCD_CTRL, LCD_RS; Set LCD for command mode BSF LCD_CTRL, LCD_RW; Setup to read busy flag BSF LCD_CTRL, LCD_E ; LCD E-line High MOVF LCD_DATA, W ; Read busy flag + RAM address BCF LCD_CTRL, LCD_E ; LCD E-line Low ANDLW 0x07F ; Strip upper bit BCF LCD_CTRL, LCD_RW BSF STATUS, RP0 ; Select Register page 1 MOVLW 0x000 MOVWF LCD_DATA_TRIS ; Set PORTB for output BCF STATUS, RP0 ; Select Register page 0 RETURN ;========================================================= ; LCDPUTCHAR ; Sends character to LCD ; Required character must be in W ; OK ;========================================================= LCDPUTCHAR MOVWF LCD_TEMP ; Character to be sent is in W CALL LCDBUSY ; Wait for LCD to be ready BCF LCD_CTRL, LCD_RW; Set LCD in read mode BSF LCD_CTRL, LCD_RS; Set LCD in data mode BSF LCD_CTRL, LCD_E ; LCD E-line High MOVF LCD_TEMP, W MOVWF LCD_DATA ; Send data to LCD BCF LCD_CTRL, LCD_E ; LCD E-line Low RETURN ;========================================================= ; LCDPUTCMD ; Sends command to LCD ; Required command must be in W ; OK ;========================================================= LCDPUTCMD MOVWF LCD_TEMP ; Command to be sent is in W CALL LCDBUSY ; Wait for LCD to be ready BCF LCD_CTRL, LCD_RW; Set LCD in read mode BCF LCD_CTRL, LCD_RS; Set LCD in command mode BSF LCD_CTRL, LCD_E ; LCD E-line High MOVF LCD_TEMP, W MOVWF LCD_DATA ; Send data to LCD BCF LCD_CTRL, LCD_E ; LCD E-line Low RETURN ;********************************************************* ; Delay_time = ((DELAY_value * 3) + 4) * Cycle_time ; DELAY_value = (Delay_time - (4 * Cycle_time)) / (3 * Cycle_time) ; ; i.e. (@ 4MHz crystal) ; Delay_time = ((32 * 3) + 4) * 1uSec ; = 100uSec ; DELAY_value = (500uSec - 4) / 3 ; = 165.33 ; = 165 ;********************************************************* DELAY500 MOVLW D'165' ; +1 1 cycle MOVWF DELAY ; +2 1 cycle DELAY500_LOOP DECFSZ DELAY, F ; step 1 1 cycle GOTO DELAY500_LOOP ; step 2 2 cycles DELAY500_END RETURN ; +3 2 cycles ; ; X_DELAY500 MOVWF X_DELAY ; +1 1 cycle X_DELAY500_LOOP CALL DELAY500 ; step1 wait 500uSec DECFSZ X_DELAY, F ; step2 1 cycle GOTO X_DELAY500_LOOP ; step3 2 cycles X_DELAY500_END RETURN ; +2 2 cycles ;========================================================= ; Table message to display ;========================================================= MSG1 addwf PCL ,F ;Jump to char pointed to in W reg retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' retlw '+' MSG1_END retlw 0 ; IF ( (MSG1 & 0x0FF) >= (MSG1_END & 0x0FF) ) MESSG "Warning - User Definded: Table 'MSG1' crosses page boundry in computed jump" ENDIF return MSG2 addwf PCL ,F ;Jump to char pointed to in W reg retlw '+' retlw ' ' retlw ' ' retlw ' ' retlw 'R' retlw 'O' retlw 'B' retlw 'O' retlw 'T' retlw 'O' retlw 'S' retlw ' ' retlw ' ' retlw '.' retlw ' ' retlw ' ' retlw ' ' retlw ' ' retlw ' ' MSG2_END retlw 0 ; IF ( (MSG2 & 0x0FF) >= (MSG2_END & 0x0FF) ) MESSG "Warning - User Definded: Table 'MSG1' crosses page boundry in computed jump" ENDIF return MSG3 addwf PCL ,F ;Jump to char pointed to in W reg retlw '+' retlw ' ' retlw ' ' retlw 'F' retlw '4' retlw ' ' retlw 'p' retlw 'o' retlw 'u' retlw 'r' retlw ' ' retlw 'E' retlw 'N' retlw 'T' retlw 'R' retlw 'E' retlw 'R' retlw ' ' retlw ' ' MSG3_END retlw 0 ; IF ( (MSG3 & 0x0FF) >= (MSG3_END & 0x0FF) ) MESSG "Warning - User Definded: Table 'MSG1' crosses page boundry in computed jump" ENDIF return MSG5 addwf PCL ,F ;Jump to char pointed to in W reg retlw 'L' retlw 'a' retlw ' ' retlw 'V' retlw 'i' retlw 't' retlw 'e' retlw 's' retlw 's' retlw 'e' retlw ' ' retlw 'e' retlw 's' retlw 't' retlw ':' retlw ' ' retlw ' ' retlw ' ' retlw ' ' MSG5_END retlw 0 ; IF ( (MSG5 & 0x0FF) >= (MSG5_END & 0x0FF) ) MESSG "Warning - User Definded: Table 'MSG1' crosses page boundry in computed jump" ENDIF return INDEX call LCDCLEAR MOVLW '+' ; ASCII '0' MOVWF COUNT MOVLW LCD_LINE0 CALL LCDSDDA ; Position cursor leftmost on first line CALL TABLE_MSG ; Display message MOVLW LCD_LINE0 + 0x013 CALL LCDSDDA ; Position cursor MOVF COUNT, W CALL LCDPUTCHAR ; Display line number MOVLW '+' ; ASCII '0' MOVWF COUNT MOVLW LCD_LINE1 CALL LCDSDDA ; Position cursor leftmost on first line CALL TABLE_MSG1 ; Display message MOVLW LCD_LINE1 + 0x013 CALL LCDSDDA ; Position cursor MOVF COUNT, W CALL LCDPUTCHAR ; Display line number MOVLW '+' ; ASCII '0' MOVWF COUNT MOVLW LCD_LINE2 CALL LCDSDDA ; Position cursor leftmost on first line CALL TABLE_MSG2 ; Display message MOVLW LCD_LINE2 + 0x013 CALL LCDSDDA ; Position cursor MOVF COUNT, W CALL LCDPUTCHAR ; Display line number MOVLW '+' ; ASCII '0' MOVWF COUNT MOVLW LCD_LINE3 CALL LCDSDDA ; Position cursor leftmost on first line CALL TABLE_MSG3 ; Display message MOVLW LCD_LINE3 + 0x013 CALL LCDSDDA ; Position cursor MOVF COUNT, W CALL LCDPUTCHAR ; Display line number RETURN VITESSE CALL LCDCLEAR MOVLW ' ' ; ASCII '0' MOVWF COUNT MOVLW LCD_LINE0 CALL LCDSDDA ; Position cursor leftmost on first line CALL TABLE_MSG1 ; Display message MOVLW LCD_LINE0 + 0x013 CALL LCDSDDA ; Position cursor MOVF COUNT, W CALL LCDPUTCHAR ; Display line number MOVLW ' ' ; ASCII '0' MOVWF COUNT MOVLW LCD_LINE2 CALL LCDSDDA ; Position cursor leftmost on first line CALL TABLE_VIT ; Display message MOVLW LCD_LINE2 + 0x013 CALL LCDSDDA ; Position cursor MOVF COUNT, W CALL LCDPUTCHAR ; Display line number RETURN Niveau step1 call DELAY500 btfss PORTA,3 goto step1 step2 call DELAY500 btfsc PORTA,3 goto step2 step3 call DELAY500 btfss PORTA,3 goto step3 return ;***************************************************************************** ; Initialize processor registers ;***************************************************************************** START ; POWER_ON Reset (Beginning of program) CLRF STATUS ; Do initialization, Select bank 0 CLRF INTCON ; Clear int-flags, Disable interrupts CLRF PCLATH ; Keep in lower 2KByte CLRF PORTA ; ALL PORT output should output Low. CLRF PORTB BSF STATUS, RP0 ; Select bank 1 MOVLW 0x0F8 ; RA2-0 outputs, RA4-3 inputs MOVWF TRISA MOVLW 0x000 ; RB7-0 outputs MOVWF TRISB BSF OPTION_REG, NOT_RBPU ; Disable PORTB pull-ups BCF STATUS, RP0 ; Select bank 0 CALL LCDINIT ; Initialize LCDisplay loop CALL INDEX call Niveau call VITESSE call Niveau goto loop END
sdow est déconnecté   Réponse avec citation
Alt Aujourd'hui
Publicité

Beitrag Liens sponsorisés

   
Vieux 03/06/2007, 15h45   Sujet 16f84 à 16f877 - Message #2
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
Salut,

Il manque les 3/4 du programme...

Sinon, pour la partie du code que tu présentes dans le post #1, il n'y a rien à changer pour passer du 16F84 au 16f877.

David.
DavidDB est déconnecté   Réponse avec citation
Vieux 03/06/2007, 17h00   Sujet 16f84 à 16f877 - Message #3
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
salut le code que je te présente ici fonction très bien avec 16f84

mais pas avec 877
sdow est déconnecté   Réponse avec citation
Vieux 03/06/2007, 17h11   Sujet 16f84 à 16f877 - Message #4
freepicbasic
 
Date d'inscription: août 2006
Localisation: France
Âge: 52
Messages: 1 795
Re : 16f84 à 16f877
Voir la page 29 du datasheet
pour mettre toute les pins du portA en digital
Code:
movlw 6 movwf ADCON1
__________________
A+, pat
freepicbasic est connecté maintenant   Réponse avec citation
Vieux 03/06/2007, 17h16   Sujet 16f84 à 16f877 - Message #5
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
Dans "START",

Il faut invalider les entrées analoqiques du 16f877 présentent sur le portA, qui n'existe pas sur le 16F84.

David.

Edit : pas vu la réponse de pat...

Dernière modification par DavidDB 03/06/2007 à 17h20. Motif: trop lent...
DavidDB est déconnecté   Réponse avec citation
Vieux 03/06/2007, 18h56   Sujet 16f84 à 16f877 - Message #6
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
dans le start je met

movlw 6
movwf ADCON1

mais ça ne fonctionne pas
sdow est déconnecté   Réponse avec citation
Vieux 03/06/2007, 19h30   Sujet 16f84 à 16f877 - Message #7
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
ADCON1 est en bank1...

David.
DavidDB est déconnecté   Réponse avec citation
Vieux 03/06/2007, 20h11   Sujet 16f84 à 16f877 - Message #8
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
ça ne marche pas
sdow est déconnecté   Réponse avec citation
Vieux 03/06/2007, 23h06   Sujet 16f84 à 16f877 - Message #9
freepicbasic
 
Date d'inscription: août 2006
Localisation: France
Âge: 52
Messages: 1 795
Re : 16f84 à 16f877
ne pas oublier bank1 puis le retour bank0 après le adcon1.
voir la vitesse du delay aussi si l'on passede 4mhz à 20 mhz
__________________
A+, pat
freepicbasic est connecté maintenant   Réponse avec citation
Vieux 04/06/2007, 00h17   Sujet 16f84 à 16f877 - Message #10
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
Code:
CLRF STATUS ; Do initialization, Select bank 0 CLRF INTCON ; Clear int-flags, Disable interrupts CLRF PCLATH ; Keep in lower 2KByte CLRF PORTA ; ALL PORT output should output Low. CLRF PORTB BSF STATUS, RP0 ; Select bank 1 MOVLW 0x0F8 ; RA2-0 outputs, RA4-3 inputs MOVWF TRISA MOVLW 0x000 ; RB7-0 outputs MOVWF TRISB BSF OPTION_REG, NOT_RBPU ; Disable PORTB pull-ups movlw 6 movwf ADCON1 BCF STATUS, RP0 ; Select bank 0 CALL LCDINIT ; Initialize LCDisplay loop CALL INDEX call Niveau call VITESSE call Niveau goto loop END
sdow est déconnecté   Réponse avec citation
Vieux 04/06/2007, 01h14   Sujet 16f84 à 16f877 - Message #11
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
Je ne comprends pas comment ce programme peut fonctionner sur 16F84...

Jusqu'à la FIN de la phase d'initialisation du LCD, il est INTERDIT de vérifier BUSY FLAG...
Or, dans l'init du LCD dès la première commande, tu testes BUSY FLAG ce qui empêche une initialisation correct du LCD...

Donc, il est impossible que ce programme fonctionne tel quel sur 16F84!

David.
DavidDB est déconnecté   Réponse avec citation
Vieux 04/06/2007, 02h45   Sujet 16f84 à 16f877 - Message #12
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
Pourrais-tu ajouter les lignes dans mon code, car je ne comprends pas.
sdow est déconnecté   Réponse avec citation
Vieux 04/06/2007, 14h38   Sujet 16f84 à 16f877 - Message #13
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
Salut,

Non, je ne corrige pas ton code...

Tu ouvres le datasheet d'un LCD, et tu adaptes ton programme en suivant à la lettre la procédure d'initialisation!

Je n'apprécie pas le fait que tu dises que ton programme fonctionne sur 16F84, alors qu'une lecture rapide de ton code montre des erreurs flagrantes rendant impossible la mise en service du LCD.
Et ceci n'a rien avoir avec la migration du programme d'un 16f84 vers 16f877 (Pat a donné l'unique modification à faire dans ton cas)

David.
DavidDB est déconnecté   Réponse avec citation
Vieux 04/06/2007, 16h18   Sujet 16f84 à 16f877 - Message #14
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
tout les code sont là

http://home.iae.nl/users/pouweha/lcd/lcd.shtml

si tu veux esayer sur un 84 tout marchera
sdow est déconnecté   Réponse avec citation
Vieux 04/06/2007, 16h53   Sujet 16f84 à 16f877 - Message #15
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
Non, cela ne fonctionne pas!

Un extrait d'un datasheet LCD (idem au HDxxx):

During the initialization, the following instructions are executed, and BF (Busy Flag) is kept “High” (busy state) to
the end of initialization
.

Il faut utiliser des tempos jusqu'a la fin de l'initialisation comme mentionné dans le datasheet pour un fonctionnement correct du LCD.

David.
DavidDB est déconnecté   Réponse avec citation
Vieux 04/06/2007, 18h40   Sujet 16f84 à 16f877 - Message #16
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
Code:
LCDINIT ; Busy-flag is not yet valid CLRF LCD_CTRL ; ALL PORT output should output Low. ; power-up delay MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS ; Busy Flag should be valid from here MOVLW 0x038 ; 8-bit-interface, 2-lines CALL LCDPUTCMD MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS MOVLW 0x000 ; disp.off, curs.off, no-blink CALL LCDDMODE MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS CALL LCDCLEAR MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS MOVLW 0x004 ; disp.on, curs.off CALL LCDDMODE MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS MOVLW 0x002 ; auto-inc (shift-cursor) CALL LCDEMODE MOVLW 0x01E CALL X_DELAY500 ; 30 * 0.5mS = 15mS RETURN
sdow est déconnecté   Réponse avec citation
Vieux 04/06/2007, 19h04   Sujet 16f84 à 16f877 - Message #17
DavidDB
 
Date d'inscription: juillet 2004
Messages: 701
Re : 16f84 à 16f877
C'est bien essayé, mais ce n'est juste...

Le test de Busy Flag se fait par l'intermédiaire de la routine "LCDPUTCMD" et donc les delais que tu as rajouté ne servent à rien et ne corrige pas le problème.

Est-ce que tu comprends le code de ce programme ?

David.
DavidDB est déconnecté   Réponse avec citation
Vieux 04/06/2007, 19h22   Sujet 16f84 à 16f877 - Message #18
sdow
 
Date d'inscription: avril 2005
Messages: 290
Re : 16f84 à 16f877
donc je met un delais dans la fonction LCDPUTCMD
sdow est déconnecté   Réponse avec citation
Bienvenue
Si ceci est votre première visite, vous devez vous inscrire avant de pouvoir envoyer des messages. En étant inscrit vous pourrez poster votre question, participer aux débats, joindre vos images... alors n'attendez-plus, cela vous prendra 1 minute !

Pour commencer à lire les messages, depuis la page d'accueil des forums, sélectionnez le forum qui vous tente et partez ensuite à sa découverte...

Publicité

A voir aussi
pb prog CC5X 16F877 (Forum Électronique)
keypad 16f877 (Forum Électronique)
16f877>16877A (Forum Électronique)
Bootloader PIC 16F877 (Forum Électronique)
servo et pic 16f877 (Forum Électronique)