Rev 1283 Rev 1284
Line 4... Line 4...
4 #define RAM_Access 0x00 // RAM access command 4 #define RAM_Access 0x00 // RAM access command
5 #define RAM_Tobj1 0x07 // To1 address in the RAM 5 #define RAM_Tobj1 0x07 // To1 address in the RAM
6 #define RAM_Tamb 0x06 // Ta address in the RAM 6 #define RAM_Tamb 0x06 // Ta address in the RAM
7   7  
8   8  
9 //*High and Low level of clock 9 // High and Low level of clock
10 #define HIGHLEV 40 // max. 50us 10 #define HIGHLEV 40 // max. 50us
11 #define LOWLEV 100 // max. 30ms 11 #define LOWLEV 100 // max. 30ms
12 #define TBUF 20 12 #define TBUF 20
13   13  
14 //SMBus control signals 14 // SMBus control signals
15 #define SCL PIN_B0 15 #define SCL PIN_B0
16 #define SDA PIN_B1 16 #define SDA PIN_B1
17   17  
18 #define mSDA_HIGH() output_float(SDA); // SDA float 18 #define mSDA_HIGH() output_float(SDA); // SDA float
19 #define mSDA_LOW() output_low(SDA); // SDA low 19 #define mSDA_LOW() output_low(SDA); // SDA low
20 #define mSCL_HIGH() output_float(SCL); //output_high(SCL); // SCL high 20 #define mSCL_HIGH() output_float(SCL); // SCL float
21 #define mSCL_LOW() output_low(SCL); // SCL low 21 #define mSCL_LOW() output_low(SCL); // SCL low
22   22  
23 #define ACK 0 23 #define ACK 0
24 #define NACK 1 24 #define NACK 1
25   25  
Line 40... Line 40...
40 delay_us( TBUF ); // Wait a few microseconds 40 delay_us( TBUF ); // Wait a few microseconds
41 mSCL_HIGH(); // Set SCL line 41 mSCL_HIGH(); // Set SCL line
42 delay_us( TBUF ); // Generate bus free time between Stop 42 delay_us( TBUF ); // Generate bus free time between Stop
43 // and Start condition (Tbuf=4.7us min) 43 // and Start condition (Tbuf=4.7us min)
44 mSDA_LOW(); // Clear SDA line 44 mSDA_LOW(); // Clear SDA line
45 delay_us( TBUF ); // Hold time after (Repeated) Start 45 delay_us( TBUF ); // Hold time after (Repeated) Start Condition.
46 // Condition. After this period, the first clock is generated. 46 // After this period, the first clock is generated.
47 //(Thd:sta=4.0us min) 47 // (Thd:sta=4.0us min)
48 mSCL_LOW(); // Clear SCL line 48 mSCL_LOW(); // Clear SCL line
49 // enable_interrupts(GLOBAL); 49 // enable_interrupts(GLOBAL);
50 delay_us( TBUF ); // Wait a few microseconds 50 delay_us( TBUF ); // Wait a few microseconds
51 } 51 }
-   52  
52 //********************************************************************************************* 53 //*********************************************************************************************
53 // STOP CONDITION ON SMBus 54 // STOP CONDITION ON SMBus
54 //********************************************************************************************* 55 //*********************************************************************************************
55 //Name: STOPbit 56 //Name: STOPbit
56 //Function: Generate STOP condition on SMBus 57 //Function: Generate STOP condition on SMBus