I'm using pull-up resistors on the SDA/SCL lines that are 2.2k (which i think is standard for 100kbps I2C communication).
I'm pretty new to coding in PicBasic Pro, but what is a configuration fuses setting? I'm coding/compiling it in MicroCode Studio using the PicBasic Pro compiler and using the MPLAB PICSTART PLUS programmer to program it to the board. It seems to use MPASM to convert the code from Assembly to Hex.
The period of the SCL signal when it's hooked up to the oscilloscope is a regular square wave (not noisy) with a period of 1us, which was a very clear clock signal showing 1MHz. With the changes applied to the code, the clock signal was still showing a frequency of 1MHz. It doesn't change when adding the I2C_SLOW code.
Code:
DEFINE OSC 20 '20 MHz external oscillator
DEFINE I2C_SLOW 1
SDA var PORTC.4 'SDA port
SCL var PORTC.3 'SCL port
Loop VAR Byte
DACAddressByte con %10010000 ' DAC Address byte (7-bit address: 1001 000)
DACControlByte VAR BYTE ' DAC control byte (sets DAC to D/A:0100 0000)
DACControlByte = %01000000
start:
For Loop = 0 To 255 'ramp up
I2CWRITE sda,scl,DACAddressByte,DACControlByte,[Loop] 'I2CWrite
Pause 10 'wait for write
Next
GoTo start
Bookmarks