No, there is no wiring error and when using HIGH or LOW statements, I can pull these pins up and down as normal.
I mean, maybe there is some config error for 18F, which prevents I2CREAD/I2CWRITE from working?
No, there is no wiring error and when using HIGH or LOW statements, I can pull these pins up and down as normal.
I mean, maybe there is some config error for 18F, which prevents I2CREAD/I2CWRITE from working?
to be clear
provided it is wired correctly and the chip is pcf8574 the original code works just fine
Warning I'm not a teacher
Change CONFIG XINST setting to OFF.
Very few compilers are compatible with ON
Yes, you were right!
Also XINST messes with LCDOUT.
When XINST=ON, then DEC/HEX/BIN etc. modifiers of LCDOUT statement do not work.
But why this is not mentioned in manual?
Also, turning off XINST means we're turning off these extended instructions of 18F, so loosing all advantages these series have?
XINST changes the way some instructions work, so unless you have a compiler that supports it (like almost none), always set it off.
You're not missing out on anything.
I've compared this code on 16F1939 @ 16 Mhz and 18F45K80 @ 64 Mhz and see zero improvement in speed (screen redraw time). I'm doing something wrong, or it should be that way? Here's config for 18F:
And this is the main code (ST7920 library with custom fonts)Code:OSCTUNE.6 = 1 ; Enable 4x PLL OSCCON = %01110000 ANCON1=0 'DISABLE ADC D3-D2-D1-D0- ANCON0=0 ADCON0=0 TRISC=%00000000 'set PORTC as output all TRISD=%00000000 'set PORTD as output all TRISB=%00000000 'set PORTB as output all TRISA=%00000000 'set PORTA 2 as input, others as output TRISE=%0000000 'set PORTE as output all define OSC 64
Code:topline var byte [18] arraywrite topline, ["SOMETEXT HERE 123"] C=0 gosub GCODER arraywrite topline, ["SOMETEXT HERE 567"] c=8 gosub gcoder arraywrite topline, ["SOMETEXT HERE 890"] c=16 gosub gcoder C=24 arraywrite topline, ["SOMETEXT HERE XXX"] GOSUB GCODER stop GCODER: FOR X=0 TO 17 step 2 'READ ARRAY INTO VARIABLE, ARRAY MEMBER CHAR=EEPROM OFFSET Y=(topline[x]-65)*8 Z=(topline[x+1]-65)*8 'READ INTO VARIABLE AS TWINS FOR I=0 TO 7 'HELPER LOOP FOR CHARACTER READING READ Y+I,A 'READ EEPROM BYTES INTO VAR READ Z+I,B LCDOUT $FE,$80+i+c 'UPDATE Y POSITION LCDOUT $FE,$80+x/2 'UPDATE X POSITION if topline[x]=32 then a=0 if topline[x+1]=32 then b=0 'blanker LCDOUT a LCDOUT b 'WRITE TO SCREEN NEXT I NEXT X return
It could be that the LCDOUT dominates the execution time, although I'd be surprised if it's "0 difference"
Do you still have CONFIG FOSC = INTIO1?
With that, you can measure the CLKOUT on the RA6/OSC2 pin just to verify the settings.
Bookmarks