PIC-Controller mit ST7567 und SPI ansteuern

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

Aufgrund technischer Veränderungen ist der Mailverkehr innerhalb des Forums (Private Nachrichten) nur noch eingeschränkt möglich. Die Einschränkung ist notwendig, um zusätzliche Betriebskosten für das Forum zu vermeiden. Näheres zu den Hintergründen im Thread "Aktuelles zum Forum".Wir bitten um Verständnis.

Hinweis kann nach Kenntnisnahme deaktiviert werden!

  • PIC-Controller mit ST7567 und SPI ansteuern

    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.

    Quellcode

    1. #include "mcc_generated_files/mcc.h"
    2. #include "mcc_generated_files/spi1.h"
    3. #define x_max 132
    4. #define x_min 0
    5. #define y_max 32
    6. #define y_min 0
    7. #define row_max 8
    8. #define row_min 0
    9. #define buffer_size 1024
    10. #define ON 1
    11. #define OFF 0
    12. #define round 1
    13. #define square 0
    14. #define Set_Column_Address_Low 0x00
    15. #define Set_Column_Address_High 0x10
    16. #define Select_Internal_Resistor_Ratio 0x22
    17. #define Select_Internal_Power_Supply_Mode 0x28
    18. #define Set_LCD_Start_Line 0x40
    19. #define Set_Electronic_Volume_Mode 0x81
    20. #define ADC_Select_Normal 0xA0
    21. #define ADC_Select_Reverse 0xA1
    22. #define Set_LCD_Bias_Low 0xA2
    23. #define Set_LCD_Bias_High 0xA3
    24. #define Display_All_Points_Off 0xA4
    25. #define Display_All_Points_On 0xA5
    26. #define Display_Normal 0xA6
    27. #define Display_Reverse 0xA7
    28. #define Display_Off 0xAE
    29. #define Display_On 0xAF
    30. #define Set_Page_Address 0xB0
    31. #define Set_Common_Output_Normal 0xC0
    32. #define Set_Common_Output_Reverse 0xC8
    33. #define Internal_Reset 0xE2
    34. #define NOP_cmd 0xE3
    35. #define End_cmd 0xEE
    36. #define Set_Boost_Ratio_Low 0xF8
    37. #define Set_Boost_Ratio_Medium 0xF9
    38. #define Set_Boost_Ratio_High 0xFB
    39. #define Test_Display 0xFF
    40. #define CMD 0
    41. #define DAT 1
    42. uint8_t buffer[buffer_size];
    43. uint8_t _lcd_init_data[15] = { 0xE2 ,
    44. 0x40 ,
    45. 0xA1 ,
    46. 0xC0 ,
    47. 0xA6 ,
    48. 0xA2 ,
    49. 0x2F ,
    50. 0xF8 ,
    51. 0x00 ,
    52. 0x23 ,
    53. 0x81 ,
    54. 0x1F ,
    55. 0xAC ,
    56. 0x00 ,
    57. 0xAF};
    58. //uint8_t init_DOGM132[13] = {0xA2,0xA0,0xC0,0x22,0x81,0x1F,0xF8,0x00,0x2C,0x2E,0x2F,0xAF,0x00};
    59. uint8_t x = 0x00;
    60. uint8_t lowbyte , highbyte = 0x00;
    61. void command(uint8_t dat,uint8_t type);
    62. void glcd_init(void);
    63. void glcd_clear(void);
    64. void GLCD_set_pixel(uint8_t x_pos, uint8_t y_pos, uint8_t colour);
    65. void main(void)
    66. {
    67. // Initialize the device
    68. SYSTEM_Initialize();
    69. EUSART1_Initialize();
    70. SPI1_Initialize();
    71. SPI1_Open(SPI1_DEFAULT);
    72. glcd_init();
    73. GLCD_set_pixel(5,5,1);
    74. while (1)
    75. {
    76. }
    77. SPI1_Close();
    78. }
    79. void command(uint8_t dat,uint8_t type)
    80. {
    81. if(type == 0)
    82. {
    83. A0_SetLow();
    84. }
    85. else
    86. {
    87. A0_SetHigh();
    88. }
    89. __delay_us(10);
    90. CS1_SetLow();
    91. EUSART1_Write(dat);
    92. SPI1_WriteByte(dat);
    93. __delay_us(10);
    94. CS1_SetHigh();
    95. return;
    96. }
    97. void glcd_init(void)
    98. {
    99. uint8_t i = 0 ;
    100. RST_SetLow();
    101. __delay_us(100);
    102. CS1_SetLow();
    103. RST_SetHigh();
    104. for (i= 0; i<15;i++)
    105. {
    106. SPI1_WriteByte(_lcd_init_data[i]);
    107. }
    108. return;
    109. }
    110. void glcd_clear(void)
    111. {
    112. uint8_t i = 0x00;
    113. uint8_t j = 0x00;
    114. for(i = row_min; i < row_max; i++)
    115. {
    116. command(i + 0xB0, CMD);
    117. command(0x10, CMD);
    118. command(0x04, CMD);
    119. for(j = x_min; j < x_max; j++)
    120. {
    121. command(0x00, DAT);
    122. }
    123. }
    124. return;
    125. }
    126. void GLCD_set_pixel(uint8_t x_pos, uint8_t y_pos, uint8_t colour)
    127. {
    128. uint8_t value = 0x00;
    129. if(y_pos > y_max)
    130. {
    131. y_pos = y_max;
    132. }
    133. if(x_pos > x_max)
    134. {
    135. x_pos = x_max;
    136. }
    137. command(Set_Page_Address + y_pos , DAT);
    138. x = x_pos << 4; x = x >> 4; //HighNibble
    139. command(Set_Column_Address_High + x , DAT);
    140. x = x_pos >> 4; //LowNibble
    141. command(Set_Column_Address_Low + x , DAT);
    142. if(colour >= 1)
    143. {
    144. value = 1;
    145. }
    146. else
    147. {
    148. value = 0;
    149. }
    150. command(value, DAT);
    151. return;
    152. }
    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

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von patrick_cpp ()

  • Ich weis das ich bei BASCOM-Forum bin. Aber die Leute aus Microchip-Forum reagieren nicht und Mikrocontroller.net hat auch genauere Fragen, was nicht funktioniert.
    Ich habe die Hersteller "Sitronix" C-Code und PAP angefragt. Leider noch keine Antwort bekommen.

    Ich greife jeden Strohalm.

    Es hätte sein können das einer im Forum der mit mit diesem Controller in anderen Programmiersprachen außer FreeBasic (Bascom-AVR) Ahnung hat.