diff options
author | William Harrington <kb0iic@berzerkula.org> | 2019-08-07 18:46:23 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2019-08-07 18:46:23 -0500 |
commit | b3b3ddcc15879c61719285321e2033eef248f9be (patch) | |
tree | 189c05fc11672270c6934771a91d6871cf2cbe45 /i2c.c | |
parent | f0b60214163c8d69e9faf22abe5fd72a3628342d (diff) |
Break out SSPSTAT configuration for SMP and CKP and set SSPADD to a decimal number instead of a formula.
Diffstat (limited to 'i2c.c')
-rwxr-xr-x | i2c.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -12,8 +12,12 @@ void I2C_Master_Init(const unsigned long freq_K) //Begin IIC as master SSPCON = 0b00101000; //pg84/234
SSPCON2 = 0b00000000; //pg85/234
- SSPADD = (_XTAL_FREQ/(4*freq_K*100))-1; //Setting Clock Speed pg99/234
- SSPSTAT = 0b00000000; //pg83/234
+ //SSPADD = (_XTAL_FREQ/(4*freq_K*100))-1; //Setting Clock Speed pg99/234
+ SSPADD = 49;
+
+ //SSPSTAT: SMP:CKE:D/!A:P:S:R/!W/:U:BF *U unimplemented read as 0
+ SMP = 1; // Disable slew rate
+ CKP = 0; // Data transmitted on rising edge of SCK
}
void I2C_Master_Wait()
|