Bavarian Soundwerks
Page 31 of 79 FirstFirst ... 621222324252627282930313233343536373839404156 ... LastLast
Results 751 to 775 of 1959

Thread: Feeler: Open Source OBC Firmware

  1. #751
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    Quote Originally Posted by Dricebrug View Post
    ^^^
    You have a unique taste is music.

    M2pc, That second graphic LCD, ordered. Not sure how I did not come across that before. Most of these LCDs are all the same, and the only thing making them "Amber" or "green" is simply the LED backlight used. So, I will mess around with that to try to match amber.

    Not having messed with a mbed, and I'm not sure what the best way to run this would be.
    Cool, let us know how it works for you. Here's a link to the datasheet for the display: http://www.modtronix.com/products/lcd/sed1520.pdf

    It appears to be a standard 8-bit parallel display. If you have pins to spare on your microcontroller, you can drive it in this mode, or use a 74HC595 to turn the display into an SPI peripheral.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  2. #752
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    UPDATE: I just finished the board layout after working on this constantly for the past 10 days:



    I still need to verify all traces and make sure all ground planes are properly linked, but the bulk of the work is done!

    Note: This design includes a small CR2032 battery holder to keep the RTC alive when the vehicle's battery is disconnected. See rectangle just to the left of the X1071 connector.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  3. #753
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Funny you should mention this; Mefis (another member who's produced an openOBC board earlier in this thread) reported this phenomenon earlier but I didn't believe him; I guess this is confirmation then!
    Ha, that's funny. Well I'm glad I could confirm the concept; It would be interesting to do this at a slower speed (possibly with your slower crystal) to see if there are any pre-set messages which you missed. I assume a self test like this would be going through each and every possible message in memory.

    The strange part is when I first stuck the OBC on a logic analyzer to decode the data, I clearly saw the ASCII values for "INPUT TIME" being sent over the SPI interface, presumably going from the OEM OBC board -> display. I wonder if the OEM board triggered the display and the display send these values? Either way, I think it's best to just send all the text ourselves, since the openOBC is all about flexibility.
    I definitely agree 100%. That's what I'm after, complete flexibility!

    The OBC display is standard ASCII, with some funny exceptions. Example: a single quote mark (') is rendered as a tall, narrow "degree" symbol. To get a real single quote, you need to use a back-quote (`) which is rendered as (').
    That's interesting; You know when I was a kid I didn't know what that was called, so I called it a "bucomma" (pronounced BYEW comma), which stood for (B)ackwards (U)psidedown (Comma)

    Dumb question, but I assume you have all the backlight lamps enabled, right? The only time I ran into this is when I had the contrast voltage too low or high.
    I will definitely have a look at that, thanks for the suggestion.


    It looks like a good start so far! Let us know if you get any further...
    I will definitely keep you posted.. From the code I wrote, does it look to you like I followed everything correctly from your notes? I just want to make sure I am not approaching the execution incorrectly before I go trying to debug why it doesn't work...

  4. #754
    Join Date
    Jul 2007
    Location
    North Delaware
    Posts
    3,013
    My Cars
    BMWs
    Oh hi



    Now I'm planning on running a serial LCD behind the cluster while running the OBC off this bad boy.

  5. #755
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    ^^^ Awesome, you're going to love the mbed!

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  6. #756
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Hi M2PC;

    This thing is really giving me a headache.. Can I just ask you if this approach is correct in an examples where I would like to write the letter "r" to the LCD:

    All pins except MISO are set to output
    All pins with the exception of ENABLE start LOW
    PIN 4 (Fix at 1) is connected to GND permanently

    ENABLE pin goes low for 10us, then goes back high

    WAIT 250ms or more

    ASCII 82 is sent to the SPI bus

    CONFIG STROBE (aka. ICON STROBE) is set high for 50us then back to low

    DATA STROBE is set high for 50us then back to low

    FINAL STROBE is set high for 50us, then back to low


    ---

    Is this the correct approach? I am trying to determine if I am approaching it incorrectly or if my code is not performing correctly or if I have a broken LCD because i am not getting expected behavior from any of my trials
    Last edited by catatung; 03-26-2011 at 02:23 AM.

  7. #757
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    I have some good progress!!

    silly me, I did not realize that the LCD writes the characters from right to left. There were a couple of backlight bulbs which were burned out so arranged the good ones I had to light up the longer segment; In all of my trials I have been writing one character to try and see if I can get it to display on the board; Well any time I did it right obviously i could not see it because it was in the clock segment which was fully darkened. Just out of frustration I repeated my character writing line 10 times and flashed the Arduino and viola I see all of my R's now

    Still though, can you confirm I have the approach correctly as explained above?

    thanks!!

  8. #758
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no


    I will be writing a nice arduino library/routines for interfacing to this LCD.. I'll share it here in case anyone wants to use it for their project.. Thanks again for all of your help!

    I'm so glad this mystery is solved I just busted out a couple of 3:00am Rolling Rocks

    Next is to find out why the contrast/pixels aren't lit up like they should be... First on my checklist is to go back a few posts and look to see if you mentioned using a resistor in series to power the backlight.. I know you said you did for the small LEDS inside the buttons... But not sure if you mentioned it for the LCD backlight... I have been using direct +12v during my brief illuminations for testing

    ** I just saw you said a 120ohm resistor and a diode is on the OEM board.. I tried a 39Ohm resistor and it's pretty dark. I imagine 120 would almost completely block out the light entirely. Do you have any suggestions how to remedy this? If you look at the video I posted above, when I disconnect the square wave refresh signal, the line which was being drawn at the moment lights up bright like it should be which is interesting... Any ideas?

    It's time for bed for me, i have work at 11!
    Last edited by catatung; 03-26-2011 at 03:30 AM.

  9. #759
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    Way to go man! Ive done the "beer in the middle of the night" celebration before myself!

    As for the LCD backlight, giving it direct +12V is fine; the 120 ohm resistor is for the keypad LED backlight.

    You could try a 1K ohm resistor in series with the LCD bias pin into the center leg of a 10K pot with the sides of the pot to GND and +12V. The LCD contrast may be off. Adjust the pot for the best contrast, then you can replace it with a fixed resistor divider with the same values.

    Great job and good luck!
    Last edited by m2pc; 03-26-2011 at 12:18 PM.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  10. #760
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    Quote Originally Posted by catatung View Post
    I have some good progress!!

    silly me, I did not realize that the LCD writes the characters from right to left. There were a couple of backlight bulbs which were burned out so arranged the good ones I had to light up the longer segment; In all of my trials I have been writing one character to try and see if I can get it to display on the board; Well any time I did it right obviously i could not see it because it was in the clock segment which was fully darkened. Just out of frustration I repeated my character writing line 10 times and flashed the Arduino and viola I see all of my R's now

    Still though, can you confirm I have the approach correctly as explained above?

    thanks!!
    Really? In my interface, it's L -> R (normal reading direction).

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  11. #761
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Hmm, I will confirm it tonight, I was only assuming because I was getting no output but then when I copy-pasted the SPI.transfer lines for ascii 82 over and over, I then saw a bunch of R's... so I was assuming that the clock portion of the readout (which had no backlight bulbs) held the first R and I just couldn't see it the first time when I was writing only one R.

    i'll let you know when i find out for sure. I'll shine an LED flashlight in the hole while writing only one R

  12. #762
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    It's truly LEFT-RIGHT; otherwise your "Thanks M2PC" message would have to be sent in reverse. My working code confirms this; in fact the very first time I intercepted and decoded the ASCII by hand it was "INPUT TIME" from left -> right.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  13. #763
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Hmm that's interesting, I clearly remember the only change I made from one trial to the next was writing more characters to the SPI and then it worked. Perhaps there is a minimum amount of text it will accept? I'll take down my code to one character again and see if it works still.

  14. #764
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    IIRC you have to clock all the data in (28 characters) before the LCD will "accept" this and update itself.

    There's 20 main characters + 4 "clock" characters. I send these plus ASCII 0x08 (TAB) plus 3 of 0x20 (SPACE) characters to complete the 28 character buffer.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  15. #765
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Well I did some tests, from the results it looks like with fix@1 to +12v the first 8 bytes are for clock segment encoding; anything after that gets written into the longer segment however, there are lowercase L's all along the segment which don't seem to go away. Perhaps there is a byte in the first 8 which indicate separator character? Here is the results of some of my tests:

    1 or2 ascii 65 written: NO output, blank

    3 ascii 65 written:


    4 ascii 65 written:


    5 ascii 65 written:


    6 ascii 65 written:


    7 ascii 65 written:


    8 ascii 65 written:


    9 ascii 65 written, fix@1 to GND or NC:


    18 or 27 ascii 65 written, fix@1 to 12v:



    I'm going to review your notes and maybe do some more tests, and if you have any suggestions on what to try next, hit me with them!
    Last edited by catatung; 03-28-2011 at 01:19 AM. Reason: My ADD, I forgot to note 1 and 2 ascii 65 written

  16. #766
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    I saw your post ^^ above mine.. I just wrote 24 ascii 65's, then did a 0x09 (I assume you meant 0x09, 0x08 is backspace) and then 3 0x20's.. I had all A's nicely spaced (the annoying bar's were gone) but the last character was garbled. Assuming the garbled character was thes 0x09, I then i tried:

    (1) "E" -- this is to indicate if the first character is ignored, as per my suspicion
    (20) "A" -- Text fill
    (3) "A" - Clock fill
    (1) "B" - Clock fill identify digit displayed
    (1) 0x09 - TAB as you said
    (2) 0x20 - spaces

    And I did not see an E, and the last character was garbled. I then sent:

    (1) E
    (1) B
    (17) A
    (1) B

    (3) A
    (1) B

    (1) C
    (3) space

    This gave me "BAAAAAAAAAAAAAAAAABA AA BC"

    This indicates that the first character was ignored or processed for some other purpose which appears transparent to it's behavior (so far);

    I tried changing the 26th byte from a space to a 0x09 like you said but this turned on a whole bunch of other icons - the speaker icon in the top right corner, the left pointing triangle at the end of the text area and the plus sign. I'm assuming different values here will turn on different icons. This was all done with Fix@1 set to 12V, not GND as in your design.

    Perhaps this is a way to achieve control of text AND icons without setting it with a pin high/low? If we've both found a different way that operates the LCD correctly maybe take a look at whichever one makes the most sense and implement that into your design. If you're sure on that 28 byte buffer then I'm assuming the last 2 bytes count for something else also, probably relevant to behavior. And the first character being ignored is interesting also. Perhaps the contrast can be controlled by software as well? I wonder if BMW assumed one of their model cars that would be equipped with this LCD may have a light sensor for headlights (night time vs day time) and have the ability to automatically dim the contrast and backlight...

    *edit: I went through dec 00 to 20 and the only useful behavior so far was 13, which enables the speaker volume icon, plus sign and the clock's colon. Other values seem to have an effect on pixels between characters. I haven't played with the last two bytes yet. I will let you know if I find anything interesting.
    Last edited by catatung; 03-28-2011 at 02:14 AM.

  17. #767
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no

    Arduino code for interfacing the LCD

    Okay guys, I've written some Arduino code that works with this LCD. Hopefully this will help somebody someday. I do not have any experience in creating libraries for Arduino so i've written an example program that is very self-explanitory and well commented. You can modify it for your needs.

    Code:
    /*
        wlcd.pde - Example code for controlling an LCD device found in the BMW 3 series from 1992-1999
                   with an Arduino.  Please see www.openobc.org for more information regarding the
                   particular unit.  Special thanks goes out to M2PC, admin of openobc.org.
                   
                   Created by Randy Praster, Monday March 28, 2011.  randy22nj@aol.com
                   Version 1.0; Released into the public domain.
               
    
    Connections for this example are made as follows:
    
    LCD pin:   Arduino pin:    purpose:
    1          +5v             power for LCD controller
    2          gnd             ground
    3          +5v             power for the LCD contrast
    4          +5v             text select pin
    5          D4              config_strobe pin *confirmed working with this pin omitted*
    6          D5              data_strobe pin
    7          D13             used by SPI library; SPI clock pin
    8          D11             used by SPI library; MOSI (data) pin
    9          D2              final_strobe pin
    10         D3              used by SPI library; Slave Select pin
    
    11         to 100khz square wave signal; this can be generated with a 555 IC timer or
               with a PWM circuit running 20us period, 10us pulse width and 50% duty cycle
    
    notes:
    
    	LCD pin 1 is the wire nearest to the left side of the display (the larger text area)
            
    	pin 5 is used only when requesting icons.  If using only text this pin can be omitted.           
    	This code does not provide access to the hour separating colon as well as other icons
    	on the screen.  Look for this support in a future version release. 
    	
            The 1 second delays can be reduced to 250ms if you need the LCD to update asap.
            
    	This code relies on the SPI routines included with the Arduino software v0022.
            Please keep in mind that future changes to this SPI code could affect the operation
            of this software.
    
    */
    
    #include <SPI.h>
    
    // Global variables are defined here
     int final_strobe = 2;
     int enable = 3;
     int config_strobe = 4;
     int data_strobe = 5;
     
     int ss = 10; 
     int mosi = 11;
     int miso = 12; //unused but defined here anyway
     int clock = 13;
     
     
    void setup()
    {
    
      // write text to the LCD
      writelcd("this is a", "test");
    
    } 
    
    void loop() {}
    
    
    int writelcd(String seg1,String seg2) {
      
      // set all pin modes (arduino defaults pins to INPUT if not defined otherwise)
      pinMode(final_strobe, OUTPUT);
      pinMode(enable, OUTPUT);
      pinMode(config_strobe, OUTPUT);
      pinMode(data_strobe, OUTPUT);
      pinMode(ss, OUTPUT);
      pinMode(mosi, OUTPUT);
      pinMode(miso, INPUT); // The LCD does not communicate back and this is unused, but defined here anyway for thoroughness.
      pinMode(clock, OUTPUT);
      
      // set default pin states
      digitalWrite(final_strobe, LOW);
      digitalWrite(enable, HIGH);
      digitalWrite(config_strobe, LOW);
      digitalWrite(data_strobe, LOW);
      digitalWrite(clock, LOW);
      
      // delay 1 second
      delayMicroseconds (1000000); 
      
      // begin SPI
      SPI.begin();
      
      // INIT LCD for communication on the SPI bus
      digitalWrite (enable, LOW);
      delayMicroseconds (10);
      digitalWrite (enable, HIGH);
      
      // delay 1 second
      delayMicroseconds (1000000); 
      
      // segment #1 length must be 20 characters.  Apply padding required to ensure this.
      int padneeded = 20 - seg1.length();
      for ( int y = 0; y < padneeded; y++ ) {
        seg1 = seg1 + " ";
      }
     
      // segment #2 length must be 4 characters.  Apply padding required to ensure this.
      int padneeded2 = 4 - seg2.length();
      for ( int y = 0; y < padneeded2; y++ ) {
        seg2 = seg2 + " ";
      } 
      
      // Loop through the data one character at a time, writing the ascii value of each digit to the LCD.
      for ( int x = 0; x < 20; x++ )  {
        SPI.transfer ( int(seg1.charAt(x)) );   
      }
    
      for ( int x = 0; x < 4; x++ ) {
        SPI.transfer ( int(seg2.charAt(x)) );
      }
        
      // These ascii 32 are needed to pad the entire lcd write buffer to 28 bytes as required by the hardware.
      SPI.transfer (32);
      SPI.transfer (32);
      SPI.transfer (32);
      SPI.transfer (32);
    
      // the following code requests the LCD to draw its buffer
      // 
      digitalWrite (config_strobe, HIGH);
      delayMicroseconds (50);
      digitalWrite (config_strobe, LOW);
      //
      digitalWrite (data_strobe, HIGH);
      delayMicroseconds (50);
      digitalWrite (data_strobe, LOW);
      //
      digitalWrite (final_strobe, HIGH);
      delayMicroseconds (50);
      digitalWrite (final_strobe, LOW);
      //
        
    }

  18. #768
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    Quote Originally Posted by catatung View Post
    I saw your post ^^ above mine.. I just wrote 24 ascii 65's, then did a 0x09 (I assume you meant 0x09, 0x08 is backspace) and then 3 0x20's.. I had all A's nicely spaced (the annoying bar's were gone) but the last character was garbled. Assuming the garbled character was thes 0x09, I then i tried:

    (1) "E" -- this is to indicate if the first character is ignored, as per my suspicion
    (20) "A" -- Text fill
    (3) "A" - Clock fill
    (1) "B" - Clock fill identify digit displayed
    (1) 0x09 - TAB as you said
    (2) 0x20 - spaces

    And I did not see an E, and the last character was garbled. I then sent:

    (1) E
    (1) B
    (17) A
    (1) B

    (3) A
    (1) B

    (1) C
    (3) space

    This gave me "BAAAAAAAAAAAAAAAAABA AA BC"

    This indicates that the first character was ignored or processed for some other purpose which appears transparent to it's behavior (so far);

    I tried changing the 26th byte from a space to a 0x09 like you said but this turned on a whole bunch of other icons - the speaker icon in the top right corner, the left pointing triangle at the end of the text area and the plus sign. I'm assuming different values here will turn on different icons. This was all done with Fix@1 set to 12V, not GND as in your design.

    Perhaps this is a way to achieve control of text AND icons without setting it with a pin high/low? If we've both found a different way that operates the LCD correctly maybe take a look at whichever one makes the most sense and implement that into your design. If you're sure on that 28 byte buffer then I'm assuming the last 2 bytes count for something else also, probably relevant to behavior. And the first character being ignored is interesting also. Perhaps the contrast can be controlled by software as well? I wonder if BMW assumed one of their model cars that would be equipped with this LCD may have a light sensor for headlights (night time vs day time) and have the ability to automatically dim the contrast and backlight...

    *edit: I went through dec 00 to 20 and the only useful behavior so far was 13, which enables the speaker volume icon, plus sign and the clock's colon. Other values seem to have an effect on pixels between characters. I haven't played with the last two bytes yet. I will let you know if I find anything interesting.

    Sorry, it's 0x08 (backspace) not 0x09 (tab)... my mistake!

    When sniffing the data going to the original OBC, I kept seeing what looked like a counter + data (i.e. 0x00, then a value; 0x01, then another value, 0x02, then another value, etc..). The counter value goes from 0 to 15.

    Upon further investigation, this sequence sets up all the icon data. There must be some other use because certain values garbled the display by turning on a bunch of dots on a particular row, across all characters. Other values that were valid turned on the various icons.

    First, to handle the various strobing operations, I defined these:

    Code:
    #define LCD_DATA_STROBE 0
    #define LCD_ICON_STROBE 1
    #define LCD_DISPLAY_STROBE 2
    Then made a function to handle them:
    Code:
    /*
    **  Toggles one of the strobe lines of the LCD from LOW-HIGH-LOW.
    **
    **  "strobeLine" is one of the following:
    **  0: Data strobe
    **  1: Icon strobe
    **  2: Display strobe
    */
    void lcdStrobe (unsigned int strobeLine) {
      switch (strobeLine) {
    
        case 0: // Data strobe
          wait_us (LCD_DELAY);
          lcdDataStrobe = 0;
          wait_us (LCD_DELAY);
          lcdDataStrobe = 1;
          wait_us (LCD_DELAY);
          lcdDataStrobe = 0; 
          wait_us (LCD_DELAY);
          break;      
    
        case 1: // Icon strobe
          wait_us (LCD_DELAY);
          lcdIconStrobe = 0;
          wait_us (LCD_DELAY);
          lcdIconStrobe = 1;
          wait_us (LCD_DELAY);
          lcdIconStrobe = 0; 
          wait_us (LCD_DELAY);
          break;
    
        case 2: // Display strobe
          wait_us (LCD_DELAY);
          lcdDisplayStrobe = 0;
          wait_us (LCD_DELAY);
          lcdDisplayStrobe = 1;
          wait_us (LCD_DELAY);
          lcdDisplayStrobe = 0; 
          wait_us (LCD_DELAY);
          break;
      }
    }
    My code for setting the icons is as follows:

    Code:
    /*
    **  Updates the LCD icon display.
    */
    void lcdUpdateIcons (const char icons [16]) {
      lcdStrobe (LCD_DATA_STROBE);
      for (unsigned char i = 0; i < 16; i ++) {
        lcdData.write (i);
        lcdData.write (icons [i]);
        lcdStrobe (LCD_ICON_STROBE);
      }
      lcdStrobe (LCD_DATA_STROBE);
    }
    Notice the counter is written via the SPI, then the icon data is written, then the ICON_STROBE is pulsed HIGH for 50us. I have found you can set individual icons quickly without needing to send all 16 values, but the whole operation is so quick, I just send them all anyway.

    Next, I defined constants for all the icons as follows:
    Code:
    // Icon constants
    #define ICON_LEFTARROW 1
    #define ICON_RIGHTARROW 2
    #define ICON_PLUS 4
    #define ICON_MEMO 8
    #define ICON_AM 16
    #define ICON_PM 32
    #define ICON_CLOCKDIVROW1 64
    #define ICON_CLOCKDIVROW2 128
    #define ICON_CLOCKDIVROW3 256
    #define ICON_CLOCKDIVROW4 512
    #define ICON_CLOCKDIVROW5 1024
    #define ICON_CLOCKDIVROW6 2048
    #define ICON_CLOCKDIVROW7 4096
    #define ICON_CLOCKDIVROW8 8192
    #define ICON_COLON ICON_CLOCKDIVROW3 | ICON_CLOCKDIVROW6
    #define ICON_CLOCKPER 16384
    I have a function that uses these constants (OR'd together) to allow setting of the icons:
    Code:
    /*
    **  Sets the icons on the LCD.  Multiple icons are set by OR'ing the values together
    **
    **  Example: lcdSetIcons (ICON_LEFTARROW | ICON_RIGHTARROW);
    */
    void lcdSetIcons (unsigned int icons) {
      char icon_data [16] = { 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 17, 25, 21, 19, 17, 0 };
      if (icons & ICON_LEFTARROW)
        icon_data [0] += 4;
      if (icons & ICON_CLOCKDIVROW1)
        icon_data [0] += 8;
      if (icons & ICON_MEMO)
        icon_data [1] += 4;
      if (icons & ICON_CLOCKDIVROW2)
        icon_data [1] += 8;
      if (icons & ICON_CLOCKDIVROW3)
        icon_data [2] += 8;
      if (icons & ICON_RIGHTARROW)
        icon_data [3] += 4;
      if (icons & ICON_CLOCKDIVROW4)
        icon_data [3] += 8;
      if (icons & ICON_PLUS)
        icon_data [4] += 4;
      if (icons & ICON_CLOCKDIVROW5)
        icon_data [4] += 8;
      if (icons & ICON_PM)
        icon_data [5] += 4;
      if (icons & ICON_CLOCKDIVROW6)
        icon_data [5] += 8;
      if (icons & ICON_CLOCKPER)
        icon_data [6] += 4;
      if (icons & ICON_CLOCKDIVROW7)
        icon_data [6] += 8;
      if (icons & ICON_AM)
        icon_data [7] += 4;    
      if (icons & ICON_CLOCKDIVROW8)
        icon_data [7] += 8;
        
      lcdUpdateIcons (icon_data);
    }
    It is interesting to note that when setting text data, the LCD requires a pulse on the DISPLAY_STROBE at the end of the sequence, whereas to set icons only, this is unneeded.

    NOTE: It appears that calling lcdSetIcons (0) performed some sort of initialization of the LCD. I noticed the spacing on your characters is a bit odd; maybe this init sequence sets up the proper dot format for the display?

    I hope this helps!
    Last edited by m2pc; 03-28-2011 at 09:50 AM.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  19. #769
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    NOTE: It appears that calling lcdSetIcons (0) performed some sort of initialization of the LCD. I noticed the spacing on your characters is a bit odd; maybe this init sequence sets up the proper dot format for the display?
    I noticed that too, i was suprised by the skinny "A" that i got, and also the fat ones, though I think the fat ones were just a result of certain extra pixels being lit up coincidentally next to the regular "A" that was drawn. I wonder if there is codes that can trigger different fontsets on the LCD.

    As far as the setting a dot format for the display, that's a possibility. Don't forget also that I was writing different lengths of data (not filling the 28 byte buffer) so it could be a behavior due to what lies in the memory addresses for the buffer where I did not send any values to. Completing the 28 byte send-off has made things look much better and correct.

    I hope this helps!
    Definitely! I am going to look at adding some code and making use of the icons as well with the Arduino. Thanks again!

  20. #770
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Let me just make sure I understand everything clearly:

    in order to change an icon, say for example the "PM" indicator to on:
    (The SPI data is read left to right; I wrote it on two lines for the sake of clarity, as you said every other bit was a counter from 0-15.)

    Code:
    Strobe data_strobe pin (#6)
    
    Write to SPI: 
    0   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15
      0   0   0   0   0  0+4  0   0   31  0   17    25   21   19   17   0 
    
    Strobe icon_strobe pin (#5) after each byte is written above
    Strobe data_strobe pin (#6)

    Do I have everything right?

    4 fix at 1 - tie this to +5 for TEXT and to gnd for ICONS - Actually I have this tied to GND in my design.
    Are you sure on this? When I put that pin to GND now I get "TIMER AN" on the display

    You could try a 1K ohm resistor in series with the LCD bias pin into the center leg of a 10K pot with the sides of the pot to GND and +12V. The LCD contrast may be off. Adjust the pot for the best contrast, then you can replace it with a fixed resistor divider with the same values.
    The 1K-Ohm resistor in itself is enough to completely block out the brightness entirely. When I disconnect the wire from the 555 100khz square wave signal, one line becomes bright at the moment of disconnect; I assume that was the line which was being drawn at the moment of disconnection. Perhaps the square wave I'm generating with the 555 timer could be the problem? I may pick up a cheap oscilloscope just to check it. what do you think?
    Last edited by catatung; 03-29-2011 at 12:18 AM.

  21. #771
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    Almost. ICON_STROBE is after each pair of bytes. The rest looks correct.
    I'll double-check pin #4 tomorrow when I get in front of my lab OBC again.

    Regarding the clock; I guess it _could_ be the problem; I recorded a 50% duty cycle square wave at around 100KHz when I sniffed the data the first time. It's more likely the bias however. Try a 330 ohm resistor on the LCD bias line into a 1K pot between +12V and GND and see if sweeping the pot fixes it.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  22. #772
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Almost. ICON_STROBE is after each pair of bytes. The rest looks correct.
    I'll double-check pin #4 tomorrow when I get in front of my lab OBC again.
    ah, I missed that, thanks for pointing it out.


    Regarding the clock; I guess it _could_ be the problem; I recorded a 50% duty cycle square wave at around 100KHz when I sniffed the data the first time. It's more likely the bias however. Try a 330 ohm resistor on the LCD bias line into a 1K pot between +12V and GND and see if sweeping the pot fixes it.
    I tried a 220ohm resistor with the 10k pot and all it just lets me fade the brightness of the pixels from what they are to nothing at all. I'm kind of baffled by this, because I know the LCD has the ability to produce the correct brightness (did you see it in the video where i was disconnecting the 100khz wire?)

    I'm looking at a Rigol DS1052E oscilloscope. I'm hoping I can get it for 175-200. I really should have one if I am going to be doing this kind of work. Then at least I can confirm the correct waveform and frequency of the 555 timer output. What do you use? Do you have any suggestions or recommendations?

  23. #773
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    Also, while you're confirming GND to pin 4, let me give you the full rundown how i have mine set up, just to make sure I don't have something else wrong.
    All "aka's" are the old terminology before I got the new labels from you.

    Code:
    LCD pin		connected to	                defined as
    -------		------------		        ----------
    1			+5v			N/A
    2			gnd			N/A
    3			+5v			N/A
    4			+5v			N/A
    5			D4			icon strobe (aka config strobe)
    6			D5			data strobe
    7			D13			SPI clock
    8			D11			SPI mosi
    9			D2			display strobe (aka final strobe)
    10			D3			reset line (aka enable) 
    11			555 (Pin 3)		100Khz square wave
    Last edited by catatung; 03-29-2011 at 01:47 PM.

  24. #774
    Join Date
    Apr 2007
    Location
    Yorba Linda, CA
    Posts
    3,781
    My Cars
    1999 TiAg M3, 2003 E46M3
    ^^^ This is correct; I've also confirmed my design has pin 4 tied to GND.

    1999 ///M3 TiAg | Heated Power Vaders | DDM Projector36 5000K 55W HIDs | DDM 3000K 35W HID Fogs
    DDM Smoked Corners | DDM Weighted Shift Knob | K&N CAI | Mishimoto AL Rad w/Zionsville AL Shroud
    Stewart HiPo Water Pump | Samco Hose Kit | 16" SPAL Puller Fan | Viper 5701LE Security
    E36 OBC is now open! Join the effort: BF.C Thread | openOBC Wiki

  25. #775
    Join Date
    Feb 2011
    Location
    USA
    Posts
    38
    My Cars
    no
    ^^^ This is correct; I've also confirmed my design has pin 4 tied to GND.
    Okay, thanks for checking.. Strangely enough, I get "Timer An" when I GND pin 4. Are there any wires you have connected that I don't? I've noticed I don't have an SS line, but since I am getting communication to the LCD without it I just assumed the SS line is okay left unconnected.

Page 31 of 79 FirstFirst ... 621222324252627282930313233343536373839404156 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •