/Modules/Sensors/MAG01A/SW/PIC16F887/HMC5883L.c |
---|
1,101 → 1,85 |
void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ |
{ |
i2c_start(); //nastavení Configuration Register A |
I2C_Write(MAG_ADDR_W); |
I2C_Write(0x00); |
I2C_Write(0x70); |
i2c_stop(); |
Delay_ms(6); |
// i2c slave addresses |
#define HMC5883L_WRT_ADDR 0x3C |
#define HMC5883L_READ_ADDR 0x3D |
i2c_start(); //nastavení Configuration Register B |
I2C_Write(MAG_ADDR_W); |
I2C_Write(0x01); |
I2C_Write(MAG_ROZ810); |
i2c_stop(); |
// Register addresses |
#define HMC5883L_CFG_A_REG 0x00 |
#define HMC5883L_CFG_B_REG 0x01 |
#define HMC5883L_MODE_REG 0x02 |
#define HMC5883L_X_MSB_REG 0x03 |
Delay_ms(6); |
i2c_start(); //nastveni Mode Register |
I2C_Write(MAG_ADDR_W); |
I2C_Write(0x02); |
I2C_Write(0x00); |
i2c_stop(); |
Delay_ms(6); |
} |
void set_mag_roz (unsigned int8 h) //nastavy rozsah |
//------------------------------ |
// Low level routines |
//------------------------------ |
void hmc5883l_write_reg(int8 reg, int8 data) |
{ |
// |
i2c_start(); |
I2C_Write(MAG_ADDR_W); |
I2C_Write(0x01); |
I2C_Write(h); |
i2c_write(HMC5883L_WRT_ADDR); |
i2c_write(reg); |
i2c_write(data); |
i2c_stop(); |
Delay_ms(6); |
} |
byte mag_read(byte reg) //pro cteni reg |
//------------------------------ |
int8 hmc5883l_read_reg(int8 reg) |
{ |
int8 retval; |
i2c_start(); |
I2C_Write(MAG_ADDR_W); |
I2C_write(reg); |
i2c_write(HMC5883L_WRT_ADDR); |
i2c_write(reg); |
i2c_start(); |
i2c_write(HMC5883L_READ_ADDR); |
retval = i2c_read(0); |
i2c_stop(); |
i2c_start(); |
I2C_Write(MAG_ADDR_R); |
reg=i2c_read(0); |
return reg; |
return(retval); |
} |
signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo |
//------------------------------ |
typedef struct |
{ |
signed int16 x; |
x = (((unsigned int16) h << 8) + l ); |
return x; |
} |
signed int16 y; |
signed int16 z; |
}hmc5883l_result; |
// This global structure holds the values read |
// from the HMC5883L x,y,z registers. |
hmc5883l_result compass = {0,0,0}; |
signed int16 mag_readX(void) //nacteni osy x |
//------------------------------ |
void hmc5883l_read_data(void) |
{ |
unsigned int8 h,l; |
signed int16 x; |
h=mag_read(0x03); |
l=mag_read(0x04); |
x=mag_vypocet(h,l); |
return x; |
unsigned int8 x_lsb; |
unsigned int8 x_msb; |
} |
unsigned int8 y_lsb; |
unsigned int8 y_msb; |
unsigned int8 z_lsb; |
unsigned int8 z_msb; |
signed int16 mag_readY(void) //nacteni osy x |
{ |
unsigned int8 h,l; |
signed int16 x; |
h=mag_read(0x07); |
l=mag_read(0x08); |
x=mag_vypocet(h,l); |
return x; |
i2c_start(); |
i2c_write(HMC5883L_WRT_ADDR); |
i2c_write(HMC5883L_X_MSB_REG); // Point to X-msb register |
i2c_start(); |
i2c_write(HMC5883L_READ_ADDR); |
} |
x_msb = i2c_read(); |
x_lsb = i2c_read(); |
z_msb = i2c_read(); |
z_lsb = i2c_read(); |
signed int16 mag_readZ(void) //nacteni osy x |
{ |
unsigned int8 h,l; |
signed int16 x; |
h=mag_read(0x05); |
l=mag_read(0x06); |
x=mag_vypocet(h,l); |
return x; |
y_msb = i2c_read(); |
y_lsb = i2c_read(0); // do a NACK on last read |
i2c_stop(); |
// Combine high and low bytes into 16-bit values. |
compass.x = make16(x_msb, x_lsb); |
compass.y = make16(y_msb, y_lsb); |
compass.z = make16(z_msb, z_lsb); |
} |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.c |
---|
3,7 → 3,12 |
void main() |
{ |
signed int16 X,Y,Z; |
int1 last; |
unsigned int16 anemo_round=0; |
unsigned int16 i; |
//signed int16 X,Y,Z; |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(SPI_SS_DISABLED); |
13,13 → 18,21 |
setup_ccp1(CCP_OFF); |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
set_mag(); |
// Init the HMC5883L. Set Mode register for |
// continuous measurements. |
hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range |
hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0xE0); // maximal range |
hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00); |
// Continuously read and display the x,y,z results. |
// Wait at least 67 ms between reads, re the HMC5883L data sheet. |
printf("Magnetometr: \r\n",); |
printf("(c)mlab JACHO 2013: \r\n",); |
printf("X, Y, Z \r\n",); |
while(true) |
/* while(true) |
{ |
X = mag_readX(); |
Y = mag_readY(); |
28,4 → 41,29 |
Delay_ms(50); |
} |
*/ |
while(TRUE) |
{ |
for( i=0;i<=1000;i++) |
{ |
// delay_ms(); |
hmc5883l_read_data(); |
if(compass.x < 0) |
{ |
if(last == 1) anemo_round++; |
last=0; |
} |
if(compass.x > 0) last=1; |
} |
printf("%6Ld %6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z, anemo_round); |
anemo_round=0; |
} |
} |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.cof |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.err |
---|
1,2 → 1,2 |
Memory usage: ROM=12% RAM=3% - 6% |
Memory usage: ROM=10% RAM=5% - 7% |
0 Errors, 0 Warnings. |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.esym |
---|
1,7 → 1,7 |
D G "__PCM__" 0 33 ""4.106"" |
D G "__DEVICE__" 0 33 "887" |
D G "__DATE__" 0 33 ""15-V-13"" |
D G "__TIME__" 0 33 ""16:26:21"" "Standard Header file for the PIC16F887 device ////////////////" |
D G "__PCM__" 0 71 ""4.106"" |
D G "__DEVICE__" 0 71 "887" |
D G "__DATE__" 0 71 ""15-V-13"" |
D G "__TIME__" 0 71 ""18:53:30"" "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" |
283,35 → 283,41 |
D G "MAG_ROZ470" 3 12 "0xA0" |
D G "MAG_ROZ560" 3 13 "0xC0" |
D G "MAG_ROZ810" 3 14 "0xE0" |
F G "set_mag" 4 1 "void()" "uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ" |
C L "set_mag" 4 3 1 "FUNCTION" |
C L "set_mag" 4 3 1 "FUNCTION" |
C L "set_mag" 4 3 1 "FUNCTION" |
F G "set_mag_roz" 4 26 "void(int8 h)" |
V L "h" 4 26 "int8" "nastavy rozsah" |
F G "mag_read" 4 44 "int8(int8 reg)" |
V L "reg" 4 44 "int8" "pro cteni reg" |
F G "mag_vypocet" 4 58 "sint16(int8 h,int8 l)" |
V L "h" 4 58 "int8" |
V L "l" 4 58 "int8" "prepocet na 16bit cislo" |
V L "x" 4 60 "sint16" |
F G "mag_readX" 4 66 "sint16()" "nacteni osy x" |
V L "h" 4 68 "int8" |
V L "l" 4 68 "int8" |
V L "x" 4 69 "sint16" |
F G "mag_readY" 4 78 "sint16()" "nacteni osy x" |
V L "h" 4 80 "int8" |
V L "l" 4 80 "int8" |
V L "x" 4 81 "sint16" |
F G "mag_readZ" 4 90 "sint16()" "nacteni osy x" |
V L "h" 4 92 "int8" |
V L "l" 4 92 "int8" |
V L "x" 4 93 "sint16" |
D G "HMC5883L_WRT_ADDR" 4 2 "0x3C" |
D G "HMC5883L_READ_ADDR" 4 3 "0x3D" |
D G "HMC5883L_CFG_A_REG" 4 6 "0x00" |
D G "HMC5883L_CFG_B_REG" 4 7 "0x01" |
D G "HMC5883L_MODE_REG" 4 8 "0x02" |
D G "HMC5883L_X_MSB_REG" 4 9 "0x03" |
C L "hmc5883l_write_reg" 4 1 1 "FUNCTION" |
F G "hmc5883l_write_reg" 4 14 "void(int8 reg,int8 data)" |
V L "reg" 4 14 "int8" |
V L "data" 4 14 "int8" |
F G "hmc5883l_read_reg" 4 24 "int8(int8 reg)" |
V L "reg" 4 24 "int8" |
V L "retval" 4 26 "int8" |
T G "hmc5883l_result" 4 45 "{sint16 x,sint16 y,sint16 z}" "This global structure holds the values read" |
V G "compass" 4 49 "hmc5883l_result" |
F G "hmc5883l_read_data" 4 52 "void()" |
V L "x_lsb" 4 54 "int8" |
V L "x_msb" 4 55 "int8" |
V L "y_lsb" 4 57 "int8" |
V L "y_msb" 4 58 "int8" |
V L "z_lsb" 4 60 "int8" |
V L "z_msb" 4 61 "int8" |
C L "hmc5883l_read_data" 4 1 1 "FUNCTION" |
C L "hmc5883l_read_data" 4 1 1 "FUNCTION" |
C L "hmc5883l_read_data" 4 1 1 "FUNCTION" |
F G "MAIN" 0 4 "void()" |
V L "x" 0 6 "sint16" |
V L "Y" 0 6 "sint16" |
V L "Z" 0 6 "sint16" |
C L "MAIN" 0 14 1 "FUNCTION" |
V L "last" 0 6 "int1" |
V L "anemo_round" 0 7 "int16" |
V L "i" 0 8 "int16" "signed int16 X,Y,Z;" |
C L "MAIN" 0 19 3 "FUNCTION" |
C L "MAIN" 0 19 1 "FUNCTION" |
C L "MAIN" 0 19 1 "FUNCTION" |
C L "MAIN" 0 19 2 "FUNCTION" |
C L "MAIN" 0 19 6 "FUNCTION" |
C L "MAIN" 0 19 1 "FUNCTION" |
F B "reset_cpu" 0 0 |
F B "abs" 1 0 |
F B "sleep_ulpwu" 1 0 |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.hex |
---|
1,9 → 1,9 |
:1000000003308A00172B0000CD306737653AEF3692 |
:1000000002308A00502A0000CD306737653AEF365B |
:10001000653A721D20100D050000A831A936EC309C |
:100020006210CA2043244F103218B1193A10A006AA |
:100030000A005816A02C2C105A100D05000108308B |
:10004000F80000008711A011200883168700000027 |
:100050008312AC0D0712031C3328201620088316C8 |
:100050008312B20D0712031C3328201620088316C2 |
:10006000870037288312201220088316870000009B |
:100070008312A0152008831687008312871D3E284F |
:10008000F80B212800008711A01120088316870093 |
11,116 → 11,97 |
:1000A0008312A0152008831687008312871D562807 |
:1000B000F8010000071A78148711A0112008831690 |
:1000C00087008312071220122008831687008312EC |
:1000D0000800273084008313000803197C280230AD |
:1000E000F800F701F70B7228F80B71289730F7002A |
:1000F000F70B7828800B6F2808002016200883163D |
:10010000870000008312A0152008831687000000D6 |
:100110008312071220122008831687000000831222 |
:100120008711A0112008831687003C308312AC0091 |
:100130001F20AC011F207030AC001F2020122008AF |
:100140008316870000008312A015200883168700FD |
:100150008312871DA9280000AD2800002016200862 |
:1001600083168700000006308312A700692020163E |
:1001700020088316870000008312A015200883162C |
:1001800087000000831207122012200883168700C0 |
:10019000000083128711A0112008831687003C30CD |
:1001A0008312AC001F200130AC001F20E030AC00F7 |
:1001B0001F20201220088316870000008312A0153C |
:1001C0002008831687008312871DE4280000E82892 |
:1001D00000002016200883168700000006308312D6 |
:1001E000A7006920201620088316870000008312CC |
:1001F000A015200883168700000083120712201222 |
:10020000200883168700000083128711A0112008A0 |
:10021000831687003C308312AC001F200230AC00F4 |
:100220001F20AC011F202012200883168700000029 |
:100230008312A0152008831687008312871D1E29AC |
:1002400000002229000020162008831687000000E5 |
:1002500006308312A70069208A110A127F2BA0138F |
:10026000200883168700831287130830F800382986 |
:100270000000F8174929F813B00C03188717031C5E |
:100280008713781749297813F80B3C294729000070 |
:1002900087173F308400840B4B290000F81B3B2953 |
:1002A000781B43290800831603178C170C140000D1 |
:1002B000000083120C087F39031997290313A70044 |
:1002C00003170D080313A80003170F080313A90051 |
:1002D0002708B0002F21280803178D0003132908D1 |
:1002E00003178F0083168C170C1400000000831274 |
:1002F0000C0D0E0D7F39031997290313A70003175F |
:100300000D080313A80003170F080313A9002708FB |
:10031000B0002F21280803178D00031329080317A5 |
:100320008F008D0A03198F0A031353290317031330 |
:100330000800201620088316870000008312A015ED |
:10034000200883168700000083120712201220085D |
:1003500083168700000083128711A01120088316DE |
:1003600087003C308312AC001F202B08AC001F20FC |
:10037000201220088316870000008312A015200891 |
:10038000831687008312871DC3290000C729000038 |
:1003900020162008831687000000831220162008EC |
:1003A0008316870000008312A0152008831687009B |
:1003B0000000831207122012200883168700000015 |
:1003C00083128711A0112008831687003D30831205 |
:1003D000AC001F20F7010830AD007708AE002016F2 |
:1003E00020088316870000008312A01520088316BA |
:1003F00087008312871DFA29071A0314071E0310AA |
:10040000F80D0000A01120088316870083128711C1 |
:10041000AD0BEF29201620088316870000008312F9 |
:1004200007122E080319192A2012200883168700A4 |
:1004300083120000A0152008831687008312871DF1 |
:100440001F2A00008711A0112008831687000000D2 |
:10045000831207122012200883168700780883125F |
:10046000AB002B08F8000800B0012B08AF00B0006B |
:10047000AF012C082F07F8003008FA000318FA0A19 |
:100480007808AD007A08AE002D08F8002E08F900B3 |
:1004900008000330AB0099217808A7000430AB00B6 |
:1004A00099217808A8002708AB002808AC0034225E |
:1004B0007908AA007808A9002908F8002A08F90094 |
:1004C0008A110A12952B0730AB0099217808A700F2 |
:1004D0000830AB0099217808A8002708AB0028084D |
:1004E000AC0034227908AA007808A9002908F8008D |
:1004F0002A08F9008A110A129A2B0530AB009921BB |
:100500007808A7000630AB0099217808A8002708D2 |
:10051000AB002808AC0034227908AA007808A900AA |
:100520002908F8002A08F9008A110A129F2BAF0146 |
:100530000408AE002F10831B2F14A81FA72AAE1784 |
:100540002E1EAE0AA709A809A70A0319A80A280E91 |
:10055000F038AA00AA07E23EAB00323EAD00280800 |
:100560000F39AB07AB07AD07E93EAC00AC07AC07F2 |
:10057000270E0F39AC07AD07AC0DAD0DAD09AD0DB4 |
:1005800027080F39AD07AA0D0730A9000A30AD07BB |
:10059000AC03031CC72AAC07AB03031CCB2AAB0775 |
:1005A000AA03031CCF2AAA07A903031CD32A2930B4 |
:1005B0008400831307302E052E1384032E05031D9C |
:1005C000E82A2E1A840A2E1AE82A2030F700052B72 |
:1005D00084072D30040203192E170008F700031DAD |
:1005E000F92A2E1BF92A2E1A132BAE19F92A2030BC |
:1005F000042BAE1F012B2D30F70084032E13AE13F6 |
:10060000052BAE152E123030F707A8010408A700FD |
:100610002810831B28147708B0002F212708840096 |
:10062000831328188317840A2E1FE92A08008401DF |
:1006300083131F308305713083168F000F088312D8 |
:10064000A0132008831687008312871783160317C9 |
:100650000908C039890003131F129F1200300317C5 |
:1006600088008312870188018901FF300313A000ED |
:10067000831603170908C039890003131F129F123C |
:10068000003003178800831203131F139F13831670 |
:100690009F1383121F149412A01220088316870040 |
:1006A000831220162008831687008312A0112008C9 |
:1006B0008316870001308312940000308316940063 |
:1006C0000108C73908388100831290010030F80012 |
:1006D00092000030831692008312201520088316A2 |
:1006E00087008312970183169B019C0101309D00B6 |
:1006F0008312031787018801890103137D280430C1 |
:1007000003178D0000308F00031353210D300317A2 |
:100710008D0000308F0003135321193003178D0013 |
:1007200000308F0003135321492A7908A20078086A |
:10073000A100632A7908A4007808A3007D2A79081B |
:10074000A6007808A500023084002208A80021082D |
:10075000A70097222030B0002F2102308400240807 |
:10076000A8002308A70097222030B0002F210230D4 |
:1007700084002608A8002508A70097222030B00092 |
:100780002F210D30B0002F210A30B0002F21323040 |
:08079000A7006920942B63000F |
:1000D0000800201620088316870000008312A01550 |
:1000E00020088316870000008312071220122008C0 |
:1000F00083168700000083128711A0112008831641 |
:1001000087003C308312B2001F202C08B2001F2051 |
:100110002D08B2001F20201220088316870000003F |
:100120008312A0152008831687008312871D962846 |
:1001300000009A280000201620088316870000007F |
:1001400083120800A01320088316870083128713E8 |
:100150000830F800AB280000F817BC28F813B50CDD |
:1001600003188717031C87137817BC287813F80B1C |
:10017000AF28BA28000087173F308400840BBE28C0 |
:100180000000F81BAE28781BB6280800831603175A |
:100190008C170C140000000083120C087F3903191F |
:1001A0000A290313AC0003170D080313AD0003174E |
:1001B0000F080313AE002C08B500A2202D0803176A |
:1001C0008D0003132E0803178F0083168C170C1451 |
:1001D0000000000083120C0D0E0D7F3903190A294F |
:1001E0000313AC0003170D080313AD0003170F082A |
:1001F0000313AE002C08B500A2202D0803178D00B4 |
:1002000003132E0803178F008D0A03198F0A031397 |
:10021000C6280317031308000830B3007708B4009A |
:10022000201620088316870000008312A0152008DE |
:10023000831687008312871D1B29071A0314071EC4 |
:100240000310F80D0000A011200883168700831208 |
:100250008711B30B10292016200883168700000091 |
:1002600083120712340803193A2920122008831632 |
:10027000870083120000A0152008831687008312D0 |
:10028000871D402900008711A011200883168700D0 |
:1002900000008312071220122008831687008312A1 |
:1002A0000800201620088316870000008312A0157E |
:1002B00020088316870000008312071220122008EE |
:1002C00083168700000083128711A011200883166F |
:1002D00087003C308312B2001F200330B2001F2081 |
:1002E000201620088316870000008312A01520081E |
:1002F0008316870000008312871D7C2907122012B5 |
:10030000200883168700000083128711A01120089F |
:10031000831687003D308312B2001F200130F700A2 |
:100320000C217808AD000130F7000C217808AC00F2 |
:100330000130F7000C217808B1000130F7000C21E2 |
:100340007808B0000130F7000C217808AF00F70101 |
:100350000C217808AE0020122008831687000000C8 |
:100360008312A0152008831687008312871DB629E3 |
:100370000000BA290000201620088316870000001C |
:1003800083122D08A2002C08A1002F08A4002E081B |
:10039000A3003108A6003008A5008A110A12EE2A2F |
:1003A000B4010408B3003410831B3414AD1FE029DA |
:1003B000B317331EB30AAC09AD09AC0A0319AD0A71 |
:1003C0002D0EF038AF00AF07E23EB000323EB20073 |
:1003D0002D080F39B007B007B207E93EB100B107E9 |
:1003E000B1072C0E0F39B107B207B10DB20DB2092A |
:1003F000B20D2C080F39B207AF0D0730AE000A302E |
:10040000B207B103031C002AB107B003031C042A7E |
:10041000B007AF03031C082AAF07AE03031C0C2A66 |
:100420002E308400831307303305331384033305E0 |
:10043000031D212A331A840A331A212A2030F70097 |
:100440003E2A840732300402031933170008F700EC |
:10045000031D322A331B322A331A4C2AB319322A8B |
:1004600020303D2AB31F3A2A2D30F700840333137E |
:10047000B3133E2AB31533123030F707AD01040829 |
:10048000AC002D10831B2D147708B500A2202C087A |
:10049000840083132D188317840A331F222A08002F |
:1004A000840183131F308305713083168F000F087A |
:1004B0008312A013200883168700831287178316E0 |
:1004C00003170908C039890003131F129F12003057 |
:1004D000031788008312870188018901FF30031305 |
:1004E000A000A101A201A301A401A501A601A901E7 |
:1004F000A801831603170908C039890003131F12C6 |
:100500009F12003003178800831203131F139F13D9 |
:1005100083169F1383121F149412A01220088316AF |
:100520008700831220162008831687008312A011EB |
:100530002008831687000130831294000030831650 |
:1005400094000108C73908388100831290010030F7 |
:10055000F8009200003083169200831220152008C4 |
:10056000831687008312970183169B019C0101303B |
:100570009D00831203178701880189010313AC01D1 |
:100580001830AD0069200130AC00E030AD006920CA |
:100590000230AC00AD016920043003178D0000303B |
:1005A0008F000313C6200D3003178D0000308F001D |
:1005B0000313C620193003178D0000308F0003137A |
:1005C000C620AB01AA012B08033C031C032B031D0F |
:1005D000ED2A2A08E83C031C032B5129A21FF62A06 |
:1005E000271CF52AA80A0319A90A2710A21BFF2A0B |
:1005F000A208031DFE2A2108003C031C2714AA0A96 |
:100600000319AB0AE32A003084002208AD00210858 |
:10061000AC00D0212030B500A22000308400240896 |
:10062000AD002308AC00D0212030B500A22000305E |
:1006300084002608AD002508AC00D0212030B5008C |
:10064000A220003084002908AD002808AC00D02189 |
:100650002030B500A2200A30B500A2200D30B50030 |
:0A066000A220A901A801E12A63000D |
:04400E00F52CFF3F4F |
:00000001FF |
;PIC16F887 |
;CRC=F162 CREATED="15-V-13 16:26" |
;CRC=E057 CREATED="15-V-13 18:53" |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.lst |
---|
1,17 → 1,17 |
CCS PCM C Compiler, Version 4.106, 47914 15-V-13 16:26 |
CCS PCM C Compiler, Version 4.106, 47914 15-V-13 18:53 |
Filename: Z:\home\kaklik\svnMLAB\Modules\Sensors\MAG01A\SW\PIC16F887\main.lst |
ROM used: 972 words (12%) |
ROM used: 821 words (10%) |
Largest free fragment is 2048 |
RAM used: 12 (3%) at main() level |
22 (6%) worst case |
Stack: 3 locations |
RAM used: 18 (5%) at main() level |
27 (7%) worst case |
Stack: 2 locations |
* |
0000: MOVLW 03 |
0000: MOVLW 02 |
0001: MOVWF 0A |
0002: GOTO 317 |
0002: GOTO 250 |
0003: NOP |
.................... #include "main.h" |
.................... #include <16F887.h> |
36,27 → 36,6 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
.................... |
.................... #use delay(clock=8000000) |
* |
0069: MOVLW 27 |
006A: MOVWF 04 |
006B: BCF 03.7 |
006C: MOVF 00,W |
006D: BTFSC 03.2 |
006E: GOTO 07C |
006F: MOVLW 02 |
0070: MOVWF 78 |
0071: CLRF 77 |
0072: DECFSZ 77,F |
0073: GOTO 072 |
0074: DECFSZ 78,F |
0075: GOTO 071 |
0076: MOVLW 97 |
0077: MOVWF 77 |
0078: DECFSZ 77,F |
0079: GOTO 078 |
007A: DECFSZ 00,F |
007B: GOTO 06F |
007C: RETURN |
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3) |
* |
001F: MOVLW 08 |
69,7 → 48,7 |
0026: MOVWF 07 |
0027: NOP |
0028: BCF 03.5 |
0029: RLF 2C,F |
0029: RLF 32,F |
002A: BCF 07.4 |
002B: BTFSS 03.0 |
002C: GOTO 033 |
134,111 → 113,113 |
0067: BCF 03.5 |
0068: RETURN |
* |
01EB: MOVLW 08 |
01EC: MOVWF 2D |
01ED: MOVF 77,W |
01EE: MOVWF 2E |
01EF: BSF 20.4 |
01F0: MOVF 20,W |
01F1: BSF 03.5 |
01F2: MOVWF 07 |
01F3: NOP |
01F4: BCF 03.5 |
01F5: BSF 20.3 |
01F6: MOVF 20,W |
01F7: BSF 03.5 |
01F8: MOVWF 07 |
01F9: BCF 03.5 |
01FA: BTFSS 07.3 |
01FB: GOTO 1FA |
01FC: BTFSC 07.4 |
01FD: BSF 03.0 |
01FE: BTFSS 07.4 |
01FF: BCF 03.0 |
0200: RLF 78,F |
0201: NOP |
0202: BCF 20.3 |
0203: MOVF 20,W |
0204: BSF 03.5 |
0205: MOVWF 07 |
0206: BCF 03.5 |
0207: BCF 07.3 |
0208: DECFSZ 2D,F |
0209: GOTO 1EF |
020A: BSF 20.4 |
020B: MOVF 20,W |
020C: BSF 03.5 |
020D: MOVWF 07 |
020E: NOP |
020F: BCF 03.5 |
0210: BCF 07.4 |
0211: MOVF 2E,W |
0212: BTFSC 03.2 |
0213: GOTO 219 |
0214: BCF 20.4 |
0215: MOVF 20,W |
0216: BSF 03.5 |
0217: MOVWF 07 |
0218: BCF 03.5 |
0219: NOP |
021A: BSF 20.3 |
021B: MOVF 20,W |
021C: BSF 03.5 |
021D: MOVWF 07 |
021E: BCF 03.5 |
021F: BTFSS 07.3 |
0220: GOTO 21F |
0221: NOP |
0222: BCF 07.3 |
0223: BCF 20.3 |
0224: MOVF 20,W |
0225: BSF 03.5 |
0226: MOVWF 07 |
0227: NOP |
0228: BCF 03.5 |
0229: BCF 07.4 |
022A: BCF 20.4 |
022B: MOVF 20,W |
022C: BSF 03.5 |
022D: MOVWF 07 |
010C: MOVLW 08 |
010D: MOVWF 33 |
010E: MOVF 77,W |
010F: MOVWF 34 |
0110: BSF 20.4 |
0111: MOVF 20,W |
0112: BSF 03.5 |
0113: MOVWF 07 |
0114: NOP |
0115: BCF 03.5 |
0116: BSF 20.3 |
0117: MOVF 20,W |
0118: BSF 03.5 |
0119: MOVWF 07 |
011A: BCF 03.5 |
011B: BTFSS 07.3 |
011C: GOTO 11B |
011D: BTFSC 07.4 |
011E: BSF 03.0 |
011F: BTFSS 07.4 |
0120: BCF 03.0 |
0121: RLF 78,F |
0122: NOP |
0123: BCF 20.3 |
0124: MOVF 20,W |
0125: BSF 03.5 |
0126: MOVWF 07 |
0127: BCF 03.5 |
0128: BCF 07.3 |
0129: DECFSZ 33,F |
012A: GOTO 110 |
012B: BSF 20.4 |
012C: MOVF 20,W |
012D: BSF 03.5 |
012E: MOVWF 07 |
012F: NOP |
0130: BCF 03.5 |
0131: BCF 07.4 |
0132: MOVF 34,W |
0133: BTFSC 03.2 |
0134: GOTO 13A |
0135: BCF 20.4 |
0136: MOVF 20,W |
0137: BSF 03.5 |
0138: MOVWF 07 |
0139: BCF 03.5 |
013A: NOP |
013B: BSF 20.3 |
013C: MOVF 20,W |
013D: BSF 03.5 |
013E: MOVWF 07 |
013F: BCF 03.5 |
0140: BTFSS 07.3 |
0141: GOTO 140 |
0142: NOP |
0143: BCF 07.3 |
0144: BCF 20.3 |
0145: MOVF 20,W |
0146: BSF 03.5 |
0147: MOVWF 07 |
0148: NOP |
0149: BCF 03.5 |
014A: BCF 07.4 |
014B: BCF 20.4 |
014C: MOVF 20,W |
014D: BSF 03.5 |
014E: MOVWF 07 |
014F: BCF 03.5 |
0150: RETURN |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD |
* |
012F: BCF 20.7 |
0130: MOVF 20,W |
0131: BSF 03.5 |
0132: MOVWF 07 |
0133: BCF 03.5 |
0134: BCF 07.7 |
0135: MOVLW 08 |
0136: MOVWF 78 |
0137: GOTO 138 |
0138: NOP |
0139: BSF 78.7 |
013A: GOTO 149 |
013B: BCF 78.7 |
013C: RRF 30,F |
013D: BTFSC 03.0 |
013E: BSF 07.7 |
013F: BTFSS 03.0 |
0140: BCF 07.7 |
0141: BSF 78.6 |
0142: GOTO 149 |
0143: BCF 78.6 |
0144: DECFSZ 78,F |
0145: GOTO 13C |
0146: GOTO 147 |
0147: NOP |
0148: BSF 07.7 |
0149: MOVLW 3F |
014A: MOVWF 04 |
014B: DECFSZ 04,F |
014C: GOTO 14B |
014D: NOP |
014E: BTFSC 78.7 |
014F: GOTO 13B |
0150: BTFSC 78.6 |
0151: GOTO 143 |
0152: RETURN |
00A2: BCF 20.7 |
00A3: MOVF 20,W |
00A4: BSF 03.5 |
00A5: MOVWF 07 |
00A6: BCF 03.5 |
00A7: BCF 07.7 |
00A8: MOVLW 08 |
00A9: MOVWF 78 |
00AA: GOTO 0AB |
00AB: NOP |
00AC: BSF 78.7 |
00AD: GOTO 0BC |
00AE: BCF 78.7 |
00AF: RRF 35,F |
00B0: BTFSC 03.0 |
00B1: BSF 07.7 |
00B2: BTFSS 03.0 |
00B3: BCF 07.7 |
00B4: BSF 78.6 |
00B5: GOTO 0BC |
00B6: BCF 78.6 |
00B7: DECFSZ 78,F |
00B8: GOTO 0AF |
00B9: GOTO 0BA |
00BA: NOP |
00BB: BSF 07.7 |
00BC: MOVLW 3F |
00BD: MOVWF 04 |
00BE: DECFSZ 04,F |
00BF: GOTO 0BE |
00C0: NOP |
00C1: BTFSC 78.7 |
00C2: GOTO 0AE |
00C3: BTFSC 78.6 |
00C4: GOTO 0B6 |
00C5: RETURN |
.................... |
.................... |
.................... #include "HMC5883L.h" |
259,687 → 240,576 |
.................... |
.................... |
.................... #include "HMC5883L.c" |
.................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ |
.................... // i2c slave addresses |
.................... #define HMC5883L_WRT_ADDR 0x3C |
.................... #define HMC5883L_READ_ADDR 0x3D |
.................... |
.................... // Register addresses |
.................... #define HMC5883L_CFG_A_REG 0x00 |
.................... #define HMC5883L_CFG_B_REG 0x01 |
.................... #define HMC5883L_MODE_REG 0x02 |
.................... #define HMC5883L_X_MSB_REG 0x03 |
.................... |
.................... //------------------------------ |
.................... // Low level routines |
.................... //------------------------------ |
.................... void hmc5883l_write_reg(int8 reg, int8 data) |
.................... { |
.................... i2c_start(); //nastavení Configuration Register A |
.................... i2c_start(); |
* |
007D: BSF 20.4 |
0069: BSF 20.4 |
006A: MOVF 20,W |
006B: BSF 03.5 |
006C: MOVWF 07 |
006D: NOP |
006E: BCF 03.5 |
006F: BSF 20.3 |
0070: MOVF 20,W |
0071: BSF 03.5 |
0072: MOVWF 07 |
0073: NOP |
0074: BCF 03.5 |
0075: BCF 07.4 |
0076: BCF 20.4 |
0077: MOVF 20,W |
0078: BSF 03.5 |
0079: MOVWF 07 |
007A: NOP |
007B: BCF 03.5 |
007C: BCF 07.3 |
007D: BCF 20.3 |
007E: MOVF 20,W |
007F: BSF 03.5 |
0080: MOVWF 07 |
0081: NOP |
.................... i2c_write(HMC5883L_WRT_ADDR); |
0081: MOVLW 3C |
0082: BCF 03.5 |
0083: BSF 20.3 |
0084: MOVF 20,W |
0085: BSF 03.5 |
0086: MOVWF 07 |
0087: NOP |
0088: BCF 03.5 |
0089: BCF 07.4 |
008A: BCF 20.4 |
008B: MOVF 20,W |
008C: BSF 03.5 |
008D: MOVWF 07 |
008E: NOP |
008F: BCF 03.5 |
0090: BCF 07.3 |
0091: BCF 20.3 |
0083: MOVWF 32 |
0084: CALL 01F |
.................... i2c_write(reg); |
0085: MOVF 2C,W |
0086: MOVWF 32 |
0087: CALL 01F |
.................... i2c_write(data); |
0088: MOVF 2D,W |
0089: MOVWF 32 |
008A: CALL 01F |
.................... i2c_stop(); |
008B: BCF 20.4 |
008C: MOVF 20,W |
008D: BSF 03.5 |
008E: MOVWF 07 |
008F: NOP |
0090: BCF 03.5 |
0091: BSF 20.3 |
0092: MOVF 20,W |
0093: BSF 03.5 |
0094: MOVWF 07 |
.................... I2C_Write(MAG_ADDR_W); |
0095: MOVLW 3C |
0096: BCF 03.5 |
0097: MOVWF 2C |
0098: CALL 01F |
.................... I2C_Write(0x00); |
0099: CLRF 2C |
009A: CALL 01F |
.................... I2C_Write(0x70); |
009B: MOVLW 70 |
009C: MOVWF 2C |
009D: CALL 01F |
.................... i2c_stop(); |
009E: BCF 20.4 |
009F: MOVF 20,W |
00A0: BSF 03.5 |
00A1: MOVWF 07 |
00A2: NOP |
00A3: BCF 03.5 |
00A4: BSF 20.3 |
00A5: MOVF 20,W |
00A6: BSF 03.5 |
00A7: MOVWF 07 |
00A8: BCF 03.5 |
00A9: BTFSS 07.3 |
00AA: GOTO 0A9 |
00AB: NOP |
00AC: GOTO 0AD |
00AD: NOP |
00AE: BSF 20.4 |
00AF: MOVF 20,W |
00B0: BSF 03.5 |
00B1: MOVWF 07 |
00B2: NOP |
.................... Delay_ms(6); |
00B3: MOVLW 06 |
00B4: BCF 03.5 |
00B5: MOVWF 27 |
00B6: CALL 069 |
.................... |
.................... i2c_start(); //nastavení Configuration Register B |
00B7: BSF 20.4 |
00B8: MOVF 20,W |
00B9: BSF 03.5 |
00BA: MOVWF 07 |
00BB: NOP |
00BC: BCF 03.5 |
00BD: BSF 20.3 |
00BE: MOVF 20,W |
00BF: BSF 03.5 |
00C0: MOVWF 07 |
00C1: NOP |
00C2: BCF 03.5 |
00C3: BCF 07.4 |
00C4: BCF 20.4 |
00C5: MOVF 20,W |
00C6: BSF 03.5 |
00C7: MOVWF 07 |
00C8: NOP |
00C9: BCF 03.5 |
00CA: BCF 07.3 |
00CB: BCF 20.3 |
00CC: MOVF 20,W |
00CD: BSF 03.5 |
00CE: MOVWF 07 |
.................... I2C_Write(MAG_ADDR_W); |
00CF: MOVLW 3C |
00D0: BCF 03.5 |
00D1: MOVWF 2C |
00D2: CALL 01F |
.................... I2C_Write(0x01); |
00D3: MOVLW 01 |
00D4: MOVWF 2C |
00D5: CALL 01F |
.................... I2C_Write(MAG_ROZ810); |
00D6: MOVLW E0 |
00D7: MOVWF 2C |
00D8: CALL 01F |
.................... i2c_stop(); |
00D9: BCF 20.4 |
00DA: MOVF 20,W |
00DB: BSF 03.5 |
00DC: MOVWF 07 |
00DD: NOP |
00DE: BCF 03.5 |
00DF: BSF 20.3 |
00E0: MOVF 20,W |
00E1: BSF 03.5 |
00E2: MOVWF 07 |
00E3: BCF 03.5 |
00E4: BTFSS 07.3 |
00E5: GOTO 0E4 |
00E6: NOP |
00E7: GOTO 0E8 |
00E8: NOP |
00E9: BSF 20.4 |
00EA: MOVF 20,W |
00EB: BSF 03.5 |
00EC: MOVWF 07 |
00ED: NOP |
.................... |
.................... Delay_ms(6); |
00EE: MOVLW 06 |
00EF: BCF 03.5 |
00F0: MOVWF 27 |
00F1: CALL 069 |
.................... |
.................... i2c_start(); //nastveni Mode Register |
00F2: BSF 20.4 |
00F3: MOVF 20,W |
00F4: BSF 03.5 |
00F5: MOVWF 07 |
00F6: NOP |
00F7: BCF 03.5 |
00F8: BSF 20.3 |
00F9: MOVF 20,W |
00FA: BSF 03.5 |
00FB: MOVWF 07 |
00FC: NOP |
00FD: BCF 03.5 |
00FE: BCF 07.4 |
00FF: BCF 20.4 |
0100: MOVF 20,W |
0101: BSF 03.5 |
0102: MOVWF 07 |
0103: NOP |
0104: BCF 03.5 |
0105: BCF 07.3 |
0106: BCF 20.3 |
0107: MOVF 20,W |
0108: BSF 03.5 |
0109: MOVWF 07 |
.................... I2C_Write(MAG_ADDR_W); |
010A: MOVLW 3C |
010B: BCF 03.5 |
010C: MOVWF 2C |
010D: CALL 01F |
.................... I2C_Write(0x02); |
010E: MOVLW 02 |
010F: MOVWF 2C |
0110: CALL 01F |
.................... I2C_Write(0x00); |
0111: CLRF 2C |
0112: CALL 01F |
.................... i2c_stop(); |
0113: BCF 20.4 |
0114: MOVF 20,W |
0115: BSF 03.5 |
0116: MOVWF 07 |
0117: NOP |
0118: BCF 03.5 |
0119: BSF 20.3 |
011A: MOVF 20,W |
011B: BSF 03.5 |
011C: MOVWF 07 |
011D: BCF 03.5 |
011E: BTFSS 07.3 |
011F: GOTO 11E |
0120: NOP |
0121: GOTO 122 |
0122: NOP |
0123: BSF 20.4 |
0124: MOVF 20,W |
0125: BSF 03.5 |
0126: MOVWF 07 |
0127: NOP |
.................... Delay_ms(6); |
0128: MOVLW 06 |
0129: BCF 03.5 |
012A: MOVWF 27 |
012B: CALL 069 |
0095: BCF 03.5 |
0096: BTFSS 07.3 |
0097: GOTO 096 |
0098: NOP |
0099: GOTO 09A |
009A: NOP |
009B: BSF 20.4 |
009C: MOVF 20,W |
009D: BSF 03.5 |
009E: MOVWF 07 |
009F: NOP |
.................... } |
012C: BCF 0A.3 |
012D: BCF 0A.4 |
012E: GOTO 37F (RETURN) |
00A0: BCF 03.5 |
00A1: RETURN |
.................... |
.................... void set_mag_roz (unsigned int8 h) //nastavy rozsah |
.................... //------------------------------ |
.................... int8 hmc5883l_read_reg(int8 reg) |
.................... { |
.................... int8 retval; |
.................... |
.................... // |
.................... |
.................... |
.................... i2c_start(); |
.................... I2C_Write(MAG_ADDR_W); |
.................... I2C_Write(0x01); |
.................... I2C_Write(h); |
.................... i2c_write(HMC5883L_WRT_ADDR); |
.................... i2c_write(reg); |
.................... i2c_start(); |
.................... i2c_write(HMC5883L_READ_ADDR); |
.................... retval = i2c_read(0); |
.................... i2c_stop(); |
.................... |
.................... Delay_ms(6); |
.................... |
.................... |
.................... return(retval); |
.................... } |
.................... |
.................... |
.................... byte mag_read(byte reg) //pro cteni reg |
.................... //------------------------------ |
.................... typedef struct |
.................... { |
.................... signed int16 x; |
.................... signed int16 y; |
.................... signed int16 z; |
.................... }hmc5883l_result; |
.................... |
.................... i2c_start(); |
.................... // This global structure holds the values read |
.................... // from the HMC5883L x,y,z registers. |
.................... hmc5883l_result compass = {0,0,0}; |
* |
0199: BSF 20.4 |
019A: MOVF 20,W |
019B: BSF 03.5 |
019C: MOVWF 07 |
019D: NOP |
019E: BCF 03.5 |
019F: BSF 20.3 |
01A0: MOVF 20,W |
01A1: BSF 03.5 |
01A2: MOVWF 07 |
01A3: NOP |
01A4: BCF 03.5 |
01A5: BCF 07.4 |
01A6: BCF 20.4 |
01A7: MOVF 20,W |
01A8: BSF 03.5 |
01A9: MOVWF 07 |
01AA: NOP |
01AB: BCF 03.5 |
01AC: BCF 07.3 |
01AD: BCF 20.3 |
01AE: MOVF 20,W |
01AF: BSF 03.5 |
01B0: MOVWF 07 |
.................... I2C_Write(MAG_ADDR_W); |
01B1: MOVLW 3C |
01B2: BCF 03.5 |
01B3: MOVWF 2C |
01B4: CALL 01F |
.................... I2C_write(reg); |
01B5: MOVF 2B,W |
01B6: MOVWF 2C |
01B7: CALL 01F |
.................... i2c_stop(); |
01B8: BCF 20.4 |
01B9: MOVF 20,W |
01BA: BSF 03.5 |
01BB: MOVWF 07 |
01BC: NOP |
01BD: BCF 03.5 |
01BE: BSF 20.3 |
01BF: MOVF 20,W |
01C0: BSF 03.5 |
01C1: MOVWF 07 |
01C2: BCF 03.5 |
01C3: BTFSS 07.3 |
01C4: GOTO 1C3 |
01C5: NOP |
01C6: GOTO 1C7 |
01C7: NOP |
01C8: BSF 20.4 |
01C9: MOVF 20,W |
01CA: BSF 03.5 |
01CB: MOVWF 07 |
01CC: NOP |
.................... i2c_start(); |
01CD: BCF 03.5 |
01CE: BSF 20.4 |
01CF: MOVF 20,W |
01D0: BSF 03.5 |
01D1: MOVWF 07 |
01D2: NOP |
01D3: BCF 03.5 |
01D4: BSF 20.3 |
01D5: MOVF 20,W |
01D6: BSF 03.5 |
01D7: MOVWF 07 |
01D8: NOP |
01D9: BCF 03.5 |
01DA: BCF 07.4 |
01DB: BCF 20.4 |
01DC: MOVF 20,W |
01DD: BSF 03.5 |
01DE: MOVWF 07 |
01DF: NOP |
01E0: BCF 03.5 |
01E1: BCF 07.3 |
01E2: BCF 20.3 |
01E3: MOVF 20,W |
01E4: BSF 03.5 |
01E5: MOVWF 07 |
.................... I2C_Write(MAG_ADDR_R); |
01E6: MOVLW 3D |
01E7: BCF 03.5 |
01E8: MOVWF 2C |
01E9: CALL 01F |
.................... reg=i2c_read(0); |
01EA: CLRF 77 |
* |
022E: MOVF 78,W |
022F: BCF 03.5 |
0230: MOVWF 2B |
.................... return reg; |
0231: MOVF 2B,W |
0232: MOVWF 78 |
.................... } |
0233: RETURN |
0271: CLRF 21 |
0272: CLRF 22 |
0273: CLRF 23 |
0274: CLRF 24 |
0275: CLRF 25 |
0276: CLRF 26 |
.................... |
.................... |
.................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo |
.................... //------------------------------ |
.................... void hmc5883l_read_data(void) |
.................... { |
.................... signed int16 x; |
.................... x = (((unsigned int16) h << 8) + l ); |
0234: CLRF 30 |
0235: MOVF 2B,W |
0236: MOVWF 2F |
0237: MOVWF 30 |
0238: CLRF 2F |
0239: MOVF 2C,W |
023A: ADDWF 2F,W |
023B: MOVWF 78 |
023C: MOVF 30,W |
023D: MOVWF 7A |
023E: BTFSC 03.0 |
023F: INCF 7A,F |
0240: MOVF 78,W |
0241: MOVWF 2D |
0242: MOVF 7A,W |
0243: MOVWF 2E |
.................... return x; |
0244: MOVF 2D,W |
0245: MOVWF 78 |
0246: MOVF 2E,W |
0247: MOVWF 79 |
.................... } |
0248: RETURN |
.................... unsigned int8 x_lsb; |
.................... unsigned int8 x_msb; |
.................... |
.................... unsigned int8 y_lsb; |
.................... unsigned int8 y_msb; |
.................... |
.................... signed int16 mag_readX(void) //nacteni osy x |
.................... { |
.................... unsigned int8 h,l; |
.................... signed int16 x; |
.................... h=mag_read(0x03); |
0249: MOVLW 03 |
024A: MOVWF 2B |
024B: CALL 199 |
024C: MOVF 78,W |
024D: MOVWF 27 |
.................... l=mag_read(0x04); |
024E: MOVLW 04 |
024F: MOVWF 2B |
0250: CALL 199 |
0251: MOVF 78,W |
0252: MOVWF 28 |
.................... x=mag_vypocet(h,l); |
0253: MOVF 27,W |
0254: MOVWF 2B |
0255: MOVF 28,W |
0256: MOVWF 2C |
0257: CALL 234 |
0258: MOVF 79,W |
0259: MOVWF 2A |
025A: MOVF 78,W |
025B: MOVWF 29 |
.................... return x; |
025C: MOVF 29,W |
025D: MOVWF 78 |
025E: MOVF 2A,W |
025F: MOVWF 79 |
.................... unsigned int8 z_lsb; |
.................... unsigned int8 z_msb; |
.................... |
.................... } |
0260: BCF 0A.3 |
0261: BCF 0A.4 |
0262: GOTO 395 (RETURN) |
.................... i2c_start(); |
* |
0151: BSF 20.4 |
0152: MOVF 20,W |
0153: BSF 03.5 |
0154: MOVWF 07 |
0155: NOP |
0156: BCF 03.5 |
0157: BSF 20.3 |
0158: MOVF 20,W |
0159: BSF 03.5 |
015A: MOVWF 07 |
015B: NOP |
015C: BCF 03.5 |
015D: BCF 07.4 |
015E: BCF 20.4 |
015F: MOVF 20,W |
0160: BSF 03.5 |
0161: MOVWF 07 |
0162: NOP |
0163: BCF 03.5 |
0164: BCF 07.3 |
0165: BCF 20.3 |
0166: MOVF 20,W |
0167: BSF 03.5 |
0168: MOVWF 07 |
.................... i2c_write(HMC5883L_WRT_ADDR); |
0169: MOVLW 3C |
016A: BCF 03.5 |
016B: MOVWF 32 |
016C: CALL 01F |
.................... i2c_write(HMC5883L_X_MSB_REG); // Point to X-msb register |
016D: MOVLW 03 |
016E: MOVWF 32 |
016F: CALL 01F |
.................... i2c_start(); |
0170: BSF 20.4 |
0171: MOVF 20,W |
0172: BSF 03.5 |
0173: MOVWF 07 |
0174: NOP |
0175: BCF 03.5 |
0176: BSF 20.3 |
0177: MOVF 20,W |
0178: BSF 03.5 |
0179: MOVWF 07 |
017A: NOP |
017B: BCF 03.5 |
017C: BTFSS 07.3 |
017D: GOTO 17C |
017E: BCF 07.4 |
017F: BCF 20.4 |
0180: MOVF 20,W |
0181: BSF 03.5 |
0182: MOVWF 07 |
0183: NOP |
0184: BCF 03.5 |
0185: BCF 07.3 |
0186: BCF 20.3 |
0187: MOVF 20,W |
0188: BSF 03.5 |
0189: MOVWF 07 |
.................... i2c_write(HMC5883L_READ_ADDR); |
018A: MOVLW 3D |
018B: BCF 03.5 |
018C: MOVWF 32 |
018D: CALL 01F |
.................... |
.................... x_msb = i2c_read(); |
018E: MOVLW 01 |
018F: MOVWF 77 |
0190: CALL 10C |
0191: MOVF 78,W |
0192: MOVWF 2D |
.................... x_lsb = i2c_read(); |
0193: MOVLW 01 |
0194: MOVWF 77 |
0195: CALL 10C |
0196: MOVF 78,W |
0197: MOVWF 2C |
.................... |
.................... signed int16 mag_readY(void) //nacteni osy x |
.................... { |
.................... unsigned int8 h,l; |
.................... signed int16 x; |
.................... h=mag_read(0x07); |
0263: MOVLW 07 |
0264: MOVWF 2B |
0265: CALL 199 |
0266: MOVF 78,W |
0267: MOVWF 27 |
.................... l=mag_read(0x08); |
0268: MOVLW 08 |
0269: MOVWF 2B |
026A: CALL 199 |
026B: MOVF 78,W |
026C: MOVWF 28 |
.................... x=mag_vypocet(h,l); |
026D: MOVF 27,W |
026E: MOVWF 2B |
026F: MOVF 28,W |
0270: MOVWF 2C |
0271: CALL 234 |
0272: MOVF 79,W |
0273: MOVWF 2A |
0274: MOVF 78,W |
0275: MOVWF 29 |
.................... return x; |
0276: MOVF 29,W |
0277: MOVWF 78 |
0278: MOVF 2A,W |
0279: MOVWF 79 |
.................... z_msb = i2c_read(); |
0198: MOVLW 01 |
0199: MOVWF 77 |
019A: CALL 10C |
019B: MOVF 78,W |
019C: MOVWF 31 |
.................... z_lsb = i2c_read(); |
019D: MOVLW 01 |
019E: MOVWF 77 |
019F: CALL 10C |
01A0: MOVF 78,W |
01A1: MOVWF 30 |
.................... |
.................... } |
027A: BCF 0A.3 |
027B: BCF 0A.4 |
027C: GOTO 39A (RETURN) |
.................... y_msb = i2c_read(); |
01A2: MOVLW 01 |
01A3: MOVWF 77 |
01A4: CALL 10C |
01A5: MOVF 78,W |
01A6: MOVWF 2F |
.................... y_lsb = i2c_read(0); // do a NACK on last read |
01A7: CLRF 77 |
01A8: CALL 10C |
01A9: MOVF 78,W |
01AA: MOVWF 2E |
.................... |
.................... i2c_stop(); |
01AB: BCF 20.4 |
01AC: MOVF 20,W |
01AD: BSF 03.5 |
01AE: MOVWF 07 |
01AF: NOP |
01B0: BCF 03.5 |
01B1: BSF 20.3 |
01B2: MOVF 20,W |
01B3: BSF 03.5 |
01B4: MOVWF 07 |
01B5: BCF 03.5 |
01B6: BTFSS 07.3 |
01B7: GOTO 1B6 |
01B8: NOP |
01B9: GOTO 1BA |
01BA: NOP |
01BB: BSF 20.4 |
01BC: MOVF 20,W |
01BD: BSF 03.5 |
01BE: MOVWF 07 |
01BF: NOP |
.................... |
.................... signed int16 mag_readZ(void) //nacteni osy x |
.................... { |
.................... unsigned int8 h,l; |
.................... signed int16 x; |
.................... h=mag_read(0x05); |
027D: MOVLW 05 |
027E: MOVWF 2B |
027F: CALL 199 |
0280: MOVF 78,W |
0281: MOVWF 27 |
.................... l=mag_read(0x06); |
0282: MOVLW 06 |
0283: MOVWF 2B |
0284: CALL 199 |
0285: MOVF 78,W |
0286: MOVWF 28 |
.................... x=mag_vypocet(h,l); |
0287: MOVF 27,W |
0288: MOVWF 2B |
0289: MOVF 28,W |
028A: MOVWF 2C |
028B: CALL 234 |
028C: MOVF 79,W |
028D: MOVWF 2A |
028E: MOVF 78,W |
028F: MOVWF 29 |
.................... return x; |
0290: MOVF 29,W |
0291: MOVWF 78 |
0292: MOVF 2A,W |
0293: MOVWF 79 |
.................... |
.................... // Combine high and low bytes into 16-bit values. |
.................... compass.x = make16(x_msb, x_lsb); |
01C0: BCF 03.5 |
01C1: MOVF 2D,W |
01C2: MOVWF 22 |
01C3: MOVF 2C,W |
01C4: MOVWF 21 |
.................... compass.y = make16(y_msb, y_lsb); |
01C5: MOVF 2F,W |
01C6: MOVWF 24 |
01C7: MOVF 2E,W |
01C8: MOVWF 23 |
.................... compass.z = make16(z_msb, z_lsb); |
01C9: MOVF 31,W |
01CA: MOVWF 26 |
01CB: MOVF 30,W |
01CC: MOVWF 25 |
.................... } |
0294: BCF 0A.3 |
0295: BCF 0A.4 |
0296: GOTO 39F (RETURN) |
01CD: BCF 0A.3 |
01CE: BCF 0A.4 |
01CF: GOTO 2EE (RETURN) |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... |
.................... void main() |
.................... { |
* |
0317: CLRF 04 |
0318: BCF 03.7 |
0319: MOVLW 1F |
031A: ANDWF 03,F |
031B: MOVLW 71 |
031C: BSF 03.5 |
031D: MOVWF 0F |
031E: MOVF 0F,W |
031F: BCF 03.5 |
0320: BCF 20.7 |
0321: MOVF 20,W |
0322: BSF 03.5 |
0323: MOVWF 07 |
0324: BCF 03.5 |
0325: BSF 07.7 |
0326: BSF 03.5 |
0327: BSF 03.6 |
0328: MOVF 09,W |
0329: ANDLW C0 |
032A: MOVWF 09 |
032B: BCF 03.6 |
032C: BCF 1F.4 |
032D: BCF 1F.5 |
032E: MOVLW 00 |
032F: BSF 03.6 |
0330: MOVWF 08 |
0331: BCF 03.5 |
0332: CLRF 07 |
0333: CLRF 08 |
0334: CLRF 09 |
.................... signed int16 X,Y,Z; |
0250: CLRF 04 |
0251: BCF 03.7 |
0252: MOVLW 1F |
0253: ANDWF 03,F |
0254: MOVLW 71 |
0255: BSF 03.5 |
0256: MOVWF 0F |
0257: MOVF 0F,W |
0258: BCF 03.5 |
0259: BCF 20.7 |
025A: MOVF 20,W |
025B: BSF 03.5 |
025C: MOVWF 07 |
025D: BCF 03.5 |
025E: BSF 07.7 |
025F: BSF 03.5 |
0260: BSF 03.6 |
0261: MOVF 09,W |
0262: ANDLW C0 |
0263: MOVWF 09 |
0264: BCF 03.6 |
0265: BCF 1F.4 |
0266: BCF 1F.5 |
0267: MOVLW 00 |
0268: BSF 03.6 |
0269: MOVWF 08 |
026A: BCF 03.5 |
026B: CLRF 07 |
026C: CLRF 08 |
026D: CLRF 09 |
* |
0277: CLRF 29 |
0278: CLRF 28 |
.................... int1 last; |
.................... unsigned int16 anemo_round=0; |
.................... unsigned int16 i; |
.................... |
.................... |
.................... //signed int16 X,Y,Z; |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
* |
0338: BSF 03.5 |
0339: BSF 03.6 |
033A: MOVF 09,W |
033B: ANDLW C0 |
033C: MOVWF 09 |
033D: BCF 03.6 |
033E: BCF 1F.4 |
033F: BCF 1F.5 |
0340: MOVLW 00 |
0341: BSF 03.6 |
0342: MOVWF 08 |
0279: BSF 03.5 |
027A: BSF 03.6 |
027B: MOVF 09,W |
027C: ANDLW C0 |
027D: MOVWF 09 |
027E: BCF 03.6 |
027F: BCF 1F.4 |
0280: BCF 1F.5 |
0281: MOVLW 00 |
0282: BSF 03.6 |
0283: MOVWF 08 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
0343: BCF 03.5 |
0344: BCF 03.6 |
0345: BCF 1F.6 |
0346: BCF 1F.7 |
0347: BSF 03.5 |
0348: BCF 1F.7 |
0349: BCF 03.5 |
034A: BSF 1F.0 |
0284: BCF 03.5 |
0285: BCF 03.6 |
0286: BCF 1F.6 |
0287: BCF 1F.7 |
0288: BSF 03.5 |
0289: BCF 1F.7 |
028A: BCF 03.5 |
028B: BSF 1F.0 |
.................... setup_spi(SPI_SS_DISABLED); |
034B: BCF 14.5 |
034C: BCF 20.5 |
034D: MOVF 20,W |
034E: BSF 03.5 |
034F: MOVWF 07 |
0350: BCF 03.5 |
0351: BSF 20.4 |
0352: MOVF 20,W |
0353: BSF 03.5 |
0354: MOVWF 07 |
0355: BCF 03.5 |
0356: BCF 20.3 |
0357: MOVF 20,W |
0358: BSF 03.5 |
0359: MOVWF 07 |
035A: MOVLW 01 |
035B: BCF 03.5 |
035C: MOVWF 14 |
035D: MOVLW 00 |
035E: BSF 03.5 |
035F: MOVWF 14 |
028C: BCF 14.5 |
028D: BCF 20.5 |
028E: MOVF 20,W |
028F: BSF 03.5 |
0290: MOVWF 07 |
0291: BCF 03.5 |
0292: BSF 20.4 |
0293: MOVF 20,W |
0294: BSF 03.5 |
0295: MOVWF 07 |
0296: BCF 03.5 |
0297: BCF 20.3 |
0298: MOVF 20,W |
0299: BSF 03.5 |
029A: MOVWF 07 |
029B: MOVLW 01 |
029C: BCF 03.5 |
029D: MOVWF 14 |
029E: MOVLW 00 |
029F: BSF 03.5 |
02A0: MOVWF 14 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
0360: MOVF 01,W |
0361: ANDLW C7 |
0362: IORLW 08 |
0363: MOVWF 01 |
02A1: MOVF 01,W |
02A2: ANDLW C7 |
02A3: IORLW 08 |
02A4: MOVWF 01 |
.................... setup_timer_1(T1_DISABLED); |
0364: BCF 03.5 |
0365: CLRF 10 |
02A5: BCF 03.5 |
02A6: CLRF 10 |
.................... setup_timer_2(T2_DISABLED,0,1); |
0366: MOVLW 00 |
0367: MOVWF 78 |
0368: MOVWF 12 |
0369: MOVLW 00 |
036A: BSF 03.5 |
036B: MOVWF 12 |
02A7: MOVLW 00 |
02A8: MOVWF 78 |
02A9: MOVWF 12 |
02AA: MOVLW 00 |
02AB: BSF 03.5 |
02AC: MOVWF 12 |
.................... setup_ccp1(CCP_OFF); |
036C: BCF 03.5 |
036D: BSF 20.2 |
036E: MOVF 20,W |
036F: BSF 03.5 |
0370: MOVWF 07 |
0371: BCF 03.5 |
0372: CLRF 17 |
0373: BSF 03.5 |
0374: CLRF 1B |
0375: CLRF 1C |
0376: MOVLW 01 |
0377: MOVWF 1D |
02AD: BCF 03.5 |
02AE: BSF 20.2 |
02AF: MOVF 20,W |
02B0: BSF 03.5 |
02B1: MOVWF 07 |
02B2: BCF 03.5 |
02B3: CLRF 17 |
02B4: BSF 03.5 |
02B5: CLRF 1B |
02B6: CLRF 1C |
02B7: MOVLW 01 |
02B8: MOVWF 1D |
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
0378: BCF 03.5 |
0379: BSF 03.6 |
037A: CLRF 07 |
037B: CLRF 08 |
037C: CLRF 09 |
02B9: BCF 03.5 |
02BA: BSF 03.6 |
02BB: CLRF 07 |
02BC: CLRF 08 |
02BD: CLRF 09 |
.................... |
.................... set_mag(); |
037D: BCF 03.6 |
037E: GOTO 07D |
.................... // Init the HMC5883L. Set Mode register for |
.................... // continuous measurements. |
.................... hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range |
02BE: BCF 03.6 |
02BF: CLRF 2C |
02C0: MOVLW 18 |
02C1: MOVWF 2D |
02C2: CALL 069 |
.................... hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0xE0); // maximal range |
02C3: MOVLW 01 |
02C4: MOVWF 2C |
02C5: MOVLW E0 |
02C6: MOVWF 2D |
02C7: CALL 069 |
.................... hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00); |
02C8: MOVLW 02 |
02C9: MOVWF 2C |
02CA: CLRF 2D |
02CB: CALL 069 |
.................... |
.................... // Continuously read and display the x,y,z results. |
.................... // Wait at least 67 ms between reads, re the HMC5883L data sheet. |
.................... |
.................... |
.................... printf("Magnetometr: \r\n",); |
037F: MOVLW 04 |
0380: BSF 03.6 |
0381: MOVWF 0D |
0382: MOVLW 00 |
0383: MOVWF 0F |
0384: BCF 03.6 |
0385: CALL 153 |
02CC: MOVLW 04 |
02CD: BSF 03.6 |
02CE: MOVWF 0D |
02CF: MOVLW 00 |
02D0: MOVWF 0F |
02D1: BCF 03.6 |
02D2: CALL 0C6 |
.................... printf("(c)mlab JACHO 2013: \r\n",); |
0386: MOVLW 0D |
0387: BSF 03.6 |
0388: MOVWF 0D |
0389: MOVLW 00 |
038A: MOVWF 0F |
038B: BCF 03.6 |
038C: CALL 153 |
02D3: MOVLW 0D |
02D4: BSF 03.6 |
02D5: MOVWF 0D |
02D6: MOVLW 00 |
02D7: MOVWF 0F |
02D8: BCF 03.6 |
02D9: CALL 0C6 |
.................... printf("X, Y, Z \r\n",); |
038D: MOVLW 19 |
038E: BSF 03.6 |
038F: MOVWF 0D |
0390: MOVLW 00 |
0391: MOVWF 0F |
0392: BCF 03.6 |
0393: CALL 153 |
02DA: MOVLW 19 |
02DB: BSF 03.6 |
02DC: MOVWF 0D |
02DD: MOVLW 00 |
02DE: MOVWF 0F |
02DF: BCF 03.6 |
02E0: CALL 0C6 |
.................... |
.................... while(true) |
.................... /* while(true) |
.................... { |
.................... X = mag_readX(); |
0394: GOTO 249 |
0395: MOVF 79,W |
0396: MOVWF 22 |
0397: MOVF 78,W |
0398: MOVWF 21 |
.................... Y = mag_readY(); |
0399: GOTO 263 |
039A: MOVF 79,W |
039B: MOVWF 24 |
039C: MOVF 78,W |
039D: MOVWF 23 |
.................... Z = mag_readZ(); |
039E: GOTO 27D |
039F: MOVF 79,W |
03A0: MOVWF 26 |
03A1: MOVF 78,W |
03A2: MOVWF 25 |
.................... printf("%4Ld %4Ld %4Ld \r\n", X, Y, Z); |
03A3: MOVLW 02 |
03A4: MOVWF 04 |
03A5: MOVF 22,W |
03A6: MOVWF 28 |
03A7: MOVF 21,W |
03A8: MOVWF 27 |
03A9: CALL 297 |
03AA: MOVLW 20 |
03AB: MOVWF 30 |
03AC: CALL 12F |
03AD: MOVLW 02 |
03AE: MOVWF 04 |
03AF: MOVF 24,W |
03B0: MOVWF 28 |
03B1: MOVF 23,W |
03B2: MOVWF 27 |
03B3: CALL 297 |
03B4: MOVLW 20 |
03B5: MOVWF 30 |
03B6: CALL 12F |
03B7: MOVLW 02 |
03B8: MOVWF 04 |
03B9: MOVF 26,W |
03BA: MOVWF 28 |
03BB: MOVF 25,W |
03BC: MOVWF 27 |
03BD: CALL 297 |
03BE: MOVLW 20 |
03BF: MOVWF 30 |
03C0: CALL 12F |
03C1: MOVLW 0D |
03C2: MOVWF 30 |
03C3: CALL 12F |
03C4: MOVLW 0A |
03C5: MOVWF 30 |
03C6: CALL 12F |
.................... Delay_ms(50); |
03C7: MOVLW 32 |
03C8: MOVWF 27 |
03C9: CALL 069 |
.................... |
.................... } |
03CA: GOTO 394 |
.................... */ |
.................... |
.................... while(TRUE) |
.................... { |
.................... |
.................... for( i=0;i<=1000;i++) |
02E1: CLRF 2B |
02E2: CLRF 2A |
02E3: MOVF 2B,W |
02E4: SUBLW 03 |
02E5: BTFSS 03.0 |
02E6: GOTO 303 |
02E7: BTFSS 03.2 |
02E8: GOTO 2ED |
02E9: MOVF 2A,W |
02EA: SUBLW E8 |
02EB: BTFSS 03.0 |
02EC: GOTO 303 |
.................... { |
.................... // delay_ms(); |
.................... hmc5883l_read_data(); |
02ED: GOTO 151 |
.................... |
.................... if(compass.x < 0) |
02EE: BTFSS 22.7 |
02EF: GOTO 2F6 |
.................... { |
.................... if(last == 1) anemo_round++; |
02F0: BTFSS 27.0 |
02F1: GOTO 2F5 |
02F2: INCF 28,F |
02F3: BTFSC 03.2 |
02F4: INCF 29,F |
.................... last=0; |
02F5: BCF 27.0 |
.................... } |
03CB: SLEEP |
.................... if(compass.x > 0) last=1; |
02F6: BTFSC 22.7 |
02F7: GOTO 2FF |
02F8: MOVF 22,F |
02F9: BTFSS 03.2 |
02FA: GOTO 2FE |
02FB: MOVF 21,W |
02FC: SUBLW 00 |
02FD: BTFSS 03.0 |
02FE: BSF 27.0 |
.................... } |
02FF: INCF 2A,F |
0300: BTFSC 03.2 |
0301: INCF 2B,F |
0302: GOTO 2E3 |
.................... |
.................... printf("%6Ld %6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z, anemo_round); |
0303: MOVLW 00 |
0304: MOVWF 04 |
0305: MOVF 22,W |
0306: MOVWF 2D |
0307: MOVF 21,W |
0308: MOVWF 2C |
0309: CALL 1D0 |
030A: MOVLW 20 |
030B: MOVWF 35 |
030C: CALL 0A2 |
030D: MOVLW 00 |
030E: MOVWF 04 |
030F: MOVF 24,W |
0310: MOVWF 2D |
0311: MOVF 23,W |
0312: MOVWF 2C |
0313: CALL 1D0 |
0314: MOVLW 20 |
0315: MOVWF 35 |
0316: CALL 0A2 |
0317: MOVLW 00 |
0318: MOVWF 04 |
0319: MOVF 26,W |
031A: MOVWF 2D |
031B: MOVF 25,W |
031C: MOVWF 2C |
031D: CALL 1D0 |
031E: MOVLW 20 |
031F: MOVWF 35 |
0320: CALL 0A2 |
0321: MOVLW 00 |
0322: MOVWF 04 |
0323: MOVF 29,W |
0324: MOVWF 2D |
0325: MOVF 28,W |
0326: MOVWF 2C |
0327: CALL 1D0 |
0328: MOVLW 20 |
0329: MOVWF 35 |
032A: CALL 0A2 |
032B: MOVLW 0A |
032C: MOVWF 35 |
032D: CALL 0A2 |
032E: MOVLW 0D |
032F: MOVWF 35 |
0330: CALL 0A2 |
.................... anemo_round=0; |
0331: CLRF 29 |
0332: CLRF 28 |
.................... } |
0333: GOTO 2E1 |
.................... |
.................... } |
.................... |
.................... |
.................... |
0334: SLEEP |
Configuration Fuses: |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.sta |
---|
1,60 → 1,55 |
ROM used: 972 (12%) |
972 (12%) including unused fragments |
ROM used: 821 (10%) |
821 (10%) including unused fragments |
2 Average locations per line |
1 Average locations per line |
15 Average locations per statement |
RAM used: 12 (3%) at main() level |
22 (6%) worst case |
RAM used: 18 (5%) at main() level |
27 (7%) worst case |
Stack used: 3 worst case (out of 8 total available) |
Stack used: 2 worst case (out of 8 total available) |
Lines Stmts % Files |
----- ----- --- ----- |
32 19 29 main.c |
70 28 50 main.c |
22 0 0 main.h |
423 0 0 C:\Program Files (x86)\PICC\devices\16F887.h |
19 0 0 HMC5883L.h |
102 46 71 HMC5883L.c |
86 28 50 HMC5883L.c |
----- ----- |
598 65 Total |
620 56 Total |
Page ROM % RAM Vol Diff Functions: |
---- --- --- --- --- ---- ---------- |
0 20 2 1 @delay_ms1 |
Inline 3 357 1.4 @I2C_READ_1 |
0 74 8 1 113 1.3 @I2C_WRITE_1 |
0 69 8 3 357 1.4 @I2C_READ_1 |
0 74 9 1 113 1.3 @I2C_WRITE_1 |
0 36 4 1 152 2.2 @PUTCHAR_1_ |
0 178 18 0 357 1.4 set_mag |
0 155 16 1 152 2.2 mag_read |
0 21 2 6 129 4.6 mag_vypocet |
0 26 3 4 171 2.7 mag_readX |
0 26 3 4 171 2.7 mag_readY |
0 26 3 4 171 2.7 mag_readZ |
0 181 19 6 587 3.3 MAIN |
0 9 1 0 @const102 |
0 70 7 3 @PSTRINGC7_69 |
0 12 1 0 @const104 |
0 6 1 0 @const105 |
0 128 13 9 @PRINTF_LD_69 |
0 57 7 2 102 1.8 hmc5883l_write_reg |
0 127 15 6 627 3.5 hmc5883l_read_data |
0 229 28 6 1048 7.4 MAIN |
0 9 1 0 171 2.7 @const100 |
0 70 9 3 171 2.7 @PSTRINGC7_69 |
0 12 1 0 171 2.7 @const102 |
0 6 1 0 587 3.3 @const103 |
0 128 16 9 @PRINTF_LD_69 |
Program metrics: |
Functions 10 |
Statements 65 |
Comments 99 |
Volume (V) 3874 |
Difficilty (D) 23.6 |
Effort to implement (E) 91333 |
Time to implement (T) 1 hours, 25 minutes |
Statements 56 |
Comments 119 |
Volume (V) 5424 |
Difficilty (D) 29.5 |
Effort to implement (E) 160169 |
Time to implement (T) 2 hours, 28 minutes |
Est Delivered Bugs (B) 1 |
Cyclomatic Complexity 1 |
Maintainability (MI) 60 |
Cyclomatic Complexity 4 |
Maintainability (MI) 70 |
Segment Used Free |
----------- ---- ---- |
00000-00003 4 0 |
00004-007FF 968 1076 |
00004-007FF 817 1227 |
00800-00FFF 0 2048 |
01000-017FF 0 2048 |
01800-01FFF 0 2048 |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.sym |
---|
1,5 → 1,5 |
004 @WRITE_PROGRAM_MEMORY8.P1 |
004-005 @READ_PROGRAM_MEMORY8.P2 |
004-005 @READ_PROGRAM_MEMORY8.P1 |
004 @WRITE_PROGRAM_MEMORY8.P2 |
015 CCP_1_LOW |
015 CCP_1 |
016 CCP_1_HIGH |
7,41 → 7,35 |
01B CCP_2 |
01C CCP_2_HIGH |
020 @TRIS_C |
021-022 MAIN.x |
023-024 MAIN.Y |
025-026 MAIN.Z |
027 @delay_ms1.P1 |
027 mag_readX.h |
027-028 @PRINTF_LD_69.P1 |
027 mag_readY.h |
027 mag_readZ.h |
027 @PSTRINGC7_69.@SCRATCH1 |
028 mag_readX.l |
028 mag_readY.l |
028 mag_readZ.l |
028 @PSTRINGC7_69.@SCRATCH2 |
029-02A mag_readX.x |
029-02A mag_readY.x |
029-02A mag_readZ.x |
029 @PSTRINGC7_69.@SCRATCH3 |
029 @PRINTF_LD_69.@SCRATCH1 |
02A @PRINTF_LD_69.@SCRATCH2 |
02B mag_vypocet.h |
02B mag_read.reg |
02B @PRINTF_LD_69.@SCRATCH3 |
02C mag_vypocet.l |
02C @I2C_WRITE_1.P1 |
02C @I2C_READ_1.P2 |
02C @PRINTF_LD_69.@SCRATCH4 |
02D-02E mag_vypocet.x |
02D @I2C_READ_1.@SCRATCH1 |
02D @PRINTF_LD_69.@SCRATCH5 |
02E @I2C_READ_1.@SCRATCH2 |
02E @PRINTF_LD_69.@SCRATCH6 |
02F mag_vypocet.@SCRATCH1 |
02F @PRINTF_LD_69.@SCRATCH7 |
030 @PUTCHAR_1_.P1 |
030 mag_vypocet.@SCRATCH2 |
021-026 compass |
027.0 MAIN.last |
028-029 MAIN.anemo_round |
02A-02B MAIN.i |
02C-02D @PRINTF_LD_69.P1 |
02C hmc5883l_write_reg.reg |
02C hmc5883l_read_data.x_lsb |
02C MAIN.@SCRATCH1 |
02C @PSTRINGC7_69.@SCRATCH1 |
02D hmc5883l_write_reg.data |
02D hmc5883l_read_data.x_msb |
02D @PSTRINGC7_69.@SCRATCH2 |
02E hmc5883l_read_data.y_lsb |
02E @PSTRINGC7_69.@SCRATCH3 |
02E @PRINTF_LD_69.@SCRATCH1 |
02F hmc5883l_read_data.y_msb |
02F @PRINTF_LD_69.@SCRATCH2 |
030 hmc5883l_read_data.z_lsb |
030 @PRINTF_LD_69.@SCRATCH3 |
031 hmc5883l_read_data.z_msb |
031 @PRINTF_LD_69.@SCRATCH4 |
032 @I2C_WRITE_1.P1 |
032 @I2C_READ_1.P2 |
032 @PRINTF_LD_69.@SCRATCH5 |
033 @I2C_READ_1.@SCRATCH1 |
033 @PRINTF_LD_69.@SCRATCH6 |
034 @I2C_READ_1.@SCRATCH2 |
034 @PRINTF_LD_69.@SCRATCH7 |
035 @PUTCHAR_1_.P1 |
077 @SCRATCH |
078 @SCRATCH |
078 _RETURN_ |
49,27 → 43,22 |
07A @SCRATCH |
107.6 C1OUT |
108.6 C2OUT |
10D-10E @READ_PROGRAM_MEMORY8.P1 |
10D-10E @WRITE_PROGRAM_MEMORY8.P2 |
10D-10E @WRITE_PROGRAM_MEMORY8.P1 |
10D-10E @READ_PROGRAM_MEMORY8.P2 |
ROM Allocation: |
0069 @delay_ms1 |
01EB @I2C_READ_1 |
010C @I2C_READ_1 |
001F @I2C_WRITE_1 |
012F @PUTCHAR_1_ |
007D set_mag |
0199 mag_read |
0234 mag_vypocet |
0249 mag_readX |
0263 mag_readY |
027D mag_readZ |
0317 MAIN |
0004 @const102 |
0153 @PSTRINGC7_69 |
000D @const104 |
0019 @const105 |
0297 @PRINTF_LD_69 |
0317 @cinit |
00A2 @PUTCHAR_1_ |
0069 hmc5883l_write_reg |
0151 hmc5883l_read_data |
0250 MAIN |
0004 @const100 |
00C6 @PSTRINGC7_69 |
000D @const102 |
0019 @const103 |
01D0 @PRINTF_LD_69 |
0250 @cinit |
User Memory space: |
/Modules/Sensors/MAG01A/SW/PIC16F887/main.tre |
---|
1,19 → 1,18 |
ÀÄmain |
ÀÄMAIN 0/181 Ram=6 |
ÀÄMAIN 0/229 Ram=6 |
ÃÄ??0?? |
ÃÄset_mag 0/178 Ram=0 |
ÃÄhmc5883l_write_reg 0/57 Ram=2 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÀÄ@I2C_WRITE_1 0/74 Ram=1 |
ÃÄhmc5883l_write_reg 0/57 Ram=2 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@delay_ms1 0/20 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÀÄ@I2C_WRITE_1 0/74 Ram=1 |
ÃÄhmc5883l_write_reg 0/57 Ram=2 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@delay_ms1 0/20 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÀÄ@delay_ms1 0/20 Ram=1 |
³ ÀÄ@I2C_WRITE_1 0/74 Ram=1 |
ÃÄ@PSTRINGC7_69 0/70 Ram=3 |
³ ÃÄ@PUTCHAR_1_ 0/36 Ram=1 |
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1 |
23,42 → 22,16 |
ÃÄ@PSTRINGC7_69 0/70 Ram=3 |
³ ÃÄ@PUTCHAR_1_ 0/36 Ram=1 |
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÃÄmag_readX 0/26 Ram=4 |
³ ÃÄmag_read 0/155 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÀÄ@I2C_READ_1 (Inline) Ram=3 |
³ ÃÄmag_read 0/155 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÀÄ@I2C_READ_1 (Inline) Ram=3 |
³ ÀÄmag_vypocet 0/21 Ram=6 |
ÃÄmag_readY 0/26 Ram=4 |
³ ÃÄmag_read 0/155 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÀÄ@I2C_READ_1 (Inline) Ram=3 |
³ ÃÄmag_read 0/155 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÀÄ@I2C_READ_1 (Inline) Ram=3 |
³ ÀÄmag_vypocet 0/21 Ram=6 |
ÃÄmag_readZ 0/26 Ram=4 |
³ ÃÄmag_read 0/155 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÀÄ@I2C_READ_1 (Inline) Ram=3 |
³ ÃÄmag_read 0/155 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ³ ÀÄ@I2C_READ_1 (Inline) Ram=3 |
³ ÀÄmag_vypocet 0/21 Ram=6 |
ÃÄhmc5883l_read_data 0/127 Ram=6 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1 |
³ ÃÄ@I2C_READ_1 0/69 Ram=3 |
³ ÃÄ@I2C_READ_1 0/69 Ram=3 |
³ ÃÄ@I2C_READ_1 0/69 Ram=3 |
³ ÃÄ@I2C_READ_1 0/69 Ram=3 |
³ ÃÄ@I2C_READ_1 0/69 Ram=3 |
³ ÀÄ@I2C_READ_1 0/69 Ram=3 |
ÃÄ@PRINTF_LD_69 0/128 Ram=9 |
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÃÄ@PUTCHAR_1_ 0/36 Ram=1 |
68,6 → 41,8 |
ÃÄ@PRINTF_LD_69 0/128 Ram=9 |
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÃÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÃÄ@PRINTF_LD_69 0/128 Ram=9 |
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÃÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÃÄ@PUTCHAR_1_ 0/36 Ram=1 |
ÀÄ@delay_ms1 0/20 Ram=1 |
ÀÄ@PUTCHAR_1_ 0/36 Ram=1 |