Hopefully someone smarter than me can figure this out. Darrel, this program is awesome by the way!
I'm using an OLED screen and Darrel's anypin LCD program. The OLED screen works perfectly with the data displayed but not with bargraph program. Anyhow, have a for-next loop counting to 512. It runs perfectly up until 32 or so and then displays strange stuff until it hits 99 then it's good again until about 155 then bad again until about 222 then good again until 272 then bad until about 342 then good until about 388 then bad until about 462 and then it goes to 512 and loops back around. The program looks like this:
Code:
DEFINE OSC 48
include "LCDBAR_INC.PBP"
'===============================================================================
' OLED CHANGE
'===============================================================================
'===============================ENABLE FOR CAR PROGRAM=========================='
LCD_DB4 VAR PORTE.0
LCD_DB5 VAR PORTE.1
LCD_DB6 VAR PORTE.2
LCD_DB7 VAR PORTA.4
LCD_RS VAR PORTB.6
LCD_E VAR PORTB.7
'================================================================================
LCD_Lines CON 2 ' # of Lines on LCD, 1 or 2 (Note: use 2 for 4 lines)
LCD_DATAUS CON 50 ' Data delay time in us
LCD_COMMANDUS CON 2000 ' Command delay time in us
INCLUDE "LCD_AnyPin.PBP" ; *** Include MUST be AFTER LCD Pin assignments ****
' ==============================================================================
' CONFIGS
'===============================================================================
@ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_3_2L & _VREGEN_ON_2L
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H
@ __CONFIG _CONFIG3H, _CCP2MX_ON_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_ON_4L & _XINST_OFF_4L
'==============================================================================
' SETTINGS
' ==============================================================================
'76543210 '76543210
TRISA = %00100110: PORTA = %00000000
TRISB = %00010001: PORTB = %00010000
TRISC = %00000000: PORTC = %00000001
TRISD = %11011100: PORTD = %00000000
TRISE = %00010000: PORTE = %00010000
ADCON0 = %00000001
CMCON = 7
SSPSTAT = %01100100
SSPCON1 = %00100001
BAUDCON = %00001111
ADCON1=15
CCP2CON = %00011100 'changed on 11/16/12
CCP1CON = %00011100 'changed on 11/16/12
X VAR WORD
MainLoop:
FOR X=1 TO 512
PAUSE 100
LCDOUT $FE,148,DEC X," "
'@ BARgraph Value, Row, Col, Width, Range, Style
@ BARgraph _X, 1, 0, 20, 512, lines
NEXT X
GOTO MAINLOOP


I've tried a bunch of stuff (changing the parameters on the @ bargraph line but nothing seemed to help. This is the OLED screen I'm using:
http://www.newhavendisplay.com/specs...420DZW-AY5.pdf
Bookmarks