/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.bak |
---|
1,5 → 1,3 |
//#include "C:\Users\Honza\Documents\pic\I2C_HUB\main.h" |
#include "main.h" |
//I2CHUB |
//ADRESA pro èteni 0xE1 |
57,9 → 55,6 |
I2C_write(d); |
i2c_stop(); |
} |
77,189 → 72,11 |
printf("I2CHUB \r\n",); |
printf("(c)MLAB 2013 JACHO \r\n",); |
unsigned int8 INTEP,INTEP1, NAP,NAP1, PROUD,PROUD1,KAPZ,KAPZ1,KAPC,KAPC1, STAV,STAV1; |
int16 data4; |
int16 data5; |
int16 data6; |
int16 data7; |
int16 data8; |
int16 data9; |
byte XH; |
while(TRUE) |
{ |
//akcelerometr |
int1 ack; |
i2c_start(); // If the write command is acknowledged, |
ack = i2c_write(0xE1);//hen the device is ready. |
i2c_stop(); |
ack=!ack; |
setHUB(3); //pripoji prislusnou branu |
delay_ms(1000); |
//printf("Stav: %d (procenta)\r\n", ack); |
printf("Stavx: %X(procenta)\r\n", XH); |
setHUB(3); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x0c); |
i2c_start(); |
I2C_Write(0xAB); |
INTEP=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x0d); |
i2c_start(); |
I2C_Write(0xAB); |
INTEP1=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x08); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
NAP=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x09); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
NAP1=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x0a); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
PROUD=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x0b); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
PROUD1=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x04); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
KAPZ=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x05); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
KAPZ1=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x06); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
KAPC=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x07); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
KAPC1=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x02); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
STAV=i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAA); |
I2C_write(0x03); |
i2c_stop(); |
i2c_start(); |
I2C_Write(0xAB); |
STAV1=i2c_read(0); |
i2c_stop(); |
data4 = (((unsigned int16) INTEP1 << 8) + INTEP ); |
data4 = (data4/10)-273; |
data5 = (((unsigned int16) NAP1 << 8) + NAP ); |
data6 = (((unsigned int16) PROUD1 << 8) + PROUD ); |
data7 = (((unsigned int16) KAPZ1 << 8) + KAPZ ); |
data8 = (((unsigned int16) KAPC1 << 8) + KAPC ); |
data9 = (((unsigned int16) STAV1 << 8) + STAV ); |
printf("Teplota uvnitr io: %Ld C\r\n", data4); |
printf("Napeti clanku: %Ld mV \r\n", data5); |
printf("Proud: %Ld mA \r\n", data6); |
printf("Kapacita zbytek: %Ld mAh\r\n", data7); |
printf("Kapacita max: %Ld mAh\r\n", data8); |
printf("Stav: %Ld (procenta)\r\n", data9); |
delay_ms (2000); |
} |
} |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.c |
---|
1,14 → 1,9 |
//#include "C:\Users\Honza\Documents\pic\I2C_HUB\main.h" |
#include "main.h" |
//I2CHUB |
//ADRESA pro èteni 0xE1 |
//pro zápis 0xE0 |
#define EEPROM_SDA PIN_C4 |
#define EEPROM_SCL PIN_C3 |
#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
#use i2c(master, sda=PIN_C4, scl=PIN_C3) |
#use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
void setHUB(int d) //vstupuje 1-8 |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.cof |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.esym |
---|
1,7 → 1,7 |
D G "__PCM__" 0 267 ""4.106"" |
D G "__DEVICE__" 0 267 "887" |
D G "__DATE__" 0 267 ""30-4-13"" |
D G "__TIME__" 0 267 ""23:58:10"" "#include "C:\Users\Honza\Documents\pic\I2C_HUB\main.h"" |
D G "__PCM__" 0 81 ""4.106"" |
D G "__DEVICE__" 0 81 "887" |
D G "__DATE__" 0 81 ""14-V-13"" |
D G "__TIME__" 0 81 ""19:16:29"" "Standard Header file for the PIC16F887 device ////////////////" |
d G "PIN_A0" 2 20 "40" |
d G "PIN_A1" 2 21 "41" |
d G "PIN_A2" 2 22 "42" |
273,14 → 273,13 |
d G "INT_RB5" 2 418 "0x0200B08" |
d G "INT_RB6" 2 419 "0x0400B08" |
d G "INT_RB7" 2 420 "0x0800B08" |
D G "EEPROM_SDA" 0 9 "PIN_C4" |
D G "EEPROM_SCL" 0 10 "PIN_C3" |
F G "setHUB" 0 14 "void(int8 d)" |
V L "d" 0 14 "int8" "vstupuje 1-8" |
C L "setHUB" 0 4 2 "FUNCTION" |
F G "MAIN" 0 63 "void()" |
C L "MAIN" 0 4 1 "FUNCTION" |
C L "MAIN" 0 4 1 "FUNCTION" |
C L "setHUB" 0 2 3 "FUNCTION" |
F G "setHUB" 0 9 "void(int8 d)" |
V L "d" 0 9 "int8" "vstupuje 1-8" |
C L "setHUB" 0 2 2 "FUNCTION" |
F G "MAIN" 0 58 "void()" |
C L "MAIN" 0 2 1 "FUNCTION" |
C L "MAIN" 0 2 1 "FUNCTION" |
F B "reset_cpu" 0 0 |
F B "abs" 1 0 |
F B "sleep_ulpwu" 1 0 |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.hex |
---|
60,4 → 60,4 |
:04400E00F52CFF3F4F |
:00000001FF |
;PIC16F887 |
;CRC=E7EB CREATED="30-4-13 23:58" |
;CRC=E7EB CREATED="14-V-13 19:16" |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.lst |
---|
1,6 → 1,6 |
CCS PCM C Compiler, Version 4.106, 47914 30-4-13 23:58 |
CCS PCM C Compiler, Version 4.106, 47914 14-V-13 19:16 |
Filename: c:\users\honza\documents\pic\i2c_hub\main.lst |
Filename: Z:\home\kaklik\svnMLAB\Modules\CommSerial\I2CHUB02A\SW\PIC16F887\main.lst |
ROM used: 468 words (6%) |
Largest free fragment is 2048 |
13,8 → 13,6 |
0001: MOVWF 0A |
0002: GOTO 155 |
0003: NOP |
.................... //#include "C:\Users\Honza\Documents\pic\I2C_HUB\main.h" |
.................... |
.................... #include "main.h" |
.................... #include <16F887.h> |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
67,10 → 65,7 |
.................... //ADRESA pro èteni 0xE1 |
.................... //pro zápis 0xE0 |
.................... |
.................... |
.................... #define EEPROM_SDA PIN_C4 |
.................... #define EEPROM_SCL PIN_C3 |
.................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
* |
0083: MOVLW 08 |
0084: MOVWF 78 |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.pjt |
---|
1,10 → 1,10 |
[PROJECT] |
Target=C:\Users\Honza\Documents\pic\I2C_HUB\main.hex |
Target=main.hex |
Development_Mode= |
Processor_Text=PIC16F887 |
ToolSuite=CCS |
Processor=0x887F |
[C:\Users\Honza\Documents\pic\I2C_HUB\main] |
[main] |
Type=4 |
Path= |
FileList= |
12,13 → 12,15 |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=C:\Users\Honza\Documents\pic\I2C_HUB\main.c |
1=main.c |
[Windows] |
0=0000 %S 0 0 796 451 3 0 |
[Opened Files] |
1=main.c |
2= |
[Target Data] |
OptionString=-p +FM |
FileList=Z:\home\kaklik\svnMLAB\Modules\CommSerial\I2CHUB02A\SW\PIC16F887\main.c |
[Units] |
Link=0 |
Count=1 |
1=C:\Users\Honza\Documents\pic\I2C_HUB\main |
[Opened Files] |
1=..\I2C_HUB\main.c |
2= |
1=main (main) |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.sta |
---|
12,35 → 12,35 |
Lines Stmts % Files |
----- ----- --- ----- |
85 37 100 main.c |
80 37 100 main.c |
20 0 0 main.h |
423 0 0 ..\..\..\..\..\Program Files (x86)\PICC\devices\16F887.h |
423 0 0 C:\Program Files (x86)\PICC\devices\16F887.h |
----- ----- |
528 37 Total |
523 37 Total |
Page ROM % RAM Vol Diff Functions: |
---- --- --- --- --- ---- ---------- |
0 22 5 1 @delay_ms1 |
0 74 16 1 105 3.4 @I2C_WRITE_1 |
0 74 16 1 @I2C_WRITE_1 |
0 36 8 1 @PUTCHAR_1_ |
0 114 24 1 567 4.1 setHUB |
0 3 1 0 5394 6.3 @const78 |
0 70 15 3 59 2.3 @PSTRINGC7_69 |
0 3 1 0 @const78 |
0 70 15 3 @PSTRINGC7_69 |
0 127 27 1 336 2.7 MAIN |
0 6 1 0 59 2.3 @const82 |
0 12 3 0 59 2.3 @const83 |
0 6 1 0 @const82 |
0 12 3 0 @const83 |
Program metrics: |
Functions 7 |
Functions 2 |
Statements 37 |
Comments 94 |
Volume (V) 7859 |
Difficilty (D) 26.4 |
Effort to implement (E) 207738 |
Time to implement (T) 3 hours, 12 minutes |
Est Delivered Bugs (B) 1 |
Comments 91 |
Volume (V) 1083 |
Difficilty (D) 6.2 |
Effort to implement (E) 6751 |
Time to implement (T) 6 minutes |
Est Delivered Bugs (B) 0 |
Cyclomatic Complexity 9 |
Maintainability (MI) 79 |
Maintainability (MI) 47 |
Segment Used Free |
----------- ---- ---- |
/Modules/CommSerial/I2CHUB02A/SW/PIC16F887/main.sym |
---|
43,15 → 43,15 |
User Memory space: |
Project Directory: |
c:\users\honza\documents\pic\i2c_hub\ |
Z:\home\kaklik\svnMLAB\Modules\CommSerial\I2CHUB02A\SW\PIC16F887\ |
Project Files: |
main.c |
main.h |
..\..\..\..\..\Program Files (x86)\PICC\devices\16F887.h |
C:\Program Files (x86)\PICC\devices\16F887.h |
Units: |
c:\users\honza\documents\pic\i2c_hub\main (main) |
Z:\home\kaklik\svnMLAB\Modules\CommSerial\I2CHUB02A\SW\PIC16F887\main (main) |
Compiler Settings: |
Processor: PIC16F887 |