dsPIC33FJ128GP802 e ST7565
Ciao a tutti!! Stavo andando nel panico perché per qualche giorno non sono riuscito ad accedere al sito! Ma per fortuna ora è tutto a posto!
Eccomi di nuovo qua a chiedere il vostro prezioso aiuto!
Ho iniziato un progetto qualche mese fa in cui devo pilotare un display grafico, ma dopo ore passate a sbatterci il cranio sopra non ho ancora risolto nulla... Il display non vuole saperne di accendersi...
Allora, la configurazione è la seguente: il micro che uso è un dsPIC33FJ128GP802 e il display è un DisplayTech 64128N basato su controller Sitronix ST7565. La comunicazione avviene in SPI utilizzando il modulo SPI integrato.
Premetto che ho letto tutti i datasheet di tutto e non ne sono venuto a capo..il controller ha due tipi di inizializzazioni e io le ho implementate tutte e due, ma nessuna delle due sembra funzionare. Comunque posto il codice relativo alle inizializzazioni, sperando che qualcuno abbia avuto un po' di esperienze in merito e possa aiutarmi! Grazie mille!!
Grazie mille davvero! Sto impazzendo!
Eccomi di nuovo qua a chiedere il vostro prezioso aiuto!
Ho iniziato un progetto qualche mese fa in cui devo pilotare un display grafico, ma dopo ore passate a sbatterci il cranio sopra non ho ancora risolto nulla... Il display non vuole saperne di accendersi...
Allora, la configurazione è la seguente: il micro che uso è un dsPIC33FJ128GP802 e il display è un DisplayTech 64128N basato su controller Sitronix ST7565. La comunicazione avviene in SPI utilizzando il modulo SPI integrato.
Premetto che ho letto tutti i datasheet di tutto e non ne sono venuto a capo..il controller ha due tipi di inizializzazioni e io le ho implementate tutte e due, ma nessuna delle due sembra funzionare. Comunque posto il codice relativo alle inizializzazioni, sperando che qualcuno abbia avuto un po' di esperienze in merito e possa aiutarmi! Grazie mille!!
- Codice: Seleziona tutto
#define A0 LATBbits.LATB6
#define CS LATBbits.LATB7
#define DISP_RES LATBbits.LATB10
#define SLEEP_MODEA 0xAC
#define SLEEP_MODEB 0x00
#define NORMAL_MODE 0xAD
#define DISPLAY_ON 0xAF
#define DISPLAY_OFF 0xAE
#define DISPLAY_ALL_OFF 0xA4
#define DISPLAY_ALL_ON 0xA5
#define LCD_BIAS_SET_16_18_19 0xA2
#define ADC_REVERSE 0xA1
#define COMMON_OUTPUT_MODE_SELECT_REVERSE 0xC8
#define V0_RATIO_45_SET 0x23
#define BOOSTER_RATIO_SELECT_MODE 0xF8
#define BOOSTER_2_3_4X 0x00
#define ELECTRONIC_VOLUME_SET 0x81
#define ELECTRONIC_VOLUME_VALUE 0x38
#define POWER_CONTROL_ALL_ON 0x2F
#define DISPLAY_START_LINE_SET_0 0x40
#define waitCmdDisplay __delay32(400000)
#define wait1ms __delay32(40000)
#define wait0_5ms __delay32(20000)
#define wait0_1ms __delay32(4000)
#define wait10us __delay32(400)
#define wait7us __delay32(280)
void InitDisplay()
{
DISP_RES = 1; //Resetting display
waitCmdDisplay;
DISP_RES = 0;
A0 = 0; //Selecting display and activation of commands
wait0_1ms;
CS = 0;
wait0_1ms; //Waiting for power stabilized
DISP_RES = 1;
wait0_1ms; //Wait 1ms for reset circuit finished
/*
-------------------------------------
Initialization sequence
-------------------------------------
*/
//Activation of sleep mode
SendCommand(SLEEP_MODEA);
SendCommand(SLEEP_MODEB);
SendCommand(DISPLAY_OFF);
SendCommand(DISPLAY_ALL_ON);
//End of sleep mode activation
//LCD BIAS Setting 1\7 1\65 duty
SendCommand(LCD_BIAS_SET_16_18_19);
//ADC Selection --> reverse
SendCommand(ADC_REVERSE);
//Common Output Mode Select --> reverse
SendCommand(COMMON_OUTPUT_MODE_SELECT_REVERSE);
//V0 4.5 RATIO setting
SendCommand(V0_RATIO_45_SET);
//Electronic volume 0
SendCommand(ELECTRONIC_VOLUME_SET);
SendCommand(ELECTRONIC_VOLUME_VALUE);
//Booster selection 3x
SendCommand(BOOSTER_RATIO_SELECT_MODE);
SendCommand(BOOSTER_2_3_4X);
//Exiting Sleep Mode
SendCommand(DISPLAY_ALL_OFF);
SendCommand(NORMAL_MODE);
SendCommand(SLEEP_MODEB);
//Power control all on
SendCommand(POWER_CONTROL_ALL_ON);
//Set display start line 0
SendCommand(DISPLAY_START_LINE_SET_0);
//SendCommand(DISPLAY_ALL_ON);
}
void InitDisplayPower()
{
DISP_RES = 1; //Resetting display
waitCmdDisplay;
DISP_RES = 0;
A0 = 0; //Selecting display and activation of commands
wait0_1ms;
CS = 0;
wait0_1ms; //Waiting for power stabilized
DISP_RES = 1;
wait0_1ms; //Wait 1ms for reset circuit finished
/*
-------------------------------------
Initialization sequence
-------------------------------------
*/
//LCD BIAS Setting 1\7 1\65 duty
SendCommand(LCD_BIAS_SET_16_18_19);
//ADC Selection --> reverse
SendCommand(ADC_REVERSE);
//Common Output Mode Select --> reverse
SendCommand(COMMON_OUTPUT_MODE_SELECT_REVERSE);
//V0 4.5 RATIO setting
SendCommand(V0_RATIO_45_SET);
//Electronic volume 0
SendCommand(ELECTRONIC_VOLUME_SET);
SendCommand(ELECTRONIC_VOLUME_VALUE);
//Booster selection 3x
SendCommand(BOOSTER_RATIO_SELECT_MODE);
SendCommand(BOOSTER_2_3_4X);
//Set display start line 0
SendCommand(DISPLAY_START_LINE_SET_0);
//Power control all on
SendCommand(POWER_CONTROL_ALL_ON);
//SendCommand(DISPLAY_ALL_ON);
}
void SendCommand(unsigned char inputCommand)
{
A0 = 0;
wait0_1ms;
CS = 0;
WriteSPI1(inputCommand);
wait7us;
CS = 1;
}
Grazie mille davvero! Sto impazzendo!
