Hallo Leute.
ich versuche mit meinen PIC-Controller ST7567 Grafik-Display anzusteuern.
Nach einige Internet sucherei und Code Beispiele, bekomme ich nicht zum laufen T_T
Leider ist mein Latein am ende und habe einige andere Forums und Hersteller Direkt angeschrieben. Leider noch keinen Antwort bekommen.
Alles anzeigen
Ich möchte nur zum testen ein Pixel auf dem Display setzten. Die Initialisierungsroutine und Befehle habe ich von BASCOM-AVR Bibliothek "glcdEADOGM132x32.lib".
Ich hoffe ihr habt ein Rat für mich, was ich falsch mache.
Mit freundlichen Grüßen
Patrick Dreger
ich versuche mit meinen PIC-Controller ST7567 Grafik-Display anzusteuern.
Nach einige Internet sucherei und Code Beispiele, bekomme ich nicht zum laufen T_T
Leider ist mein Latein am ende und habe einige andere Forums und Hersteller Direkt angeschrieben. Leider noch keinen Antwort bekommen.
Quellcode
- #include "mcc_generated_files/mcc.h"
- #include "mcc_generated_files/spi1.h"
- #define x_max 132
- #define x_min 0
- #define y_max 32
- #define y_min 0
- #define row_max 8
- #define row_min 0
- #define buffer_size 1024
- #define ON 1
- #define OFF 0
- #define round 1
- #define square 0
- #define Set_Column_Address_Low 0x00
- #define Set_Column_Address_High 0x10
- #define Select_Internal_Resistor_Ratio 0x22
- #define Select_Internal_Power_Supply_Mode 0x28
- #define Set_LCD_Start_Line 0x40
- #define Set_Electronic_Volume_Mode 0x81
- #define ADC_Select_Normal 0xA0
- #define ADC_Select_Reverse 0xA1
- #define Set_LCD_Bias_Low 0xA2
- #define Set_LCD_Bias_High 0xA3
- #define Display_All_Points_Off 0xA4
- #define Display_All_Points_On 0xA5
- #define Display_Normal 0xA6
- #define Display_Reverse 0xA7
- #define Display_Off 0xAE
- #define Display_On 0xAF
- #define Set_Page_Address 0xB0
- #define Set_Common_Output_Normal 0xC0
- #define Set_Common_Output_Reverse 0xC8
- #define Internal_Reset 0xE2
- #define NOP_cmd 0xE3
- #define End_cmd 0xEE
- #define Set_Boost_Ratio_Low 0xF8
- #define Set_Boost_Ratio_Medium 0xF9
- #define Set_Boost_Ratio_High 0xFB
- #define Test_Display 0xFF
- #define CMD 0
- #define DAT 1
- uint8_t buffer[buffer_size];
- uint8_t _lcd_init_data[15] = { 0xE2 ,
- 0x40 ,
- 0xA1 ,
- 0xC0 ,
- 0xA6 ,
- 0xA2 ,
- 0x2F ,
- 0xF8 ,
- 0x00 ,
- 0x23 ,
- 0x81 ,
- 0x1F ,
- 0xAC ,
- 0x00 ,
- 0xAF};
- //uint8_t init_DOGM132[13] = {0xA2,0xA0,0xC0,0x22,0x81,0x1F,0xF8,0x00,0x2C,0x2E,0x2F,0xAF,0x00};
- uint8_t x = 0x00;
- uint8_t lowbyte , highbyte = 0x00;
- void command(uint8_t dat,uint8_t type);
- void glcd_init(void);
- void glcd_clear(void);
- void GLCD_set_pixel(uint8_t x_pos, uint8_t y_pos, uint8_t colour);
- void main(void)
- {
- // Initialize the device
- SYSTEM_Initialize();
- EUSART1_Initialize();
- SPI1_Initialize();
- SPI1_Open(SPI1_DEFAULT);
- glcd_init();
- GLCD_set_pixel(5,5,1);
- while (1)
- {
- }
- SPI1_Close();
- }
- void command(uint8_t dat,uint8_t type)
- {
- if(type == 0)
- {
- A0_SetLow();
- }
- else
- {
- A0_SetHigh();
- }
- __delay_us(10);
- CS1_SetLow();
- EUSART1_Write(dat);
- SPI1_WriteByte(dat);
- __delay_us(10);
- CS1_SetHigh();
- return;
- }
- void glcd_init(void)
- {
- uint8_t i = 0 ;
- RST_SetLow();
- __delay_us(100);
- CS1_SetLow();
- RST_SetHigh();
- for (i= 0; i<15;i++)
- {
- SPI1_WriteByte(_lcd_init_data[i]);
- }
- return;
- }
- void glcd_clear(void)
- {
- uint8_t i = 0x00;
- uint8_t j = 0x00;
- for(i = row_min; i < row_max; i++)
- {
- command(i + 0xB0, CMD);
- command(0x10, CMD);
- command(0x04, CMD);
- for(j = x_min; j < x_max; j++)
- {
- command(0x00, DAT);
- }
- }
- return;
- }
- void GLCD_set_pixel(uint8_t x_pos, uint8_t y_pos, uint8_t colour)
- {
- uint8_t value = 0x00;
- if(y_pos > y_max)
- {
- y_pos = y_max;
- }
- if(x_pos > x_max)
- {
- x_pos = x_max;
- }
- command(Set_Page_Address + y_pos , DAT);
- x = x_pos << 4; x = x >> 4; //HighNibble
- command(Set_Column_Address_High + x , DAT);
- x = x_pos >> 4; //LowNibble
- command(Set_Column_Address_Low + x , DAT);
- if(colour >= 1)
- {
- value = 1;
- }
- else
- {
- value = 0;
- }
- command(value, DAT);
- return;
- }
Ich hoffe ihr habt ein Rat für mich, was ich falsch mache.
Mit freundlichen Grüßen
Patrick Dreger
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von patrick_cpp ()