SED1335 320x240 graphic LCD


Closed Thread
Results 1 to 17 of 17
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598

    Default SED1335 320x240 graphic LCD

    Hi,

    I thought I'd share the code I've come up with. As far as I know only Compsys has code for this controller, and it is for a smaller size. Since the setting parameters may not be obvious for some (like me, took me forever to figure this out):

    (...figures, the source came out all misaligned in the text file...)

    Robert
    Attached Images Attached Images  
    Attached Files Attached Files
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default Digital potentiometer

    This is the code and circuitry to control the contrast and backlight via the PIC:

    CLEAR
    ADCON1 = 7

    ASM
    @ DEVICE PIC16F877, HS_OSC, WDT_OFF, PWRT_ON, BOD_ON, LVP_OFF, CPD_OFF,
    WRT_OFF, DEBUG_OFF, PROTECT_OFF
    ENDASM

    DEFINE OSC 20

    varContrast VAR BYTE
    varBacklight VAR BYTE

    varContrast = 100
    HPWM 1,varContrast,32767

    varBacklight = 200
    HPWM 2,varBacklight,32767

    ' Here I have logic to scan 4 input buttons to increase/decrease varBacklight
    ' and varContast, then I reissue HPWM commands using new values.

    END


    Robert
    Attached Images Attached Images  
    Last edited by Demon; - 28th May 2006 at 18:43.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    For the contrast line, you don't need any driver between your PIC and the LCD, a simple resistor in serie will do the job.... let's say in a range of 500 ohms - 2K.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Salut Steve! Donne-moi de tes nouvelles de ton voyage.

    How will you adjust the contrast using just a resistor?

    I wanted it so that both the contrast and backlight could be adjusted from 4 UP/DOWN buttons. Using transistors and HPWM was the cheapest way I could come up with. I now have a range of 256 steps for both controls.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    It will work the same way for contrast. You must keep your transistor for the backlight. For contrast, use HPWM and a in-serie resistor from your PIC to your LCD VO line. If this input don't need negative voltage, i have to work AS IS. Maybe you'll need to revert the values (0-255 to 255-0) but that's not a big deal.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    I used a 25K pot at first to get the contrast working:

    - Vss at one end with 0V.
    - Vout at the other end with -30V (built-in negative voltage).
    - V0 at the wiper.

    For a good contrast, the V0 wiper varied from -20V to -24V, with -22V for a good setting.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Unhappy

    DOH! sorry... always read the Datasheet first, always read the schematic correctly too (Vout) Tabarnak!

    Where's the whip?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    maybe another solution... maybe, if not, broke my legs... again

    try it first. Place a 10K resistor between Vout and VO, on Vo place a 1K resistor in serie. Now send the other resistor end to 5 Volt. What happen with the contrast?

    If i'm not dumb it should do something. If so, in serie with the other 1K resistor, place a diode in serie. Anode to PIC, cathode to resistor end. Is it working? I have some doubt on that so far... -voltage against 0V and 5 Volt+diode plah plah. I really need to return on a bench... feel rusty here!
    Last edited by mister_e; - 29th May 2006 at 15:19.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    $99 USD per LCD.

    I can't afford to do magic shows with these suckers.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    anyway, forget me on the previous, it will work yeah but not on the range you said... your method is good, keep it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Nice job you did! Any spare MAX232 output on your board?
    Last edited by mister_e; - 29th May 2006 at 15:49.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    I'm not using any MAX232...?

    Why do you ask that?

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    do a test... you'll see why sometime a spare MAX232 transmitter can be usefull. Place your voltmeter on a transmitter output.... set the transmitter input to GND, then to 5Volt. What do you get on your Voltmeter?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Sorry Steve, no time for a test, especially when I don't know what you want me to test. The few hours I have are spent trying to finish this never-ending project.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  15. #15
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default Correction To Code

    SendData:
    pinA0 = 0
    pinData = varByte
    pinWR = 0
    @ nop ' <--- ADD
    pinWR = 1
    return

    SendCommand:
    pinA0 = 1
    pinData = varCommand
    pinWR = 0
    @ nop ' <--- ADD
    pinWR = 1
    return


    The [@ NOP] turns out to be very important for high-speed display, it corrects a timing issue. Without it, there is a sort of 'echo' on the LCD when you display characters extremely fast (my initial tests were keyboard-type speeds).

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  16. #16
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Is it still the game project we already talked about about a year ago but just grow with the age
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  17. #17
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default

    Yup, same project, but getting more complex as I learn more. Now I'm using a PIC 18F4550 at 48MHz with a high-speed USB link to a PC. I no longer process the game text on the PIC, the mcu is now used exclusively for I/O to and from the LCD and buttons, nothing more. VB6 will manage a database PC-side.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  3. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  4. SED1335 320x240 LCD
    By Demon in forum General
    Replies: 4
    Last Post: - 4th May 2006, 01:36
  5. graphic LCD sed1335
    By kk11 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th February 2005, 22:59

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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