Sorry, I didn't mean for you to get rid of the other CONFIG settings... just change the OSC ones.
Here's a complete example
If you're using a DVM and measuring 2.5V, that probably means the pin is toggling but it's too fast for the meter,Code:#CONFIG CONFIG RETEN=ON, INTOSCSEL=HIGH, SOSCSEL=HIGH, XINST=OFF, FOSC=INTIO2, PLLCFG=OFF CONFIG FCMEN=OFF, IESO=OFF, PWRTEN=OFF, BOREN=SBORDIS, BORV=3, BORPWR=ZPBORMV CONFIG WDTEN=SWDTDIS, WDTPS=512, CANMX=PORTB, MSSPMSK=MSK7, MCLRE=OFF CONFIG STVREN=ON, BBSIZ=BB2K, CP0=OFF, CP1=OFF, CP2=OFF, CP3=OFF, CPB=OFF CONFIG CPD=OFF, WRT0=OFF, WRT1=OFF, WRT2=OFF, WRT3=OFF, WRTC=OFF, WRTB=OFF CONFIG WRTD=OFF, EBTR0=OFF, EBTR1=OFF, EBTR2=OFF, EBTR3=OFF, EBTRB=OFF #ENDCONFIG 'then later you can change it OSCCON = $70 ' IRFC[2:0] = 111 (16MHz), SCS[1:0] = 00 (primary CONFIG osc setting) ' set PLLEN (optional, 4x16MHz=64MHz) OSCTUNE.6 = 1 'with PLLEN=1 DEFINE OSC 64 'with PLLEN=0 'DEFINE OSC 16 ANCON0=0 ' digital IO AN7-AN0 ANCON1=0 ' digital IO AN8-AN14 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 as output all TRISE=%0000000 'set PORTE as output all GKO: HIGH PORTD.0 PAUSE 2000 LOW PORTD.0 PAUSE 2000 GOTO GKO
so the 'DEFINE OSC' doesn't match your actual settings and the 'PAUSE' is wrong.
Try increasing the pause time to 5000 or 10000
You'll see a difference, but it likely won't be earth shattering.I want to run it at 16mhz and then try 64mhz, to see if there's any practical difference in i2cread and shiftout statements
To really effect the I2C speed you'd need to switch to using the MSSP hardware, and while that SHOUT routine I posted is faster than shiftout, it won't be as fast as using the SPI peripheral.





Bookmarks