View previous topic :: View next topic |
Author |
Message |
dsevgor
Joined: 30 Mar 2013 Posts: 11
|
PWM Generation problem when using OLED Lcd |
Posted: Sat Mar 30, 2013 1:16 pm |
|
|
Ok this is my entry to the forum. English is not my native lang so excuse me
I'm generating pwm with 2 timers for a better resolution. I'm simply driving a servo motor (hitec 7975 hs).
I had overcome several problems by this time and finally finished the project and ordered a prototype pcb (i was running on breadboard :D). Everything is running perfect, except:
When i replace my 2x8 Winstar WH0802A1 with a 2x8 OLED version from winstar (WEH000802ABP...) I simply can't program the board with ICSP.
I use a Brenner8 programmer. It gives a code protection problem. But after I connect 5v to lcd from another 7805 (common grounded with the board) I managed to use ICSP.
But my biggest and vital problem still continuing.
I can't produce pwm. At least i think i can't. With the regular LCD i read around 0.5 - 0.7 V, but with the oled it drops to 0.02volts. Additionally, with this low (0.02) value still makes the servo stay at its initial position where it was when the program first started.
I'm using the latest version i guess 4.141.6.9
if someone can help me i really appreciate!
thanks! |
|
|
dsevgor
Joined: 30 Mar 2013 Posts: 11
|
|
Posted: Sat Mar 30, 2013 2:51 pm |
|
|
by the way im using 18f2520 and flex lcd driver |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 30, 2013 2:58 pm |
|
|
Quote: | ordered a prototype pcb |
Post a link to the website for the board.
Quote: | I'm generating pwm with 2 timers for a better resolution. I'm simply driving a servo motor.
I can't produce pwm. At least i think i can't. With the regular LCD i read around 0.5 - 0.7 V, but with the oled it drops to 0.02volts. |
According to OLED data sheet, typical supply current is 16 ma.
http://www.winstar.com.tw/products_detail_ov.php?lang=en&ProID=295
That's not much. It's more than an LCD, but not a lot more.
Quote: | I'm simply driving a servo motor (hitec 7975 hs). |
Your servo motor can require 200 ma.
http://www.servocity.com/html/hs-7975hb_servo.html
My basic feeling is that your board is under-powered (not enough current
from regulator) and it's causing problems for you. |
|
|
thepcman
Joined: 20 Nov 2012 Posts: 1
|
|
Posted: Sat Mar 30, 2013 3:56 pm |
|
|
@PCM Programmer, we have checked the voltages while the device is working. No droops in operation.
The power is supplied via 7805 which gives out up to 1 Amps. The power source is a 8.4V camera type battery, which is also in good condition. The servo is directly fed from battery. Therefore its current cycles are not reflected to MCU side.
To check whether a current is fed through data pins, we have placed 1k resistor in series with data and control lines. No result again.
And as dsevgor mentioned, the device works perfect with HD44780 compatible LCD. As you have written, there is not much difference between the power consumptions of OLED and LCD. So no doubt about power.
Furthermore, we tried to create a "fake pwm" using delay functions. It runs everything perfectly. But when it comes to use timers and timer interrupts - no way - it seems like the device timers stop.
A suspicion : flex_lcd has delay_cycles, delay_us functions inside, which - in some case i believe - disable interrupts. Could it be a factor? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 30, 2013 4:36 pm |
|
|
The delay statements in flex_lcd.c could disable interrupts if you have
delay statements inside your #int_timer interrupt routines. This also
applies if you call functions (that have delay_ms(), etc.) from within
the #int_timer routines. Do you do this ?
I'm looking at the WS0010 controller data sheet, which is used with
the OLED display. It shows:
1. A power-up stabilization delay of 500 ms is required before the PIC
should attempt to talk to the OLED. Do you have this ? You can either
add a delay at the start of main(), or you can edit the lcd_init() routine
in flex_lcd.c and change it from 15ms to 500ms (or 550 ms for safety).
2. For Hitachi LCDs, the "Clear Display" command executes in less than
2 ms, and this is shown in the lcd_putc() section of the flex_lcd.c
driver, with a 2 ms delay for the "\f" command.
However, for the WS0010 controller used with your OLED, the clear
screen delay is 6.2 ms, according to the data sheet. To fix this
problem, you should make a copy of the flex_lcd.c file and rename it
flex_oled.c or maybe flex_ws0010.c. Edit the delay_ms() statement
for the "\f" command and make it delay for 7 ms. (And also edit
the lcd_init() delay as listed in item 1 above. |
|
|
dsevgor
Joined: 30 Mar 2013 Posts: 11
|
|
Posted: Sat Mar 30, 2013 6:53 pm |
|
|
Thank you
PCM programmer !!!
PROBLEM SOLVED !! |
|
|
|