Fórum témák

» Több friss téma
Fórum » LCD kijelző vezérlése, életre keltése
Lapozás: OK   22 / 71
(#) lokátoros válasza Crea hozzászólására (») Aug 25, 2011 /
 
Csak tippelni tudok.
A programban a CS gondolom a ChipSelect lesz (CSB az adatlapon).
Az adatok küldése előtt szerintem CS = 0; utasítás kellene.
(#) Crea hozzászólása Aug 25, 2011 /
 
Azt vettem észre, hogy bizonyos oknál fogva a vezérlő jelek pl a CS vagy RS abszolút nem kerülnek kiküldére legalább is a debugger watch szerint :S
(#) lokátoros válasza Crea hozzászólására (») Aug 25, 2011 /
 
Ha kimenetként vezérelsz portlábakat javaslom használd a LATB regisztert a PORTB helyett:
#define CS LATBbits.LATB0
(#) pipi válasza Crea hozzászólására (») Aug 25, 2011 /
 
Bővebben: Link
Mi a gond vele, nem írjátok? Nekem működött, egyenlőre nem találom a forrását, rég volt. Nagyjából 44780 kompatibilis
(#) Crea hozzászólása Aug 26, 2011 /
 
Úgy néz ki, hogy a PORTB és PORTA kimenet meghalt rejtélyes okok miatt az LCD-re kötött PIC-ben és ez is okozhatja a hibát, majd hamarosan megpróbálom másképp. Igaz az árnyékregisztereket kellene használni habár az adatkiküldés a sima PORTB címzéssel is megtörténik valószínű a fordító miatt. Találtam erre a típusra egy headert csak az a problémám, hogy CSS és inkább ragaszkodom az C18-hoz. Nem tudom, hogy át lehet-e konvertálni az egyikből a másikba hiba nélkül? Van ötletetek?

a header:
  1. 1 /*
  2.     2  *            file: EA-DOGM_MIO.c
  3.     3  *         version: 2.03
  4.     4  *     description: Multi I/O driver for EA DOGM displays
  5.     5  *                : Uses 8Bit, SPI HW or SPI SW (bitbang)
  6.     6  *     written by : Michael Bradley (mbradley@mculabs.com)
  7.     7  *   contributions: Imaginos (CCS forum), Emil Nad (8Bit testing)
  8.     8  *                  jgschmidt (CCS forum)
  9.     9  *
  10.    10  *   Changelog:
  11.    11  *       04/22/2010 v2.03 Minor update, changed EADOGM_SPI_HW for HW SPI 1 and 2
  12.    12  *                  Added setup_spi() for HW SPI use, and spi_clk_div option
  13.    13  *                  thanks to jgschmidt (ccs forum) for noticing hw setup issues
  14.    14  *       12/03/2009 v2.02 bug fix and printChr change, no user change needed for use
  15.    15  *       11/25/2009 v2.01 Minor changes, replaced some functions with macros
  16.    16  *       09/17/2009 v2.00 Major change, IO is now 8Bit or SPI (hw or sw)
  17.    17  *                  rewrote some defines as related to pins
  18.    18  *       09/15/2009 v1.13 added function eaDogM_WriteIntAtPos()
  19.    19  *                  and eaDogM_WriteStringAtPos()
  20.    20  *                  added some defines to clean source
  21.    21  *       08/28/2009 v1.12 EADOGM_COLSPAN defined internally, allowing for
  22.    22  *                  162 model to position correctly (noted by Imaginos, CCS forum)
  23.    23  *                  Added support for 2nd SPI HW port (suggested by Imaginos, CCS forum)
  24.    24  *                  defined a few more special chr's
  25.    25  *       07/12/2009 v1.11 Fixed #define error surrounding BB SPI ini
  26.    26  *                  added eaDogM_ClearRow(row);
  27.    27  *       07/11/2009 Created/Consolidated this file from my testing sets
  28.    28  *
  29.    29  * Usage:
  30.    30  *   In your source, you need to define which EA DOGM display you are using,
  31.    31  *   there are 3 units supported EADOGM081 , EADOGM162 , EADOGM163 To use
  32.    32  *   define with a 1.
  33.    33  *
  34.    34  * #define EADOGM081 1  // to use MODEL EADOG081
  35.    35  * #define EADOGM162 1  // to use MODEL EADOG162
  36.    36  * #define EADOGM163 1  // to use MODEL EADOG163
  37.    37  * #define EADOGMVDD  5   // 5v LCD Vdd
  38.    38  * //#define EADOGMVDD  3   // 3.3v LCD Vdd
  39.    39  *
  40.    40  *
  41.    41  * // we need to define the IO mode we want, select only one of these, set to 1
  42.    42  * #define EADOGM_SPI_HW  1   // hw spi, uses on chip spi
  43.    43  * #define EADOGM_SPI_HW  2   // hw spi, 2nd on chip spi
  44.    44  * #define EADOGM_SPI_DIV SPI_CLK_DIV_64 // used to slow hw spi clock (you can use other constants)
  45.    45  * #define EADOGM_SPI_SW  1   // sw bit bang, can use any io pins
  46.    46  * #define EADOGM_8BIT    1   // 8 bit data bus
  47.    47  *
  48.    48  * // for 8Bit mode only, we need to define the output port
  49.    49  * // however, this can be our own function if need be.
  50.    50  * // example shows output to port b
  51.    51  * #define EADOGM_8BIT_PORT(d) output_b(d);   // we need to define how the byte goes out
  52.    52  * //#define EADOGM_8BIT_PORT(d) your_func(d);   // we need to define how the byte goes out
  53.    53  *
  54.    54  *
  55.    55  * // we need to define a few pins
  56.    56  * #define EADOGM_PIN_RS  PIN_C1   // RS line, (pin 39 on the LCD)
  57.    57  * #define EADOGM_PIN_CSB PIN_C2   // /CSB line, (pin 38 on the LCD) Req for SPI Opt for 8BIT
  58.    58  *
  59.    59  * // for 8 bit mode, we need to define a few more pins
  60.    60  * #define EADOGM_NOCSB 1         // set to 1 if pin 38 (CSB) on lcd is tied to Vss
  61.    61  * #define EADOGM_PIN_E   PIN_C2   // E (pin 36 on the LCD)
  62.    62  * #define EADOGM_PIN_RW  PIN_C6   // RW (pin 37 on the LCD)
  63.    63  *
  64.    64  * // set these if you are using EADOGM_SPI_SW (bit bang)
  65.    65  * #define EADOGM_SCLK_BB PIN_C3 // Connects to pin 29 on LCD
  66.    66  * #define EADOGM_MOSI_BB PIN_C5 // Connects to pin 28 on LCD
  67.    67  *
  68.    68  *
  69.    69  *
  70.    70  * #include "EA-DOGM_MIO.c"
  71.    71  *
  72.    72  *    In your main code, do an ini call
  73.    73  * eaDogM_Initialize();
  74.    74  * eaDogM_DisplayOn();
  75.    75  *
  76.    76  *
  77.    77  * Available Functions:
  78.    78  * -------------------------------------------------------------------------------
  79.    79  *    eaDogM_Cls();                 // clears the screen, homes cursor
  80.    80  *    eaDogM_ClearRow(row);         // clears a row (v1.11)
  81.    81  *    eaDogM_CursorOn();            // turns on the cursor
  82.    82  *    eaDogM_CursorOff();           // turns of the cursor
  83.    83  *    eaDogM_DisplayOn();           // turns on display with cursor off
  84.    84  *    eaDogM_DisplayOff();          // turns off display
  85.    85  *    eaDogM_SetPos(row, col);      // sets position row:0-2, col:0-15
  86.    86  *    eaDogM_WriteChr(byte);        // writes a single chr to the display
  87.    87  *    eaDogM_WriteString(char str); // writes a string to the display
  88.    88  *                                  // note: add this line after device selection
  89.    89  *                                  // to do this: eaDogM_WriteString("Constant")
  90.    90  *                                  //   #device PASS_STRINGS=IN_RAM
  91.    91  *
  92.    92  *    // writes a 2 digit integer at row,col set flag = 1 to disable interrupts
  93.    93  *    eaDogM_WriteIntAtPos(row,col,int[,flag])
  94.    94  *
  95.    95  *    // writes a string at row,col set flag = 1 to disable interrupts
  96.    96  *    eaDogM_WriteStringAtPos(row,col,char str[,flag])
  97.    97  *
  98.    98  *    eaDogM_SetContrast(c);      // set contrast 0 to 15
  99.    99  *    eaDogM_DoubleHeight(row);     // turn on double height, row = 0 or 1
  100.   100  *    eaDogM_DoubleHeightOff();     // turn off double height
  101.   101  * -------------------------------------------------------------------------------
  102.   102  *
  103.   103  */
  104.   104
  105.   105
  106.   106
  107.   107 #ifndef EADOGM_SPI
  108.   108    #define EADOGM_SPI 1
  109.   109
  110.   110 // some special symbol chrs defined
  111.   111 #define EADMSYM_DEG     0b11011111     // degree symbol
  112.   112 #define EADMSYM_DARWL   0b11111011     // double <<
  113.   113 #define EADMSYM_DARWR   0b11111100     // double >>
  114.   114 #define EADMSYM_LT      0b00111100     // less than <
  115.   115 #define EADMSYM_GT      0b00111110     // greater than >
  116.   116 #define EADMSYM_OHM     0b00011110     // ohm symbol
  117.   117
  118.   118 // some command defines
  119.   119 #define EADMCMD_CONTRAST 0b0111000      // contrast command (0b0111xxxx)
  120.   120
  121.   121
  122.   122 // we noticed some issues with GLOBAL on pic24 devices
  123.   123 #ifndef GLOBAL
  124.   124   #define GLOBAL INTR_GLOBAL
  125.   125 #endif
  126.   126
  127.   127
  128.   128 // 1x16
  129.   129 #ifdef EADOGM081
  130.   130    #define EADOGM_ROWS 1
  131.   131    #if EADOGMVDD == 5
  132.   132      #define EADOGM_INIT_BIAS_SET 0x1C
  133.   133      #define EADOGM_INIT_POWER_CONTROL 0x51
  134.   134      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6A
  135.   135      #define EADOGM_INIT_CONTRAST_SET 0x74
  136.   136    #else
  137.   137      #define EADOGM_INIT_BIAS_SET 0x14
  138.   138      #define EADOGM_INIT_POWER_CONTROL 0x55
  139.   139      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6D
  140.   140      #define EADOGM_INIT_CONTRAST_SET 0x7C
  141.   141    #endif
  142.   142
  143.   143    #define EADOGM_INIT_FS1 0x31
  144.   144    #define EADOGM_INIT_FS2 0x30
  145.   145    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
  146.   146    #define EADOGM_INIT_ENTRY_MODE 0x06
  147.   147    #define EADOGM_COLSPAN 16
  148.   148 #endif
  149.   149
  150.   150
  151.   151 // 2x16
  152.   152 #ifdef EADOGM162
  153.   153    #define EADOGM_ROWS 2
  154.   154     #if EADOGMVDD == 5
  155.   155      #define EADOGM_INIT_BIAS_SET 0x1C
  156.   156      #define EADOGM_INIT_POWER_CONTROL 0x52
  157.   157      #define EADOGM_INIT_FOLLOWER_CONTROL 0x69
  158.   158      #define EADOGM_INIT_CONTRAST_SET 0x74
  159.   159    #else
  160.   160      #define EADOGM_INIT_BIAS_SET 0x14
  161.   161      #define EADOGM_INIT_POWER_CONTROL 0x55
  162.   162      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6D
  163.   163      #define EADOGM_INIT_CONTRAST_SET 0x78
  164.   164    #endif
  165.   165
  166.   166    #define EADOGM_INIT_FS1 0x39
  167.   167    #define EADOGM_INIT_FS2 0x38
  168.   168    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
  169.   169    #define EADOGM_INIT_ENTRY_MODE 0x06
  170.   170    #define EADOGM_COLSPAN 40  // suggested that this be 40 on model 162
  171.   171 #endif
  172.   172
  173.   173 // 3x16
  174.   174 #ifdef EADOGM163
  175.   175    #define EADOGM_ROWS 3
  176.   176     #if EADOGMVDD == 5
  177.   177      #define EADOGM_INIT_BIAS_SET 0x1D
  178.   178      #define EADOGM_INIT_POWER_CONTROL 0x50
  179.   179      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6C
  180.   180      #define EADOGM_INIT_CONTRAST_SET 0x7C
  181.   181    #else
  182.   182      #define EADOGM_INIT_BIAS_SET 0x15
  183.   183      #define EADOGM_INIT_POWER_CONTROL 0x55
  184.   184      #define EADOGM_INIT_FOLLOWER_CONTROL 0x6E
  185.   185      #define EADOGM_INIT_CONTRAST_SET 0x72
  186.   186    #endif
  187.   187
  188.   188    #define EADOGM_INIT_FS1 0x39
  189.   189    #define EADOGM_INIT_FS2 0x38
  190.   190    #define EADOGM_INIT_CLEAR_DISPLAY 0x01
  191.   191    #define EADOGM_INIT_ENTRY_MODE 0x06
  192.   192    #define EADOGM_COLSPAN 16
  193.   193 #endif
  194.   194
  195.   195
  196.   196 #define EADOGM_CMD_CLR 1
  197.   197 #define EADOGM_CMD_CURSOR_ON     0b00001111
  198.   198 #define EADOGM_CMD_CURSOR_OFF    0b00001100
  199.   199 #define EADOGM_CMD_DISPLAY_ON    0b00001100
  200.   200 #define EADOGM_CMD_DISPLAY_OFF   0b00001000
  201.   201 #define EADOGM_CMD_DDRAM_ADDR    0b10000000
  202.   202 #define EADOGM_CMD_CGRAM_ADDR    0b01000000
  203.   203 #define EADOGM_CMD_SELECT_R0     0b00011000
  204.   204 #define EADOGM_CMD_SELECT_R1     0b00010000
  205.   205 #define EADOGM_CMD_SET_TABLE2    0b00101010
  206.   206
  207.   207
  208.   208 // spi hw clock div, v2.03 fix
  209.   209 #ifndef EADOGM_SPI_DIV
  210.   210    #define EADOGM_SPI_DIV SPI_CLK_DIV_4
  211.   211 #endif
  212.   212
  213.   213
  214.   214
  215.   215 // sw spi emulation routine (bit bang)
  216.   216 #ifdef EADOGM_SPI_SW
  217.   217    #ifndef EADOGM_SCLK_BB
  218.   218      #define EADOGM_SCLK_BB PIN_C3
  219.   219    #endif
  220.   220    #ifndef EADOGM_MOSI_BB
  221.   221      #define EADOGM_MOSI_BB PIN_C5
  222.   222    #endif
  223.   223
  224.   224
  225.   225 void eaDogM_iniSPI_BB(void)
  226.   226 {
  227.   227    output_drive(EADOGM_SCLK_BB);
  228.   228    output_drive(EADOGM_MOSI_BB);
  229.   229    output_low(EADOGM_SCLK_BB);
  230.   230    output_low(EADOGM_MOSI_BB);
  231.   231 }
  232.   232
  233.   233 void eaDogM_spiWrite_BB(int8 regData)
  234.   234 {
  235.   235
  236.   236   int1 bitOut;
  237.   237   int8 SPICount;                               // Counter used to clock out the data
  238.   238   int8 SPIData;                                // Define a data structure for the SPI data.
  239.   239
  240.   240   output_low(EADOGM_SCLK_BB);                         // and CK low
  241.   241
  242.   242   SPIData = regData;
  243.   243   for (SPICount = 0; SPICount < 8; SPICount++) // Prepare to clock out the Address byte
  244.   244     {
  245.   245     bitOut = bit_test(SPIData,7);
  246.   246     output_bit(EADOGM_MOSI_BB,bitOut);
  247.   247     output_high(EADOGM_SCLK_BB);                      // Toggle the clock line
  248.   248     //delay_us(10);
  249.   249     output_low(EADOGM_SCLK_BB);
  250.   250     //delay_us(10);
  251.   251     SPIData = SPIData << 1;                    // Rotate to get the next bit
  252.   252     }                                          // and loop back to send the next bit
  253.   253
  254.   254   output_low(EADOGM_MOSI_BB);
  255.   255 }
  256.   256
  257.   257 // wrapper for sw spi calls in main program
  258.   258 // v2.01 moved to macro define
  259.   259 #define eaDogM_outSPI(c) eaDogM_spiWrite_BB(c)
  260.   260 #endif
  261.   261
  262.   262 // wrapper for hw spi calls in main program
  263.   263 // v2.01 moved to a macro define
  264.   264 #if EADOGM_SPI_HW == 1
  265.   265    #define eaDogM_outSPI(c) spi_write(c)
  266.   266 #endif
  267.   267
  268.   268 // wrapper for hw2 spi calls in main program
  269.   269 // v2.01 moved to a macro define, v2.03 using EADOGM_SPI_HW to test condition
  270.   270 #if EADOGM_SPI_HW == 2
  271.   271    #define eaDogM_outSPI(c) spi_write2(c)
  272.   272 #endif
  273.   273
  274.   274
  275.   275 #ifdef EADOGM_8BIT
  276.   276 void eaDogM_ini8Bit(void)
  277.   277 {
  278.   278 #ifndef EADOGM_NOCSB
  279.   279    output_drive(EADOGM_PIN_CSB);
  280.   280    output_high(EADOGM_PIN_CSB);
  281.   281 #endif
  282.   282    output_drive(EADOGM_PIN_E);
  283.   283    output_drive(EADOGM_PIN_RW);
  284.   284    output_drive(EADOGM_PIN_RS);
  285.   285    output_low(EADOGM_PIN_E);
  286.   286    output_low(EADOGM_PIN_RS);
  287.   287    output_low(EADOGM_PIN_RW);
  288.   288 }
  289.   289 #endif
  290.   290
  291.   291
  292.   292
  293.   293 #ifdef EADOGM_8BIT
  294.   294 // 8bit mode
  295.   295 void eaDogM_WriteChr(char value)
  296.   296 {
  297.   297    output_high(EADOGM_PIN_RS);
  298.   298    output_low(EADOGM_PIN_RW);
  299.   299    output_low(EADOGM_PIN_E);
  300.   300    #ifndef EADOGM_NOCSB
  301.   301      output_low(EADOGM_PIN_CSB);
  302.   302      #endif
  303.   303    output_high(EADOGM_PIN_E);
  304.   304    delay_ms(1);
  305.   305    EADOGM_8BIT_PORT(value);
  306.   306    output_low(EADOGM_PIN_E);
  307.   307    delay_ms(1);
  308.   308    #ifndef EADOGM_NOCSB
  309.   309      output_low(EADOGM_PIN_CSB);
  310.   310      #endif
  311.   311    delay_ms(1);
  312.   312 }
  313.   313
  314.   314 void eaDogM_WriteCommand(int8 cmd)
  315.   315 {
  316.   316    output_low(EADOGM_PIN_RS);
  317.   317    output_low(EADOGM_PIN_RW);
  318.   318    output_low(EADOGM_PIN_E);
  319.   319    #ifndef EADOGM_NOCSB
  320.   320      output_low(EADOGM_PIN_CSB);
  321.   321      #endif
  322.   322    output_high(EADOGM_PIN_E);
  323.   323    delay_ms(1);
  324.   324    EADOGM_8BIT_PORT(cmd);
  325.   325    output_low(EADOGM_PIN_E);
  326.   326    delay_ms(1);
  327.   327    #ifndef EADOGM_NOCSB
  328.   328      output_low(EADOGM_PIN_CSB);
  329.   329      #endif
  330.   330    delay_ms(1);
  331.   331 }
  332.   332 #else
  333.   333 // spi mode
  334.   334 void eaDogM_WriteChr(char value)
  335.   335 {
  336.   336    output_high(EADOGM_PIN_RS);
  337.   337    output_low(EADOGM_PIN_CSB);
  338.   338    eaDogM_outSPI(value);
  339.   339    output_high(EADOGM_PIN_CSB);
  340.   340    delay_ms(1);
  341.   341 }
  342.   342
  343.   343 void eaDogM_WriteCommand(int8 cmd)
  344.   344 {
  345.   345    output_low(EADOGM_PIN_RS);
  346.   346    output_low(EADOGM_PIN_CSB);
  347.   347    eaDogM_outSPI(cmd);
  348.   348    output_high(EADOGM_PIN_CSB);
  349.   349    delay_ms(1);
  350.   350 }
  351.   351 #endif
  352.   352
  353.   353
  354.   354 void eaDogM_Initialize(void)
  355.   355 {
  356.   356
  357.   357 // v2.03 fix
  358.   358 #if EADOGM_SPI_HW  == 1
  359.   359    setup_spi( SPI_MASTER | SPI_H_TO_L | EADOGM_SPI_DIV );
  360.   360 #endif
  361.   361
  362.   362 // v2.03 fix
  363.   363 #if EADOGM_SPI_HW  == 2
  364.   364    setup_spi2( SPI_MASTER | SPI_H_TO_L | EADOGM_SPI_DIV );
  365.   365 #endif
  366.   366
  367.   367 #ifdef EADOGM_SPI_SW
  368.   368    eaDogM_iniSPI_BB();
  369.   369 #endif
  370.   370
  371.   371 #ifdef EADOGM_8BIT
  372.   372    eaDogM_ini8Bit();
  373.   373 #else
  374.   374    output_drive(EADOGM_PIN_CSB);
  375.   375    output_drive(EADOGM_PIN_RS);
  376.   376    output_high(EADOGM_PIN_CSB);
  377.   377    output_high(EADOGM_PIN_RS);
  378.   378 #endif
  379.   379
  380.   380    delay_ms(200);
  381.   381
  382.   382    eaDogM_WriteCommand(EADOGM_INIT_FS1);
  383.   383    eaDogM_WriteCommand(EADOGM_INIT_BIAS_SET);
  384.   384    eaDogM_WriteCommand(EADOGM_INIT_POWER_CONTROL);
  385.   385    eaDogM_WriteCommand(EADOGM_INIT_FOLLOWER_CONTROL);
  386.   386    eaDogM_WriteCommand(EADOGM_INIT_CONTRAST_SET);
  387.   387    eaDogM_WriteCommand(EADOGM_INIT_FS2);
  388.   388    eaDogM_WriteCommand(EADOGM_INIT_CLEAR_DISPLAY);
  389.   389    eaDogM_WriteCommand(EADOGM_INIT_ENTRY_MODE);
  390.   390
  391.   391 }
  392.   392
  393.   393 // sets contrast, call with a value from 0 to 15
  394.   394 // we also mask off upper 4 bits from c
  395.   395 // v2.01 moved to a macro define
  396.   396 #define eaDogM_SetContrast(c) eaDogM_WriteCommand(EADMCMD_CONTRAST + (c & 0b00001111))
  397.   397
  398.   398 // only tested on 3 line display at the moment,
  399.   399 // thus no constants defined. when fully tested, I will define them
  400.   400 void eaDogM_DoubleHeight(int8 row) // row 0 or 1
  401.   401 {
  402.   402    eaDogM_WriteCommand(EADOGM_CMD_SET_TABLE2); // set instruction table 2
  403.   403    if (row == 0) {
  404.   404      eaDogM_WriteCommand(EADOGM_CMD_SELECT_R0); // select row 0
  405.   405      }
  406.   406    if (row == 1) {
  407.   407      eaDogM_WriteCommand(EADOGM_CMD_SELECT_R1); // select row 1
  408.   408      }
  409.   409    eaDogM_WriteCommand(0b00101100); // turns on double line mode
  410.   410                                     // and set instruction table back to 0
  411.   411 }
  412.   412
  413.   413 // v2.01 moved functions to macros
  414.   414 #define eaDogM_DoubleHeightOff() eaDogM_WriteCommand(0b00101000)
  415.   415 #define eaDogM_Cls()             eaDogM_WriteCommand(EADOGM_CMD_CLR)
  416.   416 #define eaDogM_CursorOn()        eaDogM_WriteCommand(EADOGM_CMD_CURSOR_ON)
  417.   417 #define eaDogM_CursorOff()       eaDogM_WriteCommand(EADOGM_CMD_CURSOR_OFF)
  418.   418 #define eaDogM_DisplayOn()       eaDogM_WriteCommand(EADOGM_CMD_DISPLAY_ON)
  419.   419 #define eaDogM_DisplayOff()      eaDogM_WriteCommand(EADOGM_CMD_DISPLAY_OFF)
  420.   420
  421.   421
  422.   422 void eaDogM_SetPos(int8 r, int8 c)
  423.   423 {
  424.   424    int8 cmdPos;
  425.   425    cmdPos = EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN) + c;
  426.   426    eaDogM_WriteCommand(cmdPos);
  427.   427 }
  428.   428
  429.   429 void eaDogM_ClearRow(int8 r)
  430.   430 {
  431.   431    int8 i;
  432.   432    eaDogM_SetPos(r,0);
  433.   433    for(i=0; i<EADOGM_COLSPAN; i++) {
  434.   434      eaDogM_WriteChr(' ');
  435.   435    }
  436.   436 }
  437.   437
  438.   438 void eaDogM_WriteString(char *strPtr)
  439.   439 {
  440.   440    printf(eaDogM_WriteChr,"%s",strPtr);
  441.   441 }
  442.   442
  443.   443
  444.   444 // Optional DisGIE, set to 1 to disable interrupts
  445.   445 // v1.4 -- provided by Imaginos
  446.   446 void eaDogM_WriteStringAtPos(int8 r, int8 c, char *strPtr, int1 DisGIE=0)
  447.   447 {
  448.   448    if (DisGIE) {
  449.   449       disable_interrupts(GLOBAL);
  450.   450       }
  451.   451
  452.   452    eaDogM_WriteCommand((EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN) + c));
  453.   453    printf(eaDogM_WriteChr,"%s",strPtr);
  454.   454
  455.   455    if (DisGIE) {
  456.   456       enable_interrupts(GLOBAL);
  457.   457       }
  458.   458 }
  459.   459
  460.   460 // Optional DisGIE, set to 1 to disable interrupts
  461.   461 // v1.4 -- provided by Imaginos
  462.   462 void eaDogM_WriteIntAtPos(int8 r, int8 c, int8 i, int1 DisGIE=0)
  463.   463 {
  464.   464    if (DisGIE) {
  465.   465       disable_interrupts(GLOBAL);
  466.   466       }
  467.   467
  468.   468    eaDogM_WriteCommand((EADOGM_CMD_DDRAM_ADDR + (r * EADOGM_COLSPAN) + c));
  469.   469
  470.   470    eaDogM_WriteChr(i/10+'0');
  471.   471    eaDogM_WriteChr(i%10+'0');
  472.   472
  473.   473    if (DisGIE) {
  474.   474       enable_interrupts(GLOBAL);
  475.   475       }
  476.   476 }
  477.   477
  478.   478 // this writes a byte to the internal CGRAM (v2.02)
  479.   479 // format for ndx: 00CCCRRR = CCC = character 0 to 7, RRR = row 0 to 7
  480.   480 void eaDogM_WriteByteToCGRAM(char ndx, char data)
  481.   481 {
  482.   482    unsigned int cmd;
  483.   483
  484.   484    cmd = ndx & 0b00111111; // mask off upper to bits
  485.   485    cmd = cmd | EADOGM_CMD_CGRAM_ADDR; // set bit cmd bits
  486.   486
  487.   487    eaDogM_WriteCommand(cmd);
  488.   488    eaDogM_WriteChr(data);
  489.   489
  490.   490    // this is done to make sure we are back in data mode
  491.   491    eaDogM_SetPos(0,0);
  492.   492 }
  493.   493
  494.   494
  495.   495 #endif
  496.   496
(#) BoKKeR hozzászólása Aug 29, 2011 /
 
Sziasztok. Egy régi fujitsu siemens-bol szedtem ki a LCD monitort amit mulkodésbe szeretnék hozni.még semmire sem jutottam csak gondolom hogy az also 2 bemenetel a háttérvilágítás-ra szolgál és az áram ellátásra... a bekotés mindegy milyen lesz csak a végén valami használhato legyen DVI-HDMI-VGA. A notebook nem mulkodik szoval nem tudom át mérni.
(#) dannu válasza BoKKeR hozzászólására (») Aug 29, 2011 /
 
Kezdésnek tudnám ajánlani hogy ennek a kijelzőnek megkeresed a láb kiosztását valahol a neten mert sajnos nem úgy működik hogy ezt ide forrasztom ezt oda forrasztom és kész . Ha ez megvan akkor egy avr-el és egy kicsi programozással megtudnád szerintem csinálni hogy rca ról működjön. Olvasgass az lcd Ebbe a topicba .
(#) kiskata válasza pipi hozzászólására (») Szept 1, 2011 /
 
Pedig szuper lenne...
..mert még nem boldogulok vele...
(#) pipi válasza dannu hozzászólására (») Szept 1, 2011 /
 
Szia!
Ezt a "kis programkát" meg a kis avr hardwerecskét szivesen megnézném ami egy noti kijelzőt meghajt kompozit videóról
(#) pipi válasza kiskata hozzászólására (») Szept 1, 2011 /
 
Hát nehéz segíteni ha nem tudjuk mi a gond, hol akadtál el
(#) varttina hozzászólása Szept 2, 2011 /
 
Sziasztok!

Nemrég kezdtem digitális technikával foglalkozni, úgyhogy lehet hogy kicsit furán fog hangzani a kérdésem.
A lényeg: Mekkora sebességgel tudja fogadni egy karakteres LCD modul (pl. BC-1602) az utasításokat? Van egy 16MHz-en járó AVR-em, ha nop utasítások közbeiktatása nélkül küldöm az adatokat az LCD-nek, azt még tudja venni?
(#) pipi válasza varttina hozzászólására (») Szept 2, 2011 /
 
Kijelző tipus/gyártófüggő, ha már így tudod a tipusát talán meg kellene nézne az adatlap mit ír.
Nem annyira az adatok között kell várni hanem a vezérlőjelek billegtetésénél fontos.
Javasolt lassúbb időzítésre írni, mert utánépítésnél lesznek csodák, hogy nincs/szemét a kijelzés, főleg ha holnap is kell tudni reprodukálni a cuccost, mert ki tudja milyen kijelzőt kapsz
(#) varttina válasza pipi hozzászólására (») Szept 4, 2011 /
 
Egyenlőre egészen lassú időzítéssel vezérlem az LCD-t, így szabad szemmel is követhetem, hogy éppen mit ír ki. Ha már rendesen tudom kezelni az LCD-t, felgyorsítom a kiírást.
(#) edison14 hozzászólása Szept 13, 2011 /
 
Hali. Kijelzőre kellene kiíratnom á betűt de nem nagyon akar menni. A HD44780-as vezérlő A02-es ROM-jában található ez a karakter de amikor a kódját beillesztettem a forráskódba és felélesztettem a kijelzőt akkor a kódhoz megfelelő karaktert írta ki a kijelzőre de az A00-ás ROM-ból. Hogyan tudok átváltani az A02-es ROM-ba?
(#) icserny válasza edison14 hozzászólására (») Szept 13, 2011 /
 
Nem akarok nagy hülyeséget írni, de szerintem ahhoz egy másik (cirill betűs) kijelzőt kellett volna venned (amiben A02 kódtáblával jön a HD44780).

Így egyetlen lehetőségként marad a CGRAM, a 8 db. felhasználó által definiálható karakterrel.
(#) icserny válasza varttina hozzászólására (») Szept 13, 2011 /
 
Idézet:
„Van egy 16MHz-en járó AVR-em, ha nop utasítások közbeiktatása nélkül küldöm az adatokat az LCD-nek, azt még tudja venni?”
Biztosan nem tudja, mert a kijelző vezérlője jóval kisebb frekvencián ketyeg, s az adat/parancs vétele után még fel is kell dolgoznia azt. Ha biztosra akarsz menni, akkor (inicializálás után!) figyelhető a foglaltsági jel (D7 biten), s addig nem küldesz újabb adatot, amíg az LCD foglaltat jelez.
(#) edison14 válasza icserny hozzászólására (») Szept 13, 2011 /
 
De támogatja az európai nyelveket.
(#) pipi válasza edison14 hozzászólására (») Szept 13, 2011 /
 
A rom csak egy féle karkészletet tartalmaz, mint icserny is írta, erről az lcd gyártó adatlapjában találhatsz infót (és nem a hd44780 adatlapján!).
Irj egy kis progit ami kipöfögi az összes karaktert, és akkor meglátod tudja-e a kivánt betűket
(#) edison14 válasza pipi hozzászólására (») Szept 14, 2011 /
 
Nos én a kijelző adatlapját néztem. És ott is az volt irva, hogy eng/eur karakterkészlet van benne, de azt nem irta hogy hányas cimű ROM-ot használja. A kijelző tipusa BC2002CYPLEH.
(#) pipi válasza edison14 hozzászólására (») Szept 15, 2011 /
 
Ugye az eng az nagyjából ascii 7f-ig, felette meg az eur, de annak a kódkiosztásnak szerintem semmi köze semmilyen kódkészletnek, gyártónként tök egyedi lehet, ezért írtam hogy pöfögd ki a karaktereket, és aszerint használd
(#) edison14 válasza pipi hozzászólására (») Szept 16, 2011 /
 
Azóta már kiírattam az összeset és nem voltak köztük ékezetesek. Úgy vettem észre hogy ez a kijelző csak a 00-ás ROM-ot kezeli. Köszönöm a válaszokat.
(#) pipi válasza edison14 hozzászólására (») Szept 17, 2011 /
 
akkor marad az első 8 felhasználó altal definiálható...
(#) edison14 válasza pipi hozzászólására (») Szept 17, 2011 /
 
Hát igen :yes:
(#) Kulitronik hozzászólása Szept 23, 2011 /
 
Problemam igazabol az lenne hogy a csatlakozo folia, ra van ragasztva az aramkorre.Hogyan tudnam leszedni illetve raragasztani az uj kijelzot?
(#) kovacsj hozzászólása Okt 4, 2011 /
 
Sziasztok!
Nekem egy 1602A- 2x16-os karakteres LCD-vel van most problémám. 4bites üzemmódban szeretném életre kelteni. Korábban már csináltam ilyet, és akkor jól működött, de az egy Atmega2561-es volt, ez meg egy Atmega16-os.
A 4 bit a PORTA0-PORTA3 lábakon vannak, az RS és az EN a PORTC6 és PORTC7. A Fleury-féle lcd.h-t átírtam ennek megfelelően. A rövid program lefordul, de a kijelző üres marad. 8-biten működik, igaz, nem azzal a library-vel hanem a zombee által írottal.
  1. #define LCD_PORT         PORTA        /**< port for the LCD lines   */
  2. #define LCD_DATA0_PORT   LCD_PORT     /**< port for 4bit data bit 0 */
  3. #define LCD_DATA1_PORT   LCD_PORT     /**< port for 4bit data bit 1 */
  4. #define LCD_DATA2_PORT   LCD_PORT     /**< port for 4bit data bit 2 */
  5. #define LCD_DATA3_PORT   LCD_PORT     /**< port for 4bit data bit 3 */
  6. #define LCD_DATA0_PIN    0            /**< pin for 4bit data bit 0  */
  7. #define LCD_DATA1_PIN    1            /**< pin for 4bit data bit 1  */
  8. #define LCD_DATA2_PIN    2            /**< pin for 4bit data bit 2  */
  9. #define LCD_DATA3_PIN    3            /**< pin for 4bit data bit 3  */
  10. #define LCD_RS_PORT      PORTC     /**< port for RS line         */
  11. #define LCD_RS_PIN       6            /**< pin  for RS line         */
  12. #define LCD_RW_PORT      PORTC     /**< port for RW line         */
  13. #define LCD_RW_PIN       5            /**< pin  for RW line         */
  14. #define LCD_E_PORT       PORTC     /**< port for Enable line     */
  15. #define LCD_E_PIN        7            /**< pin  for Enable line     */
  16.  
  17. Ez az lcd.h átírt része.
  18.  
  19.  
  20. #define F_CPU 4000000
  21. #include <avr/io.h>
  22. #include <util/delay.h>
  23. #include "lcd.h"
  24.  
  25. int main() {
  26. lcd_init(LCD_DISP_ON);
  27. lcd_clrscr();
  28. lcd_gotoxy(0,0);
  29. lcd_puts("Proba");
  30. while(1);
  31.  
  32. return 0;
  33. }
  34.  
  35. Ez meg a kód lenne.


Mi lehet a hiba?
Mit nem csináltam meg?
Előre is nagyon köszönöm!
(#) proli007 válasza kovacsj hozzászólására (») Okt 5, 2011 /
 
Hello!
Úgy gondolom, ahhoz, hogy valaki valamit mondjon érdemlegeset, ahhoz az "lcd.h"-t is fel kellett volna tenned. És az egyáltalán a négy bites adatátvitelt támogatja?
De az LCD inicializálásához, a bekapcsolás, és törlés igen kevés. Nézd meg a 1602 adatlapján, a négybites üzemmód inicializálásának eljárását... De legalább ezt olvasd el, egyezik-e az eljárás menete a programoddal.
üdv! proli007
(#) sooty hozzászólása Okt 12, 2011 /
 
Sziasztok! Van egy 2x40 karakteres lcd kijelzőm (hitachi vezérlővel) ha üzemeltetem nagyon halványan, sarkított fényben látható rajta a kijelzés annak ellenére, hogy a 3. lábán megkapja a teljes kontraszthoz szükséges potenciált (GND). A bemeneten van egy pár 100 ohmos ellenállás, ha azokat átzárom kicsit jobban látszik a kiírás, de még mindíg nem használható. Hogyan lehet a kontrasztot növelni? Dobjam el? Cseréljem ki a HD44780-at rajta (2x16 os kijezőből)?
(#) vicsys válasza sooty hozzászólására (») Okt 12, 2011 /
 
Elsőre 2 dolog jutott eszembe:
1. Nincs bekapcsolva a háttérvilágítás (ha van rajta)
2. A vezérlő program túl gyorsan kapcsolgatja az adatokat (kiírás), amiben van egy köztes törlés utasítás is (pl.).
(#) sooty válasza vicsys hozzászólására (») Okt 12, 2011 /
 
Szia! Nincs háttérvilágítása. Ugyanaz a kapcsolás viszi a többi kijelzőmet (2x20,4x20,4x40) kifejezetten teszternek alakítottam át, mert a kapcsolás hibájára is gondoltam már. (A dcf-es lcd óra programja van benne). Azért kérdeztem, hátha valaki már javított ilyen kijelzőt. (próbálkoztam polárszűrővel is, hátha az hiányzik előle, de nem javult a helyzet)
(#) zenetom válasza sooty hozzászólására (») Okt 12, 2011 /
 
Szia!
Ha van lehetőséged egy fix szöveg kiíratására, akkor próbáld ki azt (tehát nem frissíted a kijelzőt, csak kiírsz egy pár karaktert).
Következő: »»   22 / 71
Bejelentkezés

Belépés

Hirdetés
XDT.hu
Az oldalon sütiket használunk a helyes működéshez. Bővebb információt az adatvédelmi szabályzatban olvashatsz. Megértettem