I would suspect an R-M-W problem.
What pins are the LCD on?
And, which pins are the SPWM on?
<br>
I would suspect an R-M-W problem.
What pins are the LCD on?
And, which pins are the SPWM on?
<br>
DT
Hi Taylor, what means R-M-W ?
Follow the LCD pins setting:
Define LCD_DREG PORTD 'set LCD data bus port
Define LCD_DBIT 4 'set data bus start
Define LCD_RSREG PORTD 'set LCD Register Select port
Define LCD_RSBIT 2 'set RS bit
Define LCD_EREG PORTD 'set LCD Enalble port
Define LCD_EBIT 3 'set Enable bit
Define LCD_BITS 4 'set LCD bus size
Define LCD_LINES 4 'set number of lines of LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 70 ' Set data delay time in us
and for the SPWM
ASM
SPWM_LIST macro ; Define PIN's to use for SPWM
SPWM_PIN PORTB, 5, _DutyVar1 ; RED
SPWM_PIN PORTB, 4, _DutyVar2 ; GREEN
SPWM_PIN PORTB, 3, _DutyVar3 ; BLU
SPWM_PIN PORTB, 2, _DutyVar4 ; WHITE
SPWM_PIN PORTB, 1, _DutyVar5 ; SYNK
endm
SPWM_INIT SPWM_LIST ; Initialize the Pins
ERRORLEVEL -306 ; Avoid Crossing page boundary "Message[306]"
ENDASM
and this is the main loop that work correctly for tree or four seconds, then seems that the display go out of sink and I see scrambled data as for the attached images.
Forever:
Lcdout $fe, $80, "MMMMMMMMMMMMMMMMMMM" ' move cursor to beginning of firt line
Lcdout $fe, $c0, "VVVVVVVVVVVVVVVVVVV" ' move cursor to beginning of second line
Lcdout $fe, $94, "HHHHHHHHHHHHHHHHHHH" ' move cursor to beginning third line
Lcdout $fe, $d4, "YYYYYYYYYYYYYYYYYYY" ' move cursor to beginning of fourth line
hSerout ["|"]
pause 400
Lcdout $fe, $80, "1111111111111111111" ' move cursor to beginning of firt line
Lcdout $fe, $c0, "2222222222222222222" ' move cursor to beginning of second line
Lcdout $fe, $94, "3333333333333333333" ' move cursor to beginning third line
Lcdout $fe, $d4, "4444444444444444444" ' move cursor to beginning of fourth line
pause 400
GOTO Forever
Also I have connected to ground the unused 4 input bit of the Optrex DMC20481 display and added a capacitor between VSS and VDD of the LCD, without visibile effect.
Also consider that I have changed the display with other different brand and the symptom remain the same.
Ciao
Leo
R-M-W is "Read-Modify-Write". It's the way PIC chips set an individual pin by reading the entire port, changing the 1 bit for the desired pin, then writing the whole port again. It can cause problems from time to time, but that is not the problem here. If the LCD and SPWM pins were on the same port it could have been. But I hadn't seen any code at the time, so I was guessing.
And to keep from guessing again, could you post the whole program?
I've run LCD's with SPWM before, so I don't think there's a common cause that I could point to. Hoping there's something else going on.
<br>
DT
Maybe just a LCD clear... or PSU noise.. who know?
LVP_NOT set to OFF.. huh... how bad things could go with it...
Last edited by mister_e; - 2nd April 2008 at 00:30.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
What surprises me is that the entire line changes to a different character.
If it was a timing problem from the interrupts, I'd think it would be more Random.
<br>
DT
Looks like the PIC itself reset here and there... i still bet on some kind of noise... or UFO interferences... stack under/overflow?
Fishing in the dark..
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks