A
Ankita Agarwal
Guest
Imam pismeni ovaj kod na sučelje JHD161A sa mojim PIC18F2550 LCD ali pokazuje ništa ... ja sam pridaje ovaj kod plz pomoć
# uključiti <p18cxxx.h>
# uključiti <delays.h>
* Pragma PLLDIV config = 5 / / (20 MHz kristal na PICDEM FS USB odbor)
* Pragma CPUDIV config = OSC1_PLL2
* Pragma USBDIV config = 2 / / Sat izvor iz 96MHz PLL / 2
# Pragma FOSC config = HSPLL_HS
* Pragma FCMEN config = OFF
* Pragma IESO config = OFF
* Pragma PWRT config = OFF
# Pragma config BOR = ON
* Pragma BORV config = 3
* Pragma VREGEN config = ON / / USB Voltage Regulator
# Pragma config WDT = OFF
* Pragma WDTPS config = 32768
* Pragma MCLRE config = ON
* Pragma LPT1OSC config = OFF
* Pragma PBADEN config = OFF
* Pragma CCP2MX config = ON
* Pragma STVREN config = ON
* Pragma LVP config = OFF
# Pragma config UKLONI POGREŠKE = OFF
* Pragma XINST config = OFF / / Extended uputstvo Set
* Pragma CP0 config = OFF
# Pragma config CP1 = OFF
# Pragma config CP2 = OFF
# Pragma config CP3 = OFF
# Pragma config CPB = OFF
# Pragma config CPD = OFF
* Pragma WRT0 config = OFF
* Pragma WRT1 config = OFF
* Pragma WRT2 config = OFF
* Pragma WRT3 config = OFF
* Pragma WRTB config = OFF / / Boot Block Napiši zaštitu
# Pragma config WRTC = OFF
* Pragma WRTD config = OFF
* Pragma EBTR0 config = OFF
* Pragma EBTR1 config = OFF
* Pragma EBTR2 config = OFF
* Pragma EBTR3 config = OFF
* Pragma EBTRB config = OFF# define LCD_data PORTB
# define LCD_rs PORTAbits.RA0
# define LCD_rw PORTAbits.RA1
# define LCD_en PORTAbits.RA2poniłtava LCD_busy (void);
poniłtava LCD_init (void);poniłtava glavna (void)
(
ADCON1 | = 0x0F;
TRISAbits.TRISA0 = 0;
TRISAbits.TRISA1 = 0;
TRISAbits.TRISA2 = 0;
LCD_init ();
PORTB = 0x83;
LCD_rs = 0; / / Odabrana naredbu registrirati
LCD_rw = 0; / / Mi smo pisanje podataka u registar
LCD_en = 1; / / Enable H-> l
LCD_en = 0;
LCD_busy ();
PORTB = 'A'; / / set Funkcija: 1 Linija, 8-bitni, 5x7 točkice
LCD_rs = 1; / / Odabrana podatkovni spremnik
LCD_rw = 0; / / Mi smo pisanje podataka u registar
LCD_en = 1; / / Enable H-> l
LCD_en = 0;
LCD_busy ();a (1)
(
);
)poniłtava LCD_init (void)
(
TRISB = 0;
PORTB = 0x30; / / set Funkcija: 1 Linija, 8-bitni, 5x7 točkice
LCD_rs = 0; / / Odabrana naredbu registrirati
LCD_rw = 0; / / Mi smo pisanje podataka u registar
LCD_en = 1; / / Enable H> L
LCD_en = 0;
LCD_busy (); / / LCD Pričekajte da obradi naredbePORTB = 0x0E;
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy ();
PORTB = 0x01; / / Clear LCD
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy (); / / LCD Pričekajte da obradi naredbePORTB = 0x06;
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy ()
poniłtava LCD_busy (void)
(
Delay10KTCYx (240);
)
Ali ništa nije prikazan u LCD gdje je problem i cudn't dobiti.
# uključiti <p18cxxx.h>
# uključiti <delays.h>
* Pragma PLLDIV config = 5 / / (20 MHz kristal na PICDEM FS USB odbor)
* Pragma CPUDIV config = OSC1_PLL2
* Pragma USBDIV config = 2 / / Sat izvor iz 96MHz PLL / 2
# Pragma FOSC config = HSPLL_HS
* Pragma FCMEN config = OFF
* Pragma IESO config = OFF
* Pragma PWRT config = OFF
# Pragma config BOR = ON
* Pragma BORV config = 3
* Pragma VREGEN config = ON / / USB Voltage Regulator
# Pragma config WDT = OFF
* Pragma WDTPS config = 32768
* Pragma MCLRE config = ON
* Pragma LPT1OSC config = OFF
* Pragma PBADEN config = OFF
* Pragma CCP2MX config = ON
* Pragma STVREN config = ON
* Pragma LVP config = OFF
# Pragma config UKLONI POGREŠKE = OFF
* Pragma XINST config = OFF / / Extended uputstvo Set
* Pragma CP0 config = OFF
# Pragma config CP1 = OFF
# Pragma config CP2 = OFF
# Pragma config CP3 = OFF
# Pragma config CPB = OFF
# Pragma config CPD = OFF
* Pragma WRT0 config = OFF
* Pragma WRT1 config = OFF
* Pragma WRT2 config = OFF
* Pragma WRT3 config = OFF
* Pragma WRTB config = OFF / / Boot Block Napiši zaštitu
# Pragma config WRTC = OFF
* Pragma WRTD config = OFF
* Pragma EBTR0 config = OFF
* Pragma EBTR1 config = OFF
* Pragma EBTR2 config = OFF
* Pragma EBTR3 config = OFF
* Pragma EBTRB config = OFF# define LCD_data PORTB
# define LCD_rs PORTAbits.RA0
# define LCD_rw PORTAbits.RA1
# define LCD_en PORTAbits.RA2poniłtava LCD_busy (void);
poniłtava LCD_init (void);poniłtava glavna (void)
(
ADCON1 | = 0x0F;
TRISAbits.TRISA0 = 0;
TRISAbits.TRISA1 = 0;
TRISAbits.TRISA2 = 0;
LCD_init ();
PORTB = 0x83;
LCD_rs = 0; / / Odabrana naredbu registrirati
LCD_rw = 0; / / Mi smo pisanje podataka u registar
LCD_en = 1; / / Enable H-> l
LCD_en = 0;
LCD_busy ();
PORTB = 'A'; / / set Funkcija: 1 Linija, 8-bitni, 5x7 točkice
LCD_rs = 1; / / Odabrana podatkovni spremnik
LCD_rw = 0; / / Mi smo pisanje podataka u registar
LCD_en = 1; / / Enable H-> l
LCD_en = 0;
LCD_busy ();a (1)
(
);
)poniłtava LCD_init (void)
(
TRISB = 0;
PORTB = 0x30; / / set Funkcija: 1 Linija, 8-bitni, 5x7 točkice
LCD_rs = 0; / / Odabrana naredbu registrirati
LCD_rw = 0; / / Mi smo pisanje podataka u registar
LCD_en = 1; / / Enable H> L
LCD_en = 0;
LCD_busy (); / / LCD Pričekajte da obradi naredbePORTB = 0x0E;
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy ();
PORTB = 0x01; / / Clear LCD
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy (); / / LCD Pričekajte da obradi naredbePORTB = 0x06;
LCD_rs = 0;
LCD_rw = 0;
LCD_en = 1;
LCD_en = 0;
LCD_busy ()
poniłtava LCD_busy (void)
(
Delay10KTCYx (240);
)
Ali ništa nije prikazan u LCD gdje je problem i cudn't dobiti.