/Modules/Sensors/MAG01A/SW/PIC16F887/HMC5883L.c
1,13 → 1,3
// 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
//------------------------------
/Modules/Sensors/MAG01A/SW/PIC16F887/HMC5883L.h
1,6 → 1,12
#define MAG_ADDR_R 0x3D //addresa pro cteni
#define MAG_ADDR_W 0x3C
// 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
 
//Konstanty nastavujici rozsah
//pro void set_mag_roz (unsigned int8 h)
/Modules/Sensors/MAG01A/SW/PIC16F887/main.c
8,7 → 8,6
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);
19,6 → 18,11
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
 
printf("Magnetometr: \r\n",);
printf("(c)mlab JACHO 2013: \r\n",);
printf("X, Y, Z \r\n",);
 
 
// Init the HMC5883L. Set Mode register for
// continuous measurements.
hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range
29,40 → 33,12
// 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)
{
X = mag_readX();
Y = mag_readY();
Z = mag_readZ();
printf("%4Ld %4Ld %4Ld \r\n", X, Y, Z);
Delay_ms(50);
}
*/
 
while(TRUE)
{
 
// for(i=0;i<=10;i++)
// {
hmc5883l_read_data();
// b = atan2((float)compass.y,(float)compass.x); // vypocet azimutu z kartezskych souradnic
// b = (b/3.141596)*180; // prevod na stupne
// b += 180;
 
// anemo_speed += (b-last);
// last=b;
// delay_ms(10);
// }
// anemo_speed=anemo_speed/10;
 
printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z);
// delay_ms(100);
hmc5883l_read_data();
printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z);
delay_ms(100);
}
 
}
/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
3,5 → 3,5
>>> Warning 202 "main.c" Line 7(14,25): Variable never used: anemo_speed
>>> Warning 202 "main.c" Line 8(16,27): Variable never used: anemo_round
>>> Warning 202 "main.c" Line 9(16,17): Variable never used: i
Memory usage: ROM=9% RAM=8% - 10%
Memory usage: ROM=10% RAM=8% - 10%
0 Errors, 5 Warnings.
/Modules/Sensors/MAG01A/SW/PIC16F887/main.esym
1,8 → 1,7
C L "MAIN" 0 20 1 "FUNCTION"
D G "__PCM__" 0 73 ""4.106""
D G "__DEVICE__" 0 73 "887"
D G "__DATE__" 0 73 ""15-V-13""
D G "__TIME__" 0 73 ""20:34:15"" "Standard Header file for the PIC16F887 device ////////////////"
D G "__PCM__" 0 0 ""4.106""
D G "__DEVICE__" 0 0 ""
D G "__DATE__" 0 0 ""17-V-13""
D G "__TIME__" 0 0 ""12:14:46"" "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"
274,46 → 273,44
d G "INT_RB5" 2 418 "0x0200B08"
d G "INT_RB6" 2 419 "0x0400B08"
d G "INT_RB7" 2 420 "0x0800B08"
D G "MAG_ADDR_R" 3 1 "0x3D" "addresa pro cteni"
D G "MAG_ADDR_W" 3 2 "0x3C"
D G "MAG_ROZ088" 3 7 "0x00"
D G "MAG_ROZ130" 3 8 "0x20"
D G "MAG_ROZ190" 3 9 "0x40"
D G "MAG_ROZ250" 3 10 "0x60"
D G "MAG_ROZ400" 3 11 "0x80"
D G "MAG_ROZ470" 3 12 "0xA0"
D G "MAG_ROZ560" 3 13 "0xC0"
D G "MAG_ROZ810" 3 14 "0xE0"
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)"
D G "HMC5883L_WRT_ADDR" 3 2 "0x3C"
D G "HMC5883L_READ_ADDR" 3 3 "0x3D"
D G "HMC5883L_CFG_A_REG" 3 6 "0x00"
D G "HMC5883L_CFG_B_REG" 3 7 "0x01"
D G "HMC5883L_MODE_REG" 3 8 "0x02"
D G "HMC5883L_X_MSB_REG" 3 9 "0x03"
D G "MAG_ROZ088" 3 13 "0x00"
D G "MAG_ROZ130" 3 14 "0x20"
D G "MAG_ROZ190" 3 15 "0x40"
D G "MAG_ROZ250" 3 16 "0x60"
D G "MAG_ROZ400" 3 17 "0x80"
D G "MAG_ROZ470" 3 18 "0xA0"
D G "MAG_ROZ560" 3 19 "0xC0"
D G "MAG_ROZ810" 3 20 "0xE0"
C L "hmc5883l_write_reg" 4 2 1 "FUNCTION"
F G "hmc5883l_write_reg" 4 4 "void()"
V L "reg" 4 4 "int8"
V L "data" 4 4 "int8"
F G "hmc5883l_read_reg" 4 14 "int8()"
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"
V L "retval" 4 16 "int8"
T G "hmc5883l_result" 4 35 "{sint16 x,sint16 y,sint16 z}" "This global structure holds the values read"
V G "compass" 4 39 "hmc5883l_result"
F G "hmc5883l_read_data" 4 42 "void()"
V L "x_lsb" 4 44 "int8"
V L "x_msb" 4 45 "int8"
V L "y_lsb" 4 47 "int8"
V L "y_msb" 4 48 "int8"
V L "z_lsb" 4 50 "int8"
V L "z_msb" 4 51 "int8"
C L "hmc5883l_read_data" 4 2 1 "FUNCTION"
C L "hmc5883l_read_data" 4 2 1 "FUNCTION"
C L "hmc5883l_read_data" 4 2 1 "FUNCTION"
D G "MATH_H" 5 21 ""
D G "PI" 5 26 "3.1415926535897932"
D G "SQRT2" 5 29 "1.4142135623730950"
C L "CEIL_FLOOR" 5 2 3 "FUNCTION"
F G "CEIL_FLOOR" 5 36 "float(float x,int8 n)"
F G "CEIL_FLOOR" 5 36 "float()"
V L "x" 5 36 "float"
V L "n" 5 36 "int8"
V L "y" 5 38 "float"
321,20 → 318,20
V L "l" 5 39 "int16"
V L "s" 5 40 "int1"
C L "floor" 5 2 5 "FUNCTION"
F G "floor" 5 192 "float(float x)"
F G "floor" 5 192 "float()"
V L "x" 5 192 "float"
C L "ceil" 5 2 5 "FUNCTION"
F G "ceil" 5 218 "float(float x)"
F G "ceil" 5 218 "float()"
V L "x" 5 218 "float"
D G "fabs" 5 244 "abs"
C L "fmod" 5 2 6 "FUNCTION"
F G "fmod" 5 256 "float(float x,float y)"
F G "fmod" 5 256 "float()"
V L "x" 5 256 "float"
V L "y" 5 256 "float"
V L "i" 5 258 "float"
D G "LN2" 5 319 "0.6931471805599453"
V G "pe" 5 321 "float[6]"
F G "exp" 5 325 "float(float x)"
F G "exp" 5 325 "float()"
V L "x" 5 325 "float"
V L "y" 5 327 "float"
V L "res" 5 327 "float"
345,7 → 342,7
V G "pl" 5 496 "float[4]"
V G "ql" 5 497 "float[4]"
C L "log" 5 2 3 "FUNCTION"
F G "log" 5 505 "float(float x)"
F G "log" 5 505 "float()"
V L "x" 5 505 "float"
V L "y" 5 507 "float"
V L "res" 5 507 "float"
355,23 → 352,23
C L "log" 5 2 1 "FUNCTION"
D G "LN10" 5 729 "2.3025850929940456"
C L "log10" 5 2 3 "FUNCTION"
F G "log10" 5 737 "float(float x)"
F G "log10" 5 737 "float()"
V L "x" 5 737 "float"
V L "r" 5 739 "float"
C L "modf" 5 2 8 "FUNCTION"
F G "modf" 5 778 "float(float value,*float iptr)"
F G "modf" 5 778 "float()"
V L "value" 5 778 "float"
V L "iptr" 5 778 "*float"
C L "pwr" 5 2 6 "FUNCTION"
F G "pwr" 5 806 "float(float x,float y)"
F G "pwr" 5 806 "float()"
V L "x" 5 806 "float"
V L "y" 5 806 "float"
C L "pow" 5 2 7 "FUNCTION"
F G "pow" 5 869 "float(float x,float y)"
F G "pow" 5 869 "float()"
V L "x" 5 869 "float"
V L "y" 5 869 "float"
C L "sqrt" 5 2 5 "FUNCTION"
F G "sqrt" 5 930 "float(float x)"
F G "sqrt" 5 930 "float()"
V L "x" 5 930 "float"
V L "y" 5 932 "float"
V L "res" 5 932 "float"
378,7 → 375,7
V L "p" 5 936 "*int8"
D G "PI_DIV_BY_TWO" 5 1125 "1.5707963267948966"
C L "cos" 5 2 3 "FUNCTION"
F G "cos" 5 1136 "float(float x)"
F G "cos" 5 1136 "float()"
V L "x" 5 1136 "float"
V L "y" 5 1138 "float"
V L "t" 5 1138 "float"
396,16 → 393,16
C L "cos" 5 2 1 "FUNCTION"
C L "cos" 5 2 1 "FUNCTION"
C L "sin" 5 2 5 "FUNCTION"
F G "sin" 5 1278 "float(float x)"
F G "sin" 5 1278 "float()"
V L "x" 5 1278 "float"
C L "tan" 5 2 5 "FUNCTION"
F G "tan" 5 1304 "float(float x)"
F G "tan" 5 1304 "float()"
V L "x" 5 1304 "float"
V L "c" 5 1306 "float"
V L "s" 5 1306 "float"
V G "pas" 5 1344 "float[3]"
V G "qas" 5 1345 "float[3]"
F G "ASIN_COS" 5 1347 "float(float x,int8 n)"
F G "ASIN_COS" 5 1347 "float()"
V L "x" 5 1347 "float"
V L "n" 5 1347 "int8"
V L "y" 5 1349 "float"
416,17 → 413,17
C L "ASIN_COS" 5 2 1 "FUNCTION"
C L "ASIN_COS" 5 2 1 "FUNCTION"
C L "asin" 5 2 5 "FUNCTION"
F G "asin" 5 1493 "float(float x)"
F G "asin" 5 1493 "float()"
V L "x" 5 1493 "float"
V L "r" 5 1495 "float"
C L "acos" 5 2 5 "FUNCTION"
F G "acos" 5 1527 "float(float x)"
F G "acos" 5 1527 "float()"
V L "x" 5 1527 "float"
V L "r" 5 1529 "float"
V G "pat" 5 1555 "float[4]"
V G "qat" 5 1556 "float[4]"
C L "atan" 5 2 3 "FUNCTION"
F G "atan" 5 1564 "float(float x)"
F G "atan" 5 1564 "float()"
V L "x" 5 1564 "float"
V L "y" 5 1566 "float"
V L "res" 5 1566 "float"
435,7 → 432,7
V L "flag" 5 1567 "int1"
C L "atan" 5 2 1 "FUNCTION"
C L "atan2" 5 2 7 "FUNCTION"
F G "atan2" 5 1697 "float(float y,float x)"
F G "atan2" 5 1697 "float()"
V L "y" 5 1697 "float"
V L "x" 5 1697 "float"
V L "z" 5 1699 "float"
444,22 → 441,22
C L "atan2" 5 2 1 "FUNCTION"
C L "atan2" 5 2 1 "FUNCTION"
C L "cosh" 5 2 7 "FUNCTION"
F G "cosh" 5 1919 "float(float x)"
F G "cosh" 5 1919 "float()"
V L "x" 5 1919 "float"
C L "sinh" 5 2 6 "FUNCTION"
F G "sinh" 5 1946 "float(float x)"
F G "sinh" 5 1946 "float()"
V L "x" 5 1946 "float"
C L "tanh" 5 2 6 "FUNCTION"
F G "tanh" 5 1976 "float(float x)"
F G "tanh" 5 1976 "float()"
V L "x" 5 1976 "float"
D G "LOG2" 5 2006 ".30102999566398119521"
F G "frexp" 5 2007 "float(float x,*sint8 exp)"
F G "frexp" 5 2007 "float()"
V L "x" 5 2007 "float"
V L "exp" 5 2007 "*sint8"
V L "res" 5 2009 "float"
V L "sign" 5 2010 "int1"
C L "ldexp" 5 2 6 "FUNCTION"
F G "ldexp" 5 2152 "float(float value,sint8 exp)"
F G "ldexp" 5 2152 "float()"
V L "value" 5 2152 "float"
V L "exp" 5 2152 "sint8"
C L "MAIN" 5 2 2 "FUNCTION"
469,13 → 466,11
V L "anemo_speed" 0 7 "float"
V L "anemo_round" 0 8 "int16"
V L "i" 0 9 "int16" "signed int16 X,Y,Z;"
C L "MAIN" 0 20 3 "FUNCTION"
C L "MAIN" 0 20 1 "FUNCTION"
C L "MAIN" 0 20 1 "FUNCTION"
C L "MAIN" 0 20 2 "FUNCTION"
C L "MAIN" 0 20 6 "FUNCTION"
C L "MAIN" 0 20 1 "FUNCTION"
C L "MAIN" 0 20 7 "FUNCTION"
C L "MAIN" 0 19 1 "FUNCTION"
C L "MAIN" 0 19 2 "FUNCTION"
C L "MAIN" 0 19 1 "FUNCTION"
C L "MAIN" 0 19 1 "FUNCTION"
C L "MAIN" 0 19 2 "FUNCTION"
F B "reset_cpu" 0 0
F B "abs" 1 0
F B "sleep_ulpwu" 1 0
/Modules/Sensors/MAG01A/SW/PIC16F887/main.h
16,6 → 16,6
#FUSES BORV40 //Brownout reset at 4.0V
 
#use delay(clock=8000000)
#use i2c(master, sda=PIN_C4, scl=PIN_C3)
#use rs232(baud=115200,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
#use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3)
#use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
 
/Modules/Sensors/MAG01A/SW/PIC16F887/main.hex
1,101 → 1,104
:1000000002308A004F2A0000CD306737653AEF365C
:1000000002308A00662A0000CD306737653AEF3645
:10001000653A721D20100D050000A831A936EC309C
:100020006210CA2043244F103218B1193A10A006AA
:100030000A005816A02C2C105A100D05000108308B
:10004000F80000008711A011200883168700000027
:100050008312BD0D0712031C3328201620088316B7
:10006000870037288312201220088316870000009B
:100070008312A0152008831687008312871D3E284F
:10008000F80B212800008711A01120088316870093
:10009000000083122016200883168700000000004D
:1000A0008312A0152008831687008312871D562807
:1000B000F8010000071A78148711A0112008831690
:1000C00087008312071220122008831687008312EC
:1000D0000800201620088316870000008312A01550
:1000E00020088316870000008312071220122008C0
:1000F00083168700000083128711A0112008831641
:1001000087003C308312BD001F203708BD001F2030
:100110003808BD001F202012200883168700000029
:100120008312A0152008831687008312871D962846
:1001300000009A280000201620088316870000007F
:1001400083120800A01320088316870083128713E8
:100150000830F800AB280000F817C028F813400852
:10016000F900F90C03188717031C87137817C028A8
:100170007813F80BB1287908C000BE280000871753
:10018000F81BAE28781BB8280800831603178C17B5
:100190000C140000000083120C087F390319092990
:1001A0000313B70003170D080313B80003170F0854
:1001B0000313B9003708C000A220380803178D00C8
:1001C0000313390803178F0083168C170C140000D3
:1001D000000083120C0D0E0D7F390319092903133A
:1001E000B70003170D080313B80003170F08031314
:1001F000B9003708C000A220380803178D00031388
:10020000390803178F008D0A03198F0A0313C528B5
:100210000317031308000830BE007708BF0020163C
:1002200020088316870000008312A015200883167B
:1002300087008312871D1A29071A0314071E03104B
:10024000F80D0000A0112008831687008312871183
:10025000BE0B0F292016200883168700000083128A
:1002600007123F0803193929201220088316870036
:1002700083120000A0152008831687008312871DB3
:100280003F2900008711A011200883168700000075
:100290008312071220122008831687008312080099
:1002A000201620088316870000008312A01520085E
:1002B000831687000000831207122012200883167D
:1002C0008700000083128711A01120088316870081
:1002D0003C308312BD001F200330BD001F202016BC
:1002E00020088316870000008312A01520088316BB
:1002F000870000008312871D7B2907122012200827
:1003000083168700000083128711A011200883162E
:1003100087003D308312BD001F200130F7000B2104
:100320007808B8000130F7000B217808B7000130D9
:10033000F7000B217808BC000130F7000B2178088A
:10034000BB000130F7000B217808BA00F7010B2140
:100350007808B90020122008831687000000831255
:10036000A0152008831687008312871DB529000079
:10037000B929000020162008831687000000831288
:100380003808A2003708A1003A08A4003908A300E1
:100390003C08A6003B08A5008A110A12E12ABF0109
:1003A0000408BE003F10831B3F14B81FDF29BE178F
:1003B0003E1EBE0AB709B809B70A0319B80A380EB3
:1003C000F038BA00BA07E23EBB00323EBD00380842
:1003D0000F39BB07BB07BD07E93EBC00BC07BC0724
:1003E000370E0F39BC07BD07BC0DBD0DBD09BD0DD6
:1003F00037080F39BD07BA0D0730B9000A30BD07FD
:10040000BC03031CFF29BC07BB03031C032ABB0757
:10041000BA03031C072ABA07B903031C0B2A393095
:100420008400831307303E053E1384033E05031DFD
:10043000202A3E1A840A3E1A202A2030F7003D2A3C
:1004400084073D30040203193E170008F700031D1E
:10045000312A3E1B312A3E1A4B2ABE19312A20303E
:100460003C2ABE1F392A2D30F70084033E13BE13E9
:100470003D2ABE153E123030F707B8010408B70018
:100480003810831B38147708C000A2203708840076
:10049000831338188317840A3E1F212A0800840119
:1004A00083131F308305713083168F000F0883126A
:1004B000A01320088316870083128717831603175B
:1004C0000908C039890003131F129F120030031757
:1004D00088008312870188018901FF300313A0007F
:1004E000A101A201A301A401A501A601B401B301C8
:1004F000831603170908C039890003131F129F12BE
:10050000003003178800831203131F139F138316F1
:100510009F1383121F149412A012200883168700C1
:10052000831220162008831687008312A01120084A
:1005300083168700013083129400003083169400E4
:100540000108C73908388100831290010030F80093
:100550009200003083169200831220152008831623
:1005600087008312970183169B019C0101309D0037
:10057000831203178701880189010313B70118301B
:10058000B80069200130B700E030B80069200230BF
:10059000B700B8016920043003178D0000308F00C8
:1005A0000313C5200D3003178D0000308F00031397
:1005B000C520193003178D0000308F000313C520AC
:1005C0005029003084002208B8002108B700CF214C
:1005D0002030C000A220003084002408B800230886
:1005E000B700CF212030C000A220003084002608B0
:1005F000B8002508B700CF212030C000A2200A3063
:0E060000C000A2200D30C000A220E02A63003E
:100030000A005816A02C2C105A100D050001A01310
:10004000200883168700831287130830F8002828B9
:100050000000F8173928F813C00C03188717031C81
:100060008713781739287813F80B2C2837280000C5
:1000700087173F308400840B3B280000F81B2B2897
:10008000781B33280800831603178C170C14000004
:10009000000083120C087F39031987280313B70067
:1000A00003170D080313B80003170F080313B90053
:1000B0003708C0001F20380803178D0003133908C4
:1000C00003178F0083168C170C1400000000831296
:1000D0000C0D0E0D7F39031987280313B700031782
:1000E0000D080313B80003170F080313B9003708EE
:1000F000C0001F20380803178D00031339080317A9
:100100008F008D0A03198F0A031343280317031363
:1001100008000830F80000008711A011200883169D
:10012000870000008312BD0D0712031C9D282016B6
:10013000200883168700A128831220122008831626
:10014000870000008312A015200883168700831201
:10015000871DA828F80B8B2800008711A011200804
:10016000831687000000831220162008831687005C
:10017000000000008312A015200883168700831258
:10018000871DC028F8010000071A78148711A011F4
:100190002008831687008312071220122008831676
:1001A00087008312080020162008831687000000AD
:1001B0008312A015200883168700000083120712FF
:1001C0002012200883168700000083128711A011D7
:1001D0002008831687003C308312BD008920370831
:1001E000BD0089203808BD00892020122008831610
:1001F000870000008312A015200883168700831251
:10020000871D0029000004290000201620088316FD
:1002100087000000831208000830BE007708BF0086
:10022000201620088316870000008312A0152008DE
:10023000831687008312871D1B29071A0314071EC4
:100240000310F80D0000A011200883168700831208
:100250008711BE0B10292016200883168700000086
:10026000831207123F0803193A2920122008831627
:10027000870083120000A0152008831687008312D0
:10028000871D402900008711A011200883168700D0
:1002900000008312071220122008831687008312A1
:1002A0000800201620088316870000008312A0157E
:1002B00020088316870000008312071220122008EE
:1002C00083168700000083128711A011200883166F
:1002D00087003C308312BD0089200330BD00892097
:1002E000201620088316870000008312A01520081E
:1002F0008316870000008312871D7C2907122012B5
:10030000200883168700000083128711A01120089F
:10031000831687003D308312BD0089200130F7002D
:100320000C217808B8000130F7000C217808B700DC
:100330000130F7000C217808BC000130F7000C21D7
:100340007808BB000130F7000C217808BA00F701EB
:100350000C217808B90020122008831687000000BD
:100360008312A0152008831687008312871DB629E3
:100370000000BA290000201620088316870000001C
:1003800083123808A2003708A1003A08A4003908EF
:10039000A3003C08A6003B08A5008A110A12F62A11
:1003A000BF010408BE003F10831B3F14B81FE029A3
:1003B000BE173E1EBE0AB709B809B70A0319B80A24
:1003C000380EF038BA00BA07E23EBB00323EBD003C
:1003D00038080F39BB07BB07BD07E93EBC00BC07A7
:1003E000BC07370E0F39BC07BD07BC0DBD0DBD09DD
:1003F000BD0D37080F39BD07BA0D0730B9000A30F7
:10040000BD07BC03031C002ABC07BB03031C042A52
:10041000BB07BA03031C082ABA07B903031C0C2A3A
:1004200039308400831307303E053E1384033E05B4
:10043000031D212A3E1A840A3E1A212A2030F70081
:100440003E2A84073D30040203193E170008F700D6
:10045000031D322A3E1B322A3E1A4C2ABE19322A6A
:1004600020303D2ABE1F3A2A2D30F70084033E1368
:10047000BE133E2ABE153E123030F707B8010408FD
:10048000B7003810831B38147708C0001F203708C6
:100490008400831338188317840A3E1F222A080019
:1004A00037308400831300080319632A0230F800F0
:1004B000F701F70B592AF80B582A9730F700F70B7A
:1004C0005F2A800B562A8A110A121D2B840183137E
:1004D0001F308305713083168F000F088312A0131D
:1004E00020088316870083128717831603170908CD
:1004F000C039890003131F129F12003003178800B0
:100500008312870188018901FF300313A000A10134
:10051000A201A301A401A501A601B401B3018316A0
:1005200003170908C039890003131F129F120030F6
:1005300003178800831203131F139F1383169F133F
:1005400083121F149412A0122008831687008312AE
:1005500020162008831687008312A0112008831616
:100560008700013083129400003083169400010844
:10057000C73908388100831290010030F8009200DA
:1005800000308316920083122015200883168700FE
:100590008312970183169B019C0101309D008312F9
:1005A000031787018801890104308D0000308F0016
:1005B000031343200D3003178D0000308F00031309
:1005C0004320193003178D0000308F0003134320A0
:1005D000B7011830B800D3200130B700E030B800C0
:1005E000D3200230B700B801D32051290030840055
:1005F0002208B8002108B700D0212030C0001F20F9
:10060000003084002408B8002308B700D02120302F
:10061000C0001F20003084002608B8002508B7005D
:10062000D0212030C0001F200A30C0001F200D3014
:0E063000C0001F206430B700502AF52A630076
:04400E00F52CFF3F4F
:00000001FF
;PIC16F887
;CRC=32C6 CREATED="15-V-13 20:34"
;CRC=17FE CREATED="17-V-13 12:14"
/Modules/Sensors/MAG01A/SW/PIC16F887/main.lst
1,8 → 1,8
CCS PCM C Compiler, Version 4.106, 47914 15-V-13 20:34
CCS PCM C Compiler, Version 4.106, 47914 17-V-13 12:14
 
Filename: Z:\home\kaklik\svnMLAB\Modules\Sensors\MAG01A\SW\PIC16F887\main.lst
 
ROM used: 775 words (9%)
ROM used: 799 words (10%)
Largest free fragment is 2048
RAM used: 28 (8%) at main() level
38 (10%) worst case
11,7 → 11,7
*
0000: MOVLW 02
0001: MOVWF 0A
0002: GOTO 24F
0002: GOTO 266
0003: NOP
.................... #include "main.h"
.................... #include <16F887.h>
36,195 → 36,225
.................... #FUSES BORV40 //Brownout reset at 4.0V
....................
.................... #use delay(clock=8000000)
.................... #use i2c(master, sda=PIN_C4, scl=PIN_C3)
*
001F: MOVLW 08
0020: MOVWF 78
0021: NOP
0022: BCF 07.3
0023: BCF 20.3
0024: MOVF 20,W
0025: BSF 03.5
0026: MOVWF 07
0027: NOP
0028: BCF 03.5
0029: RLF 3D,F
002A: BCF 07.4
002B: BTFSS 03.0
002C: GOTO 033
002D: BSF 20.4
002E: MOVF 20,W
002F: BSF 03.5
0030: MOVWF 07
0031: GOTO 037
0032: BCF 03.5
0033: BCF 20.4
0034: MOVF 20,W
0035: BSF 03.5
0036: MOVWF 07
0037: NOP
0038: BCF 03.5
0039: BSF 20.3
003A: MOVF 20,W
003B: BSF 03.5
003C: MOVWF 07
003D: BCF 03.5
003E: BTFSS 07.3
003F: GOTO 03E
0040: DECFSZ 78,F
0041: GOTO 021
0042: NOP
0043: BCF 07.3
0044: BCF 20.3
0045: MOVF 20,W
0046: BSF 03.5
0047: MOVWF 07
0048: NOP
0049: BCF 03.5
004A: BSF 20.4
004B: MOVF 20,W
004C: BSF 03.5
004D: MOVWF 07
004E: NOP
004F: NOP
0050: BCF 03.5
0051: BSF 20.3
0052: MOVF 20,W
0053: BSF 03.5
0054: MOVWF 07
0055: BCF 03.5
0056: BTFSS 07.3
0057: GOTO 056
0058: CLRF 78
0059: NOP
005A: BTFSC 07.4
005B: BSF 78.0
005C: BCF 07.3
005D: BCF 20.3
005E: MOVF 20,W
005F: BSF 03.5
0060: MOVWF 07
0061: BCF 03.5
0062: BCF 07.4
0063: BCF 20.4
0064: MOVF 20,W
0065: BSF 03.5
0066: MOVWF 07
0067: BCF 03.5
0068: RETURN
0250: MOVLW 37
0251: MOVWF 04
0252: BCF 03.7
0253: MOVF 00,W
0254: BTFSC 03.2
0255: GOTO 263
0256: MOVLW 02
0257: MOVWF 78
0258: CLRF 77
0259: DECFSZ 77,F
025A: GOTO 259
025B: DECFSZ 78,F
025C: GOTO 258
025D: MOVLW 97
025E: MOVWF 77
025F: DECFSZ 77,F
0260: GOTO 25F
0261: DECFSZ 00,F
0262: GOTO 256
0263: BCF 0A.3
0264: BCF 0A.4
0265: GOTO 31D (RETURN)
.................... #use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3)
*
010B: MOVLW 08
010C: MOVWF 3E
010D: MOVF 77,W
010E: MOVWF 3F
010F: BSF 20.4
0110: MOVF 20,W
0111: BSF 03.5
0112: MOVWF 07
0113: NOP
0114: BCF 03.5
0115: BSF 20.3
0116: MOVF 20,W
0117: BSF 03.5
0118: MOVWF 07
0119: BCF 03.5
011A: BTFSS 07.3
011B: GOTO 11A
011C: BTFSC 07.4
011D: BSF 03.0
011E: BTFSS 07.4
011F: BCF 03.0
0120: RLF 78,F
0121: NOP
0122: BCF 20.3
0123: MOVF 20,W
0124: BSF 03.5
0125: MOVWF 07
0126: BCF 03.5
0127: BCF 07.3
0128: DECFSZ 3E,F
0129: GOTO 10F
012A: BSF 20.4
012B: MOVF 20,W
012C: BSF 03.5
012D: MOVWF 07
012E: NOP
012F: BCF 03.5
0130: BCF 07.4
0131: MOVF 3F,W
0132: BTFSC 03.2
0133: GOTO 139
0134: BCF 20.4
0135: MOVF 20,W
0136: BSF 03.5
0137: MOVWF 07
0138: BCF 03.5
0139: NOP
013A: BSF 20.3
013B: MOVF 20,W
013C: BSF 03.5
013D: MOVWF 07
013E: BCF 03.5
013F: BTFSS 07.3
0140: GOTO 13F
0141: NOP
0142: BCF 07.3
0143: BCF 20.3
0144: MOVF 20,W
0145: BSF 03.5
0146: MOVWF 07
0147: NOP
0148: BCF 03.5
0149: BCF 07.4
014A: BCF 20.4
014B: MOVF 20,W
014C: BSF 03.5
014D: MOVWF 07
014E: BCF 03.5
014F: RETURN
.................... #use rs232(baud=115200,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
0089: MOVLW 08
008A: MOVWF 78
008B: NOP
008C: BCF 07.3
008D: BCF 20.3
008E: MOVF 20,W
008F: BSF 03.5
0090: MOVWF 07
0091: NOP
0092: BCF 03.5
0093: RLF 3D,F
0094: BCF 07.4
0095: BTFSS 03.0
0096: GOTO 09D
0097: BSF 20.4
0098: MOVF 20,W
0099: BSF 03.5
009A: MOVWF 07
009B: GOTO 0A1
009C: BCF 03.5
009D: BCF 20.4
009E: MOVF 20,W
009F: BSF 03.5
00A0: MOVWF 07
00A1: NOP
00A2: BCF 03.5
00A3: BSF 20.3
00A4: MOVF 20,W
00A5: BSF 03.5
00A6: MOVWF 07
00A7: BCF 03.5
00A8: BTFSS 07.3
00A9: GOTO 0A8
00AA: DECFSZ 78,F
00AB: GOTO 08B
00AC: NOP
00AD: BCF 07.3
00AE: BCF 20.3
00AF: MOVF 20,W
00B0: BSF 03.5
00B1: MOVWF 07
00B2: NOP
00B3: BCF 03.5
00B4: BSF 20.4
00B5: MOVF 20,W
00B6: BSF 03.5
00B7: MOVWF 07
00B8: NOP
00B9: NOP
00BA: BCF 03.5
00BB: BSF 20.3
00BC: MOVF 20,W
00BD: BSF 03.5
00BE: MOVWF 07
00BF: BCF 03.5
00C0: BTFSS 07.3
00C1: GOTO 0C0
00C2: CLRF 78
00C3: NOP
00C4: BTFSC 07.4
00C5: BSF 78.0
00C6: BCF 07.3
00C7: BCF 20.3
00C8: MOVF 20,W
00C9: BSF 03.5
00CA: MOVWF 07
00CB: BCF 03.5
00CC: BCF 07.4
00CD: BCF 20.4
00CE: MOVF 20,W
00CF: BSF 03.5
00D0: MOVWF 07
00D1: BCF 03.5
00D2: 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 0C0
00AE: BCF 78.7
00AF: MOVF 40,W
00B0: MOVWF 79
00B1: RRF 79,F
00B2: BTFSC 03.0
00B3: BSF 07.7
00B4: BTFSS 03.0
00B5: BCF 07.7
00B6: BSF 78.6
00B7: GOTO 0C0
00B8: BCF 78.6
00B9: DECFSZ 78,F
00BA: GOTO 0B1
00BB: MOVF 79,W
00BC: MOVWF 40
00BD: GOTO 0BE
00BE: NOP
00BF: BSF 07.7
00C0: BTFSC 78.7
00C1: GOTO 0AE
00C2: BTFSC 78.6
00C3: GOTO 0B8
00C4: RETURN
010C: MOVLW 08
010D: MOVWF 3E
010E: MOVF 77,W
010F: MOVWF 3F
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 3E,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 3F,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
*
001F: BCF 20.7
0020: MOVF 20,W
0021: BSF 03.5
0022: MOVWF 07
0023: BCF 03.5
0024: BCF 07.7
0025: MOVLW 08
0026: MOVWF 78
0027: GOTO 028
0028: NOP
0029: BSF 78.7
002A: GOTO 039
002B: BCF 78.7
002C: RRF 40,F
002D: BTFSC 03.0
002E: BSF 07.7
002F: BTFSS 03.0
0030: BCF 07.7
0031: BSF 78.6
0032: GOTO 039
0033: BCF 78.6
0034: DECFSZ 78,F
0035: GOTO 02C
0036: GOTO 037
0037: NOP
0038: BSF 07.7
0039: MOVLW 3F
003A: MOVWF 04
003B: DECFSZ 04,F
003C: GOTO 03B
003D: NOP
003E: BTFSC 78.7
003F: GOTO 02B
0040: BTFSC 78.6
0041: GOTO 033
0042: RETURN
....................
....................
.................... #include "HMC5883L.h"
.................... #define MAG_ADDR_R 0x3D //addresa pro cteni
.................... #define MAG_ADDR_W 0x3C
.................... // 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
....................
.................... //Konstanty nastavujici rozsah
.................... //pro void set_mag_roz (unsigned int8 h)
239,16 → 269,6
....................
....................
.................... #include "HMC5883L.c"
.................... // 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
.................... //------------------------------
256,68 → 276,68
.................... {
.................... i2c_start();
*
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
00D3: BSF 20.4
00D4: MOVF 20,W
00D5: BSF 03.5
00D6: MOVWF 07
00D7: NOP
00D8: BCF 03.5
00D9: BSF 20.3
00DA: MOVF 20,W
00DB: BSF 03.5
00DC: MOVWF 07
00DD: NOP
00DE: BCF 03.5
00DF: BCF 07.4
00E0: BCF 20.4
00E1: MOVF 20,W
00E2: BSF 03.5
00E3: MOVWF 07
00E4: NOP
00E5: BCF 03.5
00E6: BCF 07.3
00E7: BCF 20.3
00E8: MOVF 20,W
00E9: BSF 03.5
00EA: MOVWF 07
.................... i2c_write(HMC5883L_WRT_ADDR);
0081: MOVLW 3C
0082: BCF 03.5
0083: MOVWF 3D
0084: CALL 01F
00EB: MOVLW 3C
00EC: BCF 03.5
00ED: MOVWF 3D
00EE: CALL 089
.................... i2c_write(reg);
0085: MOVF 37,W
0086: MOVWF 3D
0087: CALL 01F
00EF: MOVF 37,W
00F0: MOVWF 3D
00F1: CALL 089
.................... i2c_write(data);
0088: MOVF 38,W
0089: MOVWF 3D
008A: CALL 01F
00F2: MOVF 38,W
00F3: MOVWF 3D
00F4: CALL 089
.................... 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
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
00F5: BCF 20.4
00F6: MOVF 20,W
00F7: BSF 03.5
00F8: MOVWF 07
00F9: NOP
00FA: BCF 03.5
00FB: BSF 20.3
00FC: MOVF 20,W
00FD: BSF 03.5
00FE: MOVWF 07
00FF: BCF 03.5
0100: BTFSS 07.3
0101: GOTO 100
0102: NOP
0103: GOTO 104
0104: NOP
0105: BSF 20.4
0106: MOVF 20,W
0107: BSF 03.5
0108: MOVWF 07
0109: NOP
.................... }
00A0: BCF 03.5
00A1: RETURN
010A: BCF 03.5
010B: RETURN
....................
.................... //------------------------------
.................... int8 hmc5883l_read_reg(int8 reg)
347,12 → 367,12
.................... // from the HMC5883L x,y,z registers.
.................... hmc5883l_result compass = {0,0,0};
*
0270: CLRF 21
0271: CLRF 22
0272: CLRF 23
0273: CLRF 24
0274: CLRF 25
0275: CLRF 26
0287: CLRF 21
0288: CLRF 22
0289: CLRF 23
028A: CLRF 24
028B: CLRF 25
028C: CLRF 26
....................
.................... //------------------------------
.................... void hmc5883l_read_data(void)
368,154 → 388,154
....................
.................... i2c_start();
*
0150: BSF 20.4
0151: MOVF 20,W
0152: BSF 03.5
0153: MOVWF 07
0154: NOP
0155: BCF 03.5
0156: BSF 20.3
0157: MOVF 20,W
0158: BSF 03.5
0159: MOVWF 07
015A: NOP
015B: BCF 03.5
015C: BCF 07.4
015D: BCF 20.4
015E: MOVF 20,W
015F: BSF 03.5
0160: MOVWF 07
0161: NOP
0162: BCF 03.5
0163: BCF 07.3
0164: BCF 20.3
0165: MOVF 20,W
0166: BSF 03.5
0167: MOVWF 07
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);
0168: MOVLW 3C
0169: BCF 03.5
016A: MOVWF 3D
016B: CALL 01F
0169: MOVLW 3C
016A: BCF 03.5
016B: MOVWF 3D
016C: CALL 089
.................... i2c_write(HMC5883L_X_MSB_REG); // Point to X-msb register
016C: MOVLW 03
016D: MOVWF 3D
016E: CALL 01F
016D: MOVLW 03
016E: MOVWF 3D
016F: CALL 089
.................... i2c_start();
016F: BSF 20.4
0170: MOVF 20,W
0171: BSF 03.5
0172: MOVWF 07
0173: NOP
0174: BCF 03.5
0175: BSF 20.3
0176: MOVF 20,W
0177: BSF 03.5
0178: MOVWF 07
0179: NOP
017A: BCF 03.5
017B: BTFSS 07.3
017C: GOTO 17B
017D: BCF 07.4
017E: BCF 20.4
017F: MOVF 20,W
0180: BSF 03.5
0181: MOVWF 07
0182: NOP
0183: BCF 03.5
0184: BCF 07.3
0185: BCF 20.3
0186: MOVF 20,W
0187: BSF 03.5
0188: MOVWF 07
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);
0189: MOVLW 3D
018A: BCF 03.5
018B: MOVWF 3D
018C: CALL 01F
018A: MOVLW 3D
018B: BCF 03.5
018C: MOVWF 3D
018D: CALL 089
....................
.................... x_msb = i2c_read();
018D: MOVLW 01
018E: MOVWF 77
018F: CALL 10B
0190: MOVF 78,W
0191: MOVWF 38
018E: MOVLW 01
018F: MOVWF 77
0190: CALL 10C
0191: MOVF 78,W
0192: MOVWF 38
.................... x_lsb = i2c_read();
0192: MOVLW 01
0193: MOVWF 77
0194: CALL 10B
0195: MOVF 78,W
0196: MOVWF 37
0193: MOVLW 01
0194: MOVWF 77
0195: CALL 10C
0196: MOVF 78,W
0197: MOVWF 37
....................
.................... z_msb = i2c_read();
0197: MOVLW 01
0198: MOVWF 77
0199: CALL 10B
019A: MOVF 78,W
019B: MOVWF 3C
0198: MOVLW 01
0199: MOVWF 77
019A: CALL 10C
019B: MOVF 78,W
019C: MOVWF 3C
.................... z_lsb = i2c_read();
019C: MOVLW 01
019D: MOVWF 77
019E: CALL 10B
019F: MOVF 78,W
01A0: MOVWF 3B
019D: MOVLW 01
019E: MOVWF 77
019F: CALL 10C
01A0: MOVF 78,W
01A1: MOVWF 3B
....................
.................... y_msb = i2c_read();
01A1: MOVLW 01
01A2: MOVWF 77
01A3: CALL 10B
01A4: MOVF 78,W
01A5: MOVWF 3A
01A2: MOVLW 01
01A3: MOVWF 77
01A4: CALL 10C
01A5: MOVF 78,W
01A6: MOVWF 3A
.................... y_lsb = i2c_read(0); // do a NACK on last read
01A6: CLRF 77
01A7: CALL 10B
01A8: MOVF 78,W
01A9: MOVWF 39
01A7: CLRF 77
01A8: CALL 10C
01A9: MOVF 78,W
01AA: MOVWF 39
....................
.................... i2c_stop();
01AA: BCF 20.4
01AB: MOVF 20,W
01AC: BSF 03.5
01AD: MOVWF 07
01AE: NOP
01AF: BCF 03.5
01B0: BSF 20.3
01B1: MOVF 20,W
01B2: BSF 03.5
01B3: MOVWF 07
01B4: BCF 03.5
01B5: BTFSS 07.3
01B6: GOTO 1B5
01B7: NOP
01B8: GOTO 1B9
01B9: NOP
01BA: BSF 20.4
01BB: MOVF 20,W
01BC: BSF 03.5
01BD: MOVWF 07
01BE: NOP
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
....................
.................... // Combine high and low bytes into 16-bit values.
.................... compass.x = make16(x_msb, x_lsb);
01BF: BCF 03.5
01C0: MOVF 38,W
01C1: MOVWF 22
01C2: MOVF 37,W
01C3: MOVWF 21
01C0: BCF 03.5
01C1: MOVF 38,W
01C2: MOVWF 22
01C3: MOVF 37,W
01C4: MOVWF 21
.................... compass.y = make16(y_msb, y_lsb);
01C4: MOVF 3A,W
01C5: MOVWF 24
01C6: MOVF 39,W
01C7: MOVWF 23
01C5: MOVF 3A,W
01C6: MOVWF 24
01C7: MOVF 39,W
01C8: MOVWF 23
.................... compass.z = make16(z_msb, z_lsb);
01C8: MOVF 3C,W
01C9: MOVWF 26
01CA: MOVF 3B,W
01CB: MOVWF 25
01C9: MOVF 3C,W
01CA: MOVWF 26
01CB: MOVF 3B,W
01CC: MOVWF 25
.................... }
01CC: BCF 0A.3
01CD: BCF 0A.4
01CE: GOTO 2E1 (RETURN)
01CD: BCF 0A.3
01CE: BCF 0A.4
01CF: GOTO 2F6 (RETURN)
....................
....................
....................
2697,247 → 2717,224
.................... void main()
.................... {
*
024F: CLRF 04
0250: BCF 03.7
0251: MOVLW 1F
0252: ANDWF 03,F
0253: MOVLW 71
0254: BSF 03.5
0255: MOVWF 0F
0256: MOVF 0F,W
0257: BCF 03.5
0258: BCF 20.7
0259: MOVF 20,W
025A: BSF 03.5
025B: MOVWF 07
025C: BCF 03.5
025D: BSF 07.7
025E: BSF 03.5
025F: BSF 03.6
0260: MOVF 09,W
0261: ANDLW C0
0262: MOVWF 09
0263: BCF 03.6
0264: BCF 1F.4
0265: BCF 1F.5
0266: MOVLW 00
0267: BSF 03.6
0268: MOVWF 08
0269: BCF 03.5
026A: CLRF 07
026B: CLRF 08
026C: CLRF 09
0266: CLRF 04
0267: BCF 03.7
0268: MOVLW 1F
0269: ANDWF 03,F
026A: MOVLW 71
026B: BSF 03.5
026C: MOVWF 0F
026D: MOVF 0F,W
026E: BCF 03.5
026F: BCF 20.7
0270: MOVF 20,W
0271: BSF 03.5
0272: MOVWF 07
0273: BCF 03.5
0274: BSF 07.7
0275: BSF 03.5
0276: BSF 03.6
0277: MOVF 09,W
0278: ANDLW C0
0279: MOVWF 09
027A: BCF 03.6
027B: BCF 1F.4
027C: BCF 1F.5
027D: MOVLW 00
027E: BSF 03.6
027F: MOVWF 08
0280: BCF 03.5
0281: CLRF 07
0282: CLRF 08
0283: CLRF 09
*
0276: CLRF 34
0277: CLRF 33
028D: CLRF 34
028E: CLRF 33
.................... float last,b,anemo_speed;
.................... unsigned int16 anemo_round=0;
.................... unsigned int16 i;
....................
....................
.................... //signed int16 X,Y,Z;
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
0278: BSF 03.5
0279: BSF 03.6
027A: MOVF 09,W
027B: ANDLW C0
027C: MOVWF 09
027D: BCF 03.6
027E: BCF 1F.4
027F: BCF 1F.5
0280: MOVLW 00
0281: BSF 03.6
0282: MOVWF 08
028F: BSF 03.5
0290: BSF 03.6
0291: MOVF 09,W
0292: ANDLW C0
0293: MOVWF 09
0294: BCF 03.6
0295: BCF 1F.4
0296: BCF 1F.5
0297: MOVLW 00
0298: BSF 03.6
0299: MOVWF 08
.................... setup_adc(ADC_CLOCK_DIV_2);
0283: BCF 03.5
0284: BCF 03.6
0285: BCF 1F.6
0286: BCF 1F.7
0287: BSF 03.5
0288: BCF 1F.7
0289: BCF 03.5
028A: BSF 1F.0
029A: BCF 03.5
029B: BCF 03.6
029C: BCF 1F.6
029D: BCF 1F.7
029E: BSF 03.5
029F: BCF 1F.7
02A0: BCF 03.5
02A1: BSF 1F.0
.................... setup_spi(SPI_SS_DISABLED);
028B: BCF 14.5
028C: BCF 20.5
028D: MOVF 20,W
028E: BSF 03.5
028F: MOVWF 07
0290: BCF 03.5
0291: BSF 20.4
0292: MOVF 20,W
0293: BSF 03.5
0294: MOVWF 07
0295: BCF 03.5
0296: BCF 20.3
0297: MOVF 20,W
0298: BSF 03.5
0299: MOVWF 07
029A: MOVLW 01
029B: BCF 03.5
029C: MOVWF 14
029D: MOVLW 00
029E: BSF 03.5
029F: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
02A0: MOVF 01,W
02A1: ANDLW C7
02A2: IORLW 08
02A3: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
02A4: BCF 03.5
02A5: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
02A6: MOVLW 00
02A7: MOVWF 78
02A8: MOVWF 12
02A9: MOVLW 00
02A2: BCF 14.5
02A3: BCF 20.5
02A4: MOVF 20,W
02A5: BSF 03.5
02A6: MOVWF 07
02A7: BCF 03.5
02A8: BSF 20.4
02A9: MOVF 20,W
02AA: BSF 03.5
02AB: MOVWF 12
.................... setup_ccp1(CCP_OFF);
02AB: MOVWF 07
02AC: BCF 03.5
02AD: BSF 20.2
02AD: BCF 20.3
02AE: MOVF 20,W
02AF: BSF 03.5
02B0: MOVWF 07
02B1: BCF 03.5
02B2: CLRF 17
02B3: BSF 03.5
02B4: CLRF 1B
02B5: CLRF 1C
02B6: MOVLW 01
02B7: MOVWF 1D
02B1: MOVLW 01
02B2: BCF 03.5
02B3: MOVWF 14
02B4: MOVLW 00
02B5: BSF 03.5
02B6: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
02B7: MOVF 01,W
02B8: ANDLW C7
02B9: IORLW 08
02BA: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
02BB: BCF 03.5
02BC: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
02BD: MOVLW 00
02BE: MOVWF 78
02BF: MOVWF 12
02C0: MOVLW 00
02C1: BSF 03.5
02C2: MOVWF 12
.................... setup_ccp1(CCP_OFF);
02C3: BCF 03.5
02C4: BSF 20.2
02C5: MOVF 20,W
02C6: BSF 03.5
02C7: MOVWF 07
02C8: BCF 03.5
02C9: CLRF 17
02CA: BSF 03.5
02CB: CLRF 1B
02CC: CLRF 1C
02CD: MOVLW 01
02CE: MOVWF 1D
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
02B8: BCF 03.5
02B9: BSF 03.6
02BA: CLRF 07
02BB: CLRF 08
02BC: CLRF 09
02CF: BCF 03.5
02D0: BSF 03.6
02D1: CLRF 07
02D2: CLRF 08
02D3: CLRF 09
....................
.................... printf("Magnetometr: \r\n",);
02D4: MOVLW 04
02D5: MOVWF 0D
02D6: MOVLW 00
02D7: MOVWF 0F
02D8: BCF 03.6
02D9: CALL 043
.................... printf("(c)mlab JACHO 2013: \r\n",);
02DA: MOVLW 0D
02DB: BSF 03.6
02DC: MOVWF 0D
02DD: MOVLW 00
02DE: MOVWF 0F
02DF: BCF 03.6
02E0: CALL 043
.................... printf("X, Y, Z \r\n",);
02E1: MOVLW 19
02E2: BSF 03.6
02E3: MOVWF 0D
02E4: MOVLW 00
02E5: MOVWF 0F
02E6: BCF 03.6
02E7: CALL 043
....................
....................
.................... // Init the HMC5883L. Set Mode register for
.................... // continuous measurements.
.................... hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range
02BD: BCF 03.6
02BE: CLRF 37
02BF: MOVLW 18
02C0: MOVWF 38
02C1: CALL 069
02E8: CLRF 37
02E9: MOVLW 18
02EA: MOVWF 38
02EB: CALL 0D3
.................... hmc5883l_write_reg(HMC5883L_CFG_B_REG, 0xE0); // maximal range
02C2: MOVLW 01
02C3: MOVWF 37
02C4: MOVLW E0
02C5: MOVWF 38
02C6: CALL 069
02EC: MOVLW 01
02ED: MOVWF 37
02EE: MOVLW E0
02EF: MOVWF 38
02F0: CALL 0D3
.................... hmc5883l_write_reg(HMC5883L_MODE_REG, 0x00);
02C7: MOVLW 02
02C8: MOVWF 37
02C9: CLRF 38
02CA: CALL 069
02F1: MOVLW 02
02F2: MOVWF 37
02F3: CLRF 38
02F4: CALL 0D3
....................
.................... // 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",);
02CB: MOVLW 04
02CC: BSF 03.6
02CD: MOVWF 0D
02CE: MOVLW 00
02CF: MOVWF 0F
02D0: BCF 03.6
02D1: CALL 0C5
.................... printf("(c)mlab JACHO 2013: \r\n",);
02D2: MOVLW 0D
02D3: BSF 03.6
02D4: MOVWF 0D
02D5: MOVLW 00
02D6: MOVWF 0F
02D7: BCF 03.6
02D8: CALL 0C5
.................... printf("X, Y, Z \r\n",);
02D9: MOVLW 19
02DA: BSF 03.6
02DB: MOVWF 0D
02DC: MOVLW 00
02DD: MOVWF 0F
02DE: BCF 03.6
02DF: CALL 0C5
....................
.................... /* while(true)
.................... {
.................... X = mag_readX();
.................... Y = mag_readY();
.................... Z = mag_readZ();
.................... printf("%4Ld %4Ld %4Ld \r\n", X, Y, Z);
.................... Delay_ms(50);
....................
.................... }
.................... */
....................
.................... while(TRUE)
.................... {
....................
.................... // for(i=0;i<=10;i++)
.................... // {
.................... hmc5883l_read_data();
02E0: GOTO 150
....................
.................... // b = atan2((float)compass.y,(float)compass.x); // vypocet azimutu z kartezskych souradnic
.................... // b = (b/3.141596)*180; // prevod na stupne
.................... // b += 180;
....................
.................... // anemo_speed += (b-last);
.................... // last=b;
.................... // delay_ms(10);
.................... // }
.................... // anemo_speed=anemo_speed/10;
....................
.................... printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z);
02E1: MOVLW 00
02E2: MOVWF 04
02E3: MOVF 22,W
02E4: MOVWF 38
02E5: MOVF 21,W
02E6: MOVWF 37
02E7: CALL 1CF
02E8: MOVLW 20
02E9: MOVWF 40
02EA: CALL 0A2
02EB: MOVLW 00
02EC: MOVWF 04
02ED: MOVF 24,W
02EE: MOVWF 38
02EF: MOVF 23,W
02F0: MOVWF 37
02F1: CALL 1CF
02F2: MOVLW 20
02F3: MOVWF 40
02F4: CALL 0A2
02F5: MOVLW 00
02F6: MOVWF 04
02F7: MOVF 26,W
02F8: MOVWF 38
02F9: MOVF 25,W
02FA: MOVWF 37
02FB: CALL 1CF
02FC: MOVLW 20
02FD: MOVWF 40
02FE: CALL 0A2
02FF: MOVLW 0A
0300: MOVWF 40
0301: CALL 0A2
0302: MOVLW 0D
0303: MOVWF 40
0304: CALL 0A2
.................... // delay_ms(100);
.................... hmc5883l_read_data();
02F5: GOTO 151
.................... printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z);
02F6: MOVLW 00
02F7: MOVWF 04
02F8: MOVF 22,W
02F9: MOVWF 38
02FA: MOVF 21,W
02FB: MOVWF 37
02FC: CALL 1D0
02FD: MOVLW 20
02FE: MOVWF 40
02FF: CALL 01F
0300: MOVLW 00
0301: MOVWF 04
0302: MOVF 24,W
0303: MOVWF 38
0304: MOVF 23,W
0305: MOVWF 37
0306: CALL 1D0
0307: MOVLW 20
0308: MOVWF 40
0309: CALL 01F
030A: MOVLW 00
030B: MOVWF 04
030C: MOVF 26,W
030D: MOVWF 38
030E: MOVF 25,W
030F: MOVWF 37
0310: CALL 1D0
0311: MOVLW 20
0312: MOVWF 40
0313: CALL 01F
0314: MOVLW 0A
0315: MOVWF 40
0316: CALL 01F
0317: MOVLW 0D
0318: MOVWF 40
0319: CALL 01F
.................... delay_ms(100);
031A: MOVLW 64
031B: MOVWF 37
031C: GOTO 250
.................... }
0305: GOTO 2E0
031D: GOTO 2F5
....................
.................... }
....................
....................
....................
0306: SLEEP
031E: SLEEP
 
Configuration Fuses:
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
/Modules/Sensors/MAG01A/SW/PIC16F887/main.pjt
17,11 → 17,12
0=0000 %S 0 0 796 451 3 0
[Opened Files]
1=main.c
2=HMC5883L.c
3=main.h
4=C:\Program Files (x86)\PICC\devices\16F887.h
5=HMC5883L.h
6=
2=
3=C:\Program Files (x86)\PICC\devices\16F887.h
4=HMC5883L.h
5=HMC5883L.c
6=C:\Program Files (x86)\PICC\drivers\math.h
7=
[Target Data]
OptionString=-p +FM
FileList=Z:\home\kaklik\svnMLAB\Modules\Sensors\MAG01A\SW\PIC16F887\main.c
/Modules/Sensors/MAG01A/SW/PIC16F887/main.sta
1,6 → 1,6
 
ROM used: 775 (9%)
775 (9%) including unused fragments
ROM used: 799 (10%)
799 (10%) including unused fragments
 
0 Average locations per line
3 Average locations per statement
12,45 → 12,46
 
Lines Stmts % Files
----- ----- --- -----
72 18 6 main.c
48 19 6 main.c
22 0 0 main.h
423 0 0 C:\Program Files (x86)\PICC\devices\16F887.h
19 0 0 HMC5883L.h
86 28 9 HMC5883L.c
25 0 0 HMC5883L.h
76 28 9 HMC5883L.c
2172 260 85 C:\Program Files (x86)\PICC\drivers\math.h
----- -----
2794 306 Total
2766 307 Total
 
Page ROM % RAM Vol Diff Functions:
---- --- --- --- --- ---- ----------
0 69 9 3 357 1.4 @I2C_READ_1
0 74 10 1 113 1.3 @I2C_WRITE_1
0 35 5 1 152 2.2 @PUTCHAR_1_
0 22 3 1 @delay_ms1
0 69 9 3 @I2C_READ_1
0 74 9 1 @I2C_WRITE_1
0 36 5 1 @PUTCHAR_1_
0 57 7 2 102 1.8 hmc5883l_write_reg
0 127 16 6 636 3.3 hmc5883l_read_data
0 184 24 16 693 3.9 MAIN
0 185 23 16 722 3.9 MAIN
0 9 1 0 @const237
0 70 9 3 @PSTRINGC7_69
0 12 2 0 @const239
0 6 1 0 @const240
0 128 17 9 @PRINTF_LD_69
0 128 16 9 @PRINTF_LD_69
 
Program metrics:
Functions 6
Statements 306
Comments 377
Volume (V) 2949
Difficilty (D) 13.9
Effort to implement (E) 40971
Time to implement (T) 38 minutes
Functions 3
Statements 307
Comments 358
Volume (V) 1829
Difficilty (D) 8.6
Effort to implement (E) 15712
Time to implement (T) 15 minutes
Est Delivered Bugs (B) 0
Cyclomatic Complexity 1
Maintainability (MI) 61
Maintainability (MI) 16
 
Segment Used Free
----------- ---- ----
00000-00003 4 0
00004-007FF 771 1273
00004-007FF 795 1249
00800-00FFF 0 2048
01000-017FF 0 2048
01800-01FFF 0 2048
/Modules/Sensors/MAG01A/SW/PIC16F887/main.sym
15,6 → 15,7
035-036 MAIN.i
037-038 @PRINTF_LD_69.P1
037 hmc5883l_write_reg.reg
037 @delay_ms1.P1
037 hmc5883l_read_data.x_lsb
037 @PSTRINGC7_69.@SCRATCH1
038 hmc5883l_read_data.x_msb
29,8 → 30,8
03B @PRINTF_LD_69.@SCRATCH3
03C hmc5883l_read_data.z_msb
03C @PRINTF_LD_69.@SCRATCH4
03D @I2C_WRITE_1.P1
03D @I2C_READ_1.P2
03D @I2C_READ_1.P1
03D @I2C_WRITE_1.P2
03D @PRINTF_LD_69.@SCRATCH5
03E @I2C_READ_1.@SCRATCH1
03E @PRINTF_LD_69.@SCRATCH6
44,23 → 45,23
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:
010B @I2C_READ_1
001F @I2C_WRITE_1
00A2 @PUTCHAR_1_
0069 hmc5883l_write_reg
0150 hmc5883l_read_data
0800 atan2
024F MAIN
0250 @delay_ms1
010C @I2C_READ_1
0089 @I2C_WRITE_1
001F @PUTCHAR_1_
00D3 hmc5883l_write_reg
0151 hmc5883l_read_data
0266 MAIN
0004 @const237
00C5 @PSTRINGC7_69
0043 @PSTRINGC7_69
000D @const239
0019 @const240
01CF @PRINTF_LD_69
024F @cinit
01D0 @PRINTF_LD_69
0266 @cinit
 
 
User Memory space:
/Modules/Sensors/MAG01A/SW/PIC16F887/main.tre
1,6 → 1,15
ÀÄmain
ÀÄMAIN 0/184 Ram=16
ÀÄMAIN 0/185 Ram=16
ÃÄ??0??
ÃÄ@PSTRINGC7_69 0/70 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/36 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PSTRINGC7_69 0/70 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/36 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PSTRINGC7_69 0/70 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/36 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄhmc5883l_write_reg 0/57 Ram=2
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1
13,15 → 22,6
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1
³ ÀÄ@I2C_WRITE_1 0/74 Ram=1
ÃÄ@PSTRINGC7_69 0/70 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/35 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄ@PSTRINGC7_69 0/70 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/35 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄ@PSTRINGC7_69 0/70 Ram=3
³ ÃÄ@PUTCHAR_1_ 0/35 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄhmc5883l_read_data 0/127 Ram=6
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1
³ ÃÄ@I2C_WRITE_1 0/74 Ram=1
33,13 → 33,14
³ ÃÄ@I2C_READ_1 0/69 Ram=3
³ ÀÄ@I2C_READ_1 0/69 Ram=3
ÃÄ@PRINTF_LD_69 0/128 Ram=9
³ ÀÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄ@PUTCHAR_1_ 0/35 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PRINTF_LD_69 0/128 Ram=9
³ ÀÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄ@PUTCHAR_1_ 0/35 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PRINTF_LD_69 0/128 Ram=9
³ ÀÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄ@PUTCHAR_1_ 0/35 Ram=1
ÃÄ@PUTCHAR_1_ 0/35 Ram=1
ÀÄ@PUTCHAR_1_ 0/35 Ram=1
³ ÀÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PUTCHAR_1_ 0/36 Ram=1
ÃÄ@PUTCHAR_1_ 0/36 Ram=1
ÀÄ@delay_ms1 0/22 Ram=1