OSDN Git Service

111119 initial commit
authorNaoya Takamura <ntaka206@users.sourceforge.net>
Fri, 18 Nov 2011 15:15:29 +0000 (00:15 +0900)
committerNaoya Takamura <ntaka206@users.sourceforge.net>
Fri, 18 Nov 2011 15:15:29 +0000 (00:15 +0900)
45 files changed:
.dep.inc [new file with mode: 0644]
Makefile [new file with mode: 0644]
build/default/production/debug_print.o [new file with mode: 0644]
build/default/production/debug_print.o.d [new file with mode: 0644]
build/default/production/main.o [new file with mode: 0644]
build/default/production/main.o.d [new file with mode: 0644]
build/default/production/myad.o [new file with mode: 0644]
build/default/production/myad.o.d [new file with mode: 0644]
build/default/production/myspi.o [new file with mode: 0644]
build/default/production/myspi.o.d [new file with mode: 0644]
build/default/production/myuart.o [new file with mode: 0644]
build/default/production/myuart.o.d [new file with mode: 0644]
build/default/production/ring.o [new file with mode: 0644]
build/default/production/ring.o.d [new file with mode: 0644]
build/default/production/ublox.o [new file with mode: 0644]
build/default/production/ublox.o.d [new file with mode: 0644]
debug_print.c [new file with mode: 0644]
debug_print.h [new file with mode: 0644]
delay.c [new file with mode: 0644]
delay.h [new file with mode: 0644]
dist/default/production/ad2010.production.hex [new file with mode: 0644]
dist/default/production/ad2010.production.out [new file with mode: 0755]
main.c [new file with mode: 0644]
myad.c [new file with mode: 0644]
myad.h [new file with mode: 0644]
myspi.c [new file with mode: 0644]
myspi.h [new file with mode: 0644]
myuart.c [new file with mode: 0644]
myuart.h [new file with mode: 0644]
nbproject/.dep.inc [new file with mode: 0644]
nbproject/Makefile-default.mk [new file with mode: 0644]
nbproject/Makefile-genesis.properties [new file with mode: 0644]
nbproject/Makefile-impl.mk [new file with mode: 0644]
nbproject/Makefile-variables.mk [new file with mode: 0644]
nbproject/Package-default.bash [new file with mode: 0644]
nbproject/configurations.xml [new file with mode: 0644]
nbproject/private/configurations.xml [new file with mode: 0644]
nbproject/private/private.properties [new file with mode: 0644]
nbproject/private/private.xml [new file with mode: 0644]
nbproject/project.properties [new file with mode: 0644]
nbproject/project.xml [new file with mode: 0644]
ring.c [new file with mode: 0644]
ring.h [new file with mode: 0644]
ublox.c [new file with mode: 0644]
ublox.h [new file with mode: 0644]

diff --git a/.dep.inc b/.dep.inc
new file mode 100644 (file)
index 0000000..4560e55
--- /dev/null
+++ b/.dep.inc
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..05a3fb1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,108 @@
+#
+#  There exist several targets which are by default empty and which can be 
+#  used for execution of your targets. These targets are usually executed 
+#  before and after some main targets. They are: 
+#
+#     .build-pre:              called before 'build' target
+#     .build-post:             called after 'build' target
+#     .clean-pre:              called before 'clean' target
+#     .clean-post:             called after 'clean' target
+#     .clobber-pre:            called before 'clobber' target
+#     .clobber-post:           called after 'clobber' target
+#     .all-pre:                called before 'all' target
+#     .all-post:               called after 'all' target
+#     .help-pre:               called before 'help' target
+#     .help-post:              called after 'help' target
+#
+#  Targets beginning with '.' are not intended to be called on their own.
+#
+#  Main targets can be executed directly, and they are:
+#  
+#     build                    build a specific configuration
+#     clean                    remove built files from a configuration
+#     clobber                  remove all built files
+#     all                      build all configurations
+#     help                     print help mesage
+#  
+#  Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
+#  .help-impl are implemented in nbproject/makefile-impl.mk.
+#
+#  Available make variables:
+#
+#     CND_BASEDIR                base directory for relative paths
+#     CND_DISTDIR                default top distribution directory (build artifacts)
+#     CND_BUILDDIR               default top build directory (object files, ...)
+#     CONF                       name of current configuration
+#     CND_ARTIFACT_DIR_${CONF}   directory of build artifact (current configuration)
+#     CND_ARTIFACT_NAME_${CONF}  name of build artifact (current configuration)
+#     CND_ARTIFACT_PATH_${CONF}  path to build artifact (current configuration)
+#     CND_PACKAGE_DIR_${CONF}    directory of package (current configuration)
+#     CND_PACKAGE_NAME_${CONF}   name of package (current configuration)
+#     CND_PACKAGE_PATH_${CONF}   path to package (current configuration)
+#
+# NOCDDL
+
+
+# Environment 
+MKDIR=mkdir
+CP=cp
+CCADMIN=CCadmin
+RANLIB=ranlib
+
+
+# build
+build: .build-post
+
+.build-pre:
+# Add your pre 'build' code here...
+
+.build-post: .build-impl
+# Add your post 'build' code here...
+
+
+# clean
+clean: .clean-post
+
+.clean-pre:
+# Add your pre 'clean' code here...
+
+.clean-post: .clean-impl
+# Add your post 'clean' code here...
+
+
+# clobber
+clobber: .clobber-post
+
+.clobber-pre:
+# Add your pre 'clobber' code here...
+
+.clobber-post: .clobber-impl
+# Add your post 'clobber' code here...
+
+
+# all
+all: .all-post
+
+.all-pre:
+# Add your pre 'all' code here...
+
+.all-post: .all-impl
+# Add your post 'all' code here...
+
+
+# help
+help: .help-post
+
+.help-pre:
+# Add your pre 'help' code here...
+
+.help-post: .help-impl
+# Add your post 'help' code here...
+
+
+
+# include project implementation makefile
+include nbproject/Makefile-impl.mk
+
+# include project make variables
+include nbproject/Makefile-variables.mk
diff --git a/build/default/production/debug_print.o b/build/default/production/debug_print.o
new file mode 100644 (file)
index 0000000..b2a6907
Binary files /dev/null and b/build/default/production/debug_print.o differ
diff --git a/build/default/production/debug_print.o.d b/build/default/production/debug_print.o.d
new file mode 100644 (file)
index 0000000..75b56fb
--- /dev/null
@@ -0,0 +1 @@
+build/default/production/debug_print.o: debug_print.c myuart.h
diff --git a/build/default/production/main.o b/build/default/production/main.o
new file mode 100644 (file)
index 0000000..84f0b56
Binary files /dev/null and b/build/default/production/main.o differ
diff --git a/build/default/production/main.o.d b/build/default/production/main.o.d
new file mode 100644 (file)
index 0000000..ee942d5
--- /dev/null
@@ -0,0 +1,2 @@
+build/default/production/main.o: main.c myuart.h myspi.h debug_print.h \
+  ublox.h myad.h delay.h ring.h
diff --git a/build/default/production/myad.o b/build/default/production/myad.o
new file mode 100644 (file)
index 0000000..affb912
Binary files /dev/null and b/build/default/production/myad.o differ
diff --git a/build/default/production/myad.o.d b/build/default/production/myad.o.d
new file mode 100644 (file)
index 0000000..c4ddc0c
--- /dev/null
@@ -0,0 +1 @@
+build/default/production/myad.o: myad.c delay.h myspi.h myad.h
diff --git a/build/default/production/myspi.o b/build/default/production/myspi.o
new file mode 100644 (file)
index 0000000..96f6163
Binary files /dev/null and b/build/default/production/myspi.o differ
diff --git a/build/default/production/myspi.o.d b/build/default/production/myspi.o.d
new file mode 100644 (file)
index 0000000..2dd1485
--- /dev/null
@@ -0,0 +1 @@
+build/default/production/myspi.o: myspi.c myspi.h
diff --git a/build/default/production/myuart.o b/build/default/production/myuart.o
new file mode 100644 (file)
index 0000000..1d1fc9f
Binary files /dev/null and b/build/default/production/myuart.o differ
diff --git a/build/default/production/myuart.o.d b/build/default/production/myuart.o.d
new file mode 100644 (file)
index 0000000..c6bff6b
--- /dev/null
@@ -0,0 +1 @@
+build/default/production/myuart.o: myuart.c myuart.h
diff --git a/build/default/production/ring.o b/build/default/production/ring.o
new file mode 100644 (file)
index 0000000..6f8f054
Binary files /dev/null and b/build/default/production/ring.o differ
diff --git a/build/default/production/ring.o.d b/build/default/production/ring.o.d
new file mode 100644 (file)
index 0000000..24b4505
--- /dev/null
@@ -0,0 +1 @@
+build/default/production/ring.o: ring.c ring.h
diff --git a/build/default/production/ublox.o b/build/default/production/ublox.o
new file mode 100644 (file)
index 0000000..c99c55f
Binary files /dev/null and b/build/default/production/ublox.o differ
diff --git a/build/default/production/ublox.o.d b/build/default/production/ublox.o.d
new file mode 100644 (file)
index 0000000..4808e7c
--- /dev/null
@@ -0,0 +1 @@
+build/default/production/ublox.o: ublox.c ublox.h myuart.h
diff --git a/debug_print.c b/debug_print.c
new file mode 100644 (file)
index 0000000..d294d2d
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "myuart.h"
+
+void  PDEBUG(char *buf)
+{
+    uart2_puts( buf );
+}
+
+
+
+
diff --git a/debug_print.h b/debug_print.h
new file mode 100644 (file)
index 0000000..b2cc76f
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __PDEBUG_H__
+#define __PDEBUG_H__
+
+#undef PDEBUG
+
+// リリース時はコメント
+#define        DEBUG_PRINT
+
+#ifdef DEBUG_PRINT
+void  PDEBUG(char *buf);
+#else
+#  define PDEBUG(fmt, args...)
+#endif
+
+#endif
diff --git a/delay.c b/delay.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/delay.h b/delay.h
new file mode 100644 (file)
index 0000000..562da08
--- /dev/null
+++ b/delay.h
@@ -0,0 +1,12 @@
+#ifndef __DELAY_H__
+
+#define __DELAY_H__
+
+#include <libpic30.h>
+
+#define FOSC    8000000LL   // Clock Freqency Hz
+#define FCY  (FOSC/2)  // FCY 動作周波数[ Hz ]
+#define delay_us(x) __delay32(((x*FCY)/1000000L)) // delays x us
+#define delay_ms(x) __delay32(((x*FCY)/1000L))  // delays x ms
+
+#endif
diff --git a/dist/default/production/ad2010.production.hex b/dist/default/production/ad2010.production.hex
new file mode 100644 (file)
index 0000000..cb54574
--- /dev/null
@@ -0,0 +1,772 @@
+:020000040000fa
+:080000000002040000000000f2
+:020000040000fa
+:100400008f0022000e7f22000e01880000000000f5
+:100410000c0007008053210001002000110007009c
+:10042000000020000000e000020032000000020096
+:1004300000000000900d0200000000000040da0003
+:100440000000fe004440a900800820000000e000f9
+:100450000300320000002000a00188004440a800f2
+:100460000000060091018800800078000000eb0089
+:1004700015003700e280400032a0b4009101ba00bc
+:10048000e280400032a0b4009102ba00e280400055
+:1004900032a0b4000002eb00472bde00f507b200eb
+:1004a000602ce10004003a000059eb008301e900f0
+:1004b000fdff3e00040037006128e100010032002a
+:1004c0000082eb00040007001101ba000200e00006
+:1004d000e8ff3a00000006003159ba008301e90044
+:1004e0000c0032002159ba008301e90008003200f3
+:1004f0000400e00003003a00e280400032a0b400b3
+:10050000f5ff370011d9ba008301e900faff3a007c
+:100510008100e800e180400032a0b4000000060045
+:100520000040da000000fe00839f68000100e00048
+:1005300002003d0060001000e08018000300e000b1
+:1005400002003d0060011100e08119000500070074
+:100550004f00e00002003b0060001000e080180047
+:10056000000006006022b800060220000000d00053
+:100570008180d2000482d2008582d2000000a000d7
+:100580000202520083825a0003003100020242003c
+:1005900083824a000000a1000603e900f3ff3a004d
+:1005a000000006008001eb000200370061f07900d6
+:1005b0008301e800828f5100fcff3a000000060032
+:1005c0008001eb0002003700817178008301e800b0
+:1005d000828f5100fcff3a0000000600889fbe0099
+:1005e0000004be00060037000804e8000000fb001d
+:1005f00089007800de020700e10f400004003200ad
+:10060000184078000004e000f7ff3a000000eb001b
+:100610004f04be0000000600881f780081fa210008
+:10062000eeff07000004780081fa2100a0002000fe
+:10063000cf020700080078004f0478000000060091
+:100640000c00fa00889fbe0000047800cfb097002d
+:10065000f0ff2700d0bf9f008004eb0099bf9f00f0
+:1006600088bf9f00a8bf9f00200c2000b0bf9f0044
+:100670007881570070805700080007000fb8970076
+:10068000094878000fb89700080450000800780067
+:100690004f04be000080fa0000000600fe874700fd
+:1006a000889fbe008a9fbe008c9fbe008e1f780070
+:1006b000f0b79f000107780082bf9f000000eb00a9
+:1006c000a0b79f009f0237008006eb0050c2b30026
+:1006d00080cf5000090032000100fb00ffb09700fe
+:1006e000a3020700e10f400096023200afb097006e
+:1006f0008100e800a1b79f00920237009e40780079
+:10070000d0c2b30080cf50000c00320007003c0084
+:100710006d40500080cf50000a0032006b40400016
+:1007200080cf50000e003a000800370000c3b3002d
+:1007300080cf50000a003a00060037000d30a000bc
+:10074000050037000d00a000030037000d10a000c9
+:10075000010037000d20a0000e07e800e7ff37007a
+:100760000d18a300010032000d00a1000d38a300f8
+:10077000010032000d20a1000100fb0002fd2f004e
+:1007800002004000e90f50000e003e000002eb00a6
+:10079000c4b79f0082017800cfb297006a28b900e1
+:1007a0001e01fb000001410003014100c2b79f0090
+:1007b0005e00fb0003004000e90f50000b003e000c
+:1007c000f5ff37000006eb00ccb79f00a0c2b300d6
+:1007d00080cf500005003a000fb89700c0007800a5
+:1007e00080bf9f00c1b79f000e07e8000001eb002b
+:1007f000b2b79f00e0c2b3009e4f100018003a004d
+:100800000de0a0008e00e80064405000914f100001
+:1008100002003200010778000c0037000fba970081
+:10082000c402780084bf9f00b5b79f000e87e80020
+:100830000b0037003fb697006a60b9000000410026
+:1008400003004000b0b79f000e07e8001e01fb0048
+:1008500003fd2f0003004100e90f5000f5ff3600b3
+:10086000be407800e1d79f00c0c6b30080cf5000e3
+:10087000220032000f003c006940500080cf500041
+:100880007700320004003c000104e0003102320035
+:100890006b4050000f00370040c6b30080cf5000bf
+:1008a000930032006540400080cf50008b003a003a
+:1008b0008f00370030c7b30080cf50001a003200dd
+:1008c00007003c006440500080cf5000110032000f
+:1008d0000040e80080cf500080003a000f00370051
+:1008e00050c7b30080cf500080003200634040000a
+:1008f00080cf500079003a0009003700000028003e
+:100900000d48a30001003a00000120008086760017
+:10091000d3ff37000d60a000750037000d50a00018
+:100920000d70a000720037008fb89700410078006a
+:1009300081bf9f00000478000000e00001003a0041
+:1009400008f721008004eb00010037008104e80073
+:1009500089007800088044001004e000fbff3a00a2
+:100960003fb197000200e00003003200890f510000
+:1009700001003100820478000002eb00e4af9f0028
+:10098000cfb29700898f52000200360009805200d2
+:10099000e0af9f004368de00e10660001b003a0004
+:1009a0000d06780009003700ffb097000002200014
+:1009b000ef010700e10f4000030032002fb0970065
+:1009c0000000e800a0b79f000c06e800efa8970021
+:1009d000810f5600f4ff3a000081eb00e2af9f0068
+:1009e0000a003700880078003100fb00010478001d
+:1009f000ffb09700de010700e10f40000300320066
+:100a00002fb297000402e800a4b79f000900e90094
+:100a100080047800e10f4000f2ff3a000006eb008e
+:100a20000d00e0000a003a00c6013700ffb0970051
+:100a300000022000ce010700e10f40000300320059
+:100a4000afb297008502e800a5b79f000c06e8004a
+:100a50006fa89700800f5600f4ff3a00b9013700e5
+:100a60008fb897004100780081bf9f00cf80de00e3
+:100a700001017800820178000205be000004be007a
+:100a80000203be000002be004822de00482edd0048
+:100a900004027600e4d79f000d48a3000a0032004c
+:100aa0000404e00008003200e14f4200060032007a
+:100ab00071fd2f000180470004487800184098001d
+:100ac0002900200002003700f0d79f001900200005
+:100ad00072fd2f0002844700a1ff370064fd2f0044
+:100ae00004844700190020009dff37000d0cb3005f
+:100af0000d007800000cb20028003a000d00e00064
+:100b000005003d008fba97004505be004504be00b4
+:100b100085bf9f00140037000d48a3000b00320072
+:100b20000fbe97004c00be008cbf9f004f89de00b7
+:100b3000cf91de000002be0002037800820378003d
+:100b40000605be000404be00070037008fb89700fa
+:100b50004100780081bf9f0000047800cfc4de0010
+:100b6000090578008a057800e00f5400e08f5c00ea
+:100b7000e00f5d00e08f5d001f003d003d00b30011
+:100b80006000b8006011b800080450008984580063
+:100b90000a0559008b855900170037000d00e00049
+:100ba00005003d000fb997004205be004204be009b
+:100bb00082bf9f00100037000d48a30007003200dd
+:100bc0000fba97004400be0084bf9f006011b800b8
+:100bd0000205be000004be00070037008fba970070
+:100be0004500780085bf9f000004780009002000c0
+:100bf0000a0020000b0020003fb697000c00e00028
+:100c000007003a00e00f5400e08f5c00e00f5d0049
+:100c1000e08f5d0002003a0010002000b0b79f0096
+:100c20008d007800010cb200e1b79f0000042000a5
+:100c3000808f50003000320003003c000100e000d3
+:100c40000800320040003700000820006fb1970014
+:100c5000800f510014003200000c2000800f510062
+:100c600039003a0014c0b30005ed21000b00370035
+:100c70000400fb004300dd00050040005001be0001
+:100c80004000be000040e10001c8e10002d0e100e8
+:100c900003d8e1002b0039000442e800f44f520071
+:100ca000f3ff3a0027003700000120000100200078
+:100cb0006011b80014c0b3000040e10001c8e100b9
+:100cc00002d0e10003d8e1001e00390045002000f9
+:100cd0000000d0008180d2000281d2008381d20046
+:100ce0008502e900faff3a000442e800f04f5200a2
+:100cf000f1ff3a00130037008000200001002000bf
+:100d00006011b80014c0b3000040e10001c8e10068
+:100d100002d0e10003d8e1000a0039003c002000c5
+:100d20000000d0008180d2000281d2008381d200f5
+:100d30000c06e900faff3a000442e800f54f5200c1
+:100d4000f1ff3a00e4d79f00efd097000100fb00cd
+:100d50003fb19700820f500002003d00e2d79f0094
+:100d6000040037003fb29700800f520001003d00a1
+:100d7000b0b79f00cfb297000500e000040032003a
+:100d800063806600020032008502e900c5b79f005b
+:100d90000de8a3000b0032004fb697003fb097005c
+:100da000800f560003003c008000eb00c1b79f009d
+:100db000040037004fb197003fb297000401510083
+:100dc000c2b79f00efd297000500fb000006eb00c2
+:100dd000dcaf9f00cfb09700808f5000020034003e
+:100de00000805000d0af9f000d28a30037003200d4
+:100df000e18066000d18a3000c003200d002200034
+:100e00000100e00001003a000080e900ffb0970017
+:100e1000d7000700e10f40000e0032002fb197000d
+:100e20000201e800a2b79f000a0037000100e000bd
+:100e300008003200ffb0970000022000cc0007003d
+:100e4000e10f4000030032002fb297000402e800d7
+:100e5000a4b79f00dfaa97000500e0000f00320052
+:100e60000006eb00ffb0970000032000c000070061
+:100e7000e10f4000030032002fb097000000e800af
+:100e8000a0b79f000c06e800dfa89700810f56006e
+:100e9000f4ff3a000001eb00d2af9f003fb2970091
+:100ea000c320dd0080ec21008080400091b79f00ce
+:100eb0004220dd006400500080b79f006320b9002d
+:100ec000f0af9f006306500084003700dfaa970050
+:100ed0000500e00011003200688066000f003a0053
+:100ee00000067800ffb0970000022000a000070075
+:100ef000e10f4000030032002fb097000000e8002f
+:100f0000a0b79f000c06e800dfa89700810f5600ed
+:100f1000f4ff3a000001eb00d2af9f00e1806600d1
+:100f20000d18a3000c003200d00220000100e000e8
+:100f300001003a000080e900ffb097008c00070034
+:100f4000e10f4000d5ff32002fb297000402e80005
+:100f5000a4b79f00d1ff37000100e000cfff3200af
+:100f6000ffb097000002200081000700e10f400061
+:100f7000caff3200afb297008502e800a5b79f0014
+:100f8000c6ff370000042000efb09700808f5000ac
+:100f90003100320003003c000100e0000800320094
+:100fa0003e003700000820006fb19700800f51000d
+:100fb00011003200000c2000800f510037003a0071
+:100fc0001fb097003002be002003be000800be0024
+:100fd0000a01be00d1010700a40020000500200086
+:100fe0006033b800d401070004c3b30004424000da
+:100ff000e4d79f002900370075f72100d5b79f007f
+:101000000d58a30002003a0080f82100d0b79f00dd
+:1010100014002000050020006033b8008fb0970056
+:101020008100e900050033000402d0008582d2006f
+:101030000683d2008783d200f9ff37000800be0084
+:101040000a01be00b50107006f0060005fb19700a4
+:1010500062407800100037001400200005002000d6
+:101060006033b8000c0078000000e9000500330090
+:101070000402d0008582d2000683d2008783d2008a
+:10108000f9ff37000800be000a01be00a3010700f7
+:10109000674060000043b000e0d79f00efd09700aa
+:1010a0000100fb00ffb0970031000700e10f400096
+:1010b000030032002fb197000201e800a2b79f00a1
+:1010c0001fb297006802520094b79f008fb297003a
+:1010d000e482520085b79f0063065600d0ff2f00c0
+:1010e0003fb197000090b9007faa9700000042002e
+:1010f00063005000800f5600a2ff3a000d38a30095
+:1011000010003200dfaa97000500e0000d00340057
+:101110000006eb00ffb0970000022000140007005b
+:10112000e10f4000030032002fb097000000e800fc
+:10113000a0b79f000c06e800dfa89700810f5600bb
+:10114000f4ff3a00be407800e1d79f000104e000c0
+:101150005dfd3a002fb097004f0778004f06be00a4
+:101160004f05be004f04be00ef01b10000000600b5
+:10117000889fbe000001780001047800b100900053
+:101180000118a300400032000198a30003003a00b8
+:10119000180090000000e0003b003a000190a00021
+:1011a0003104980082047800f90fb2001800900012
+:1011b0000000e00002003a0028009000000c7800d7
+:1011c000ea8f540006003a00380090000078a3002f
+:1011d00003003a0088007800d0002000e4ff0700f8
+:1011e000180290006121b90058009000e8009000ba
+:1011f000800f5100818f59000b0032000400e8007d
+:10120000100498001800780009587800000c780045
+:1012100011c0b30040fc210001487800ea8f54005f
+:101220000600320019003700880078000940780075
+:10123000190007008004780014003700380090007f
+:101240000088a3001100320018019000a80090004f
+:10125000480090005300070098009000810f500054
+:1012600004003200380090000003b30030049800fe
+:101270008084eb000000eb00100498002800900030
+:10128000000c7800010037008084eb000900780032
+:101290004f04be00000006000200fa00889fbe0056
+:1012a000a0ff9f0001047800b10090008104780045
+:1012b0000904b200020032000000fb0036003700d3
+:1012c0000118a30005003a000103b300310498009f
+:1012d000190498000080eb002f00370058009000a0
+:1012e0000000e00006003a004800900012002000d4
+:1012f000e68057002b0007001904980024003700ef
+:10130000280090000000e00008003a0000fc2100e6
+:1013100020049800000c7800200020005004980061
+:10132000100498000130a0003104980018019000ca
+:10133000a8009000480090001a00070028009000c4
+:10134000000c78000080eb00100498001800780072
+:10135000aff8970001587800000c78002ff897003c
+:10136000ea4f50000a003a00380090000088a300bd
+:101370000700320018019000a8009000480090007b
+:101380000800070019049800a8009000010c7800dc
+:10139000aff897000100fb004f04be000080fa0088
+:1013a000000006000a00fa0080017800e20f5000f9
+:1013b00028003e0030fe8000e10f5000080032009f
+:1013c000802320000000e0000500320004232000fc
+:1013d00025232000462320008001780004003700e8
+:1013e0000422200025222000462220008322200003
+:1013f000144090000004e000040035008009eb0078
+:10140000144090000074a000104298001540900015
+:101410000028a30003003a00154090000024a0001b
+:10142000904298008001eb000700370015409000c3
+:101430000008a300fdff320063c078000000fb003d
+:10144000000b78008301e800828f5100f7ff3a001b
+:101450000800370030002000b0bf9f00c3bf9f00ce
+:10146000d1bf9f00e2bf9f006a80570000c0da0032
+:101470006fb99700020078000080fa0000000600b3
+:10148000881f7800000478005001be004000be00b4
+:10149000040040008580480006014900878149001a
+:1014a000009cbe000294be000400e1000588e1003b
+:1014b0000690e1000798e100020031006800440056
+:1014c0001008e8004f04780000000600f487470089
+:1014d000889fbe008a9fbe008c9fbe008e1f780032
+:1014e0000205be000004be00d4b79f00e5b79f0010
+:1014f000f6b79f0087bf9f000000eb00c0b79f00ba
+:10150000b0b79f00a0b79f0090b79f0080b79f0023
+:101510000d042000bfb097004fb0970000014000bd
+:101520000000e0000f003d004f08de0000007100e9
+:10153000c0b79f004d00070001003d0012002000d1
+:101540005000070001003d00120020005500070078
+:1015500061000700660007000f004000c8ff070099
+:10156000220037004f08de0000067100ccb79f0054
+:101570003e00070001003d0012002000410007006e
+:1015800001003d0012002000460007005200070045
+:101590000fb297009fb297002fb39700bfb3970089
+:1015a000590007000000520081805a0002015b00d0
+:1015b00083815b0080b79f0091b79f00a2b79f0017
+:1015c000b3b79f000007eb004f0007000020e100c9
+:1015d00001a8e10002b0e10003b8e1000100310020
+:1015e0001e0020000e005600c0b79f004fb29700ab
+:1015f0000400e0000700350010002000010020007a
+:101600006011b80008047000898470000a05710038
+:101610008b8571008d06e900beff3a000400e000f2
+:1016200003003d00320007000f00400094ff070058
+:101630004fa897000000e00004003a000fb49700a4
+:101640009fb497002fb59700bfb597000800be0064
+:101650000a01be004f0778004f06be004f05be00ce
+:101660004f04be004f01b1000000060001804000a1
+:1016700090b79f000001eb008fb097000100e000e1
+:10168000000006000200700090b79f00018040003b
+:1016900080b79f000001eb00ffa897000100e00069
+:1016a000000006000200700080b79f00018040002b
+:1016b0006faa9700cf20de0001007000f0af9f00fe
+:1016c000040242000800be000a01be004f18de00fe
+:1016d0000002720000000600e4af9f00080444000e
+:1016e00089844c000a054d008b854d0000000600e2
+:1016f0003fb29700cfb297005fb39700efb3970068
+:1017000000fe2f00000006003fb09700cfb097000a
+:101710005fb19700efb1970000000600881f7800c6
+:1017200018002000881f780068ff07008f87e900f5
+:101730004f04780000000600801feb0063ff0700e5
+:101740008f87e90000000600889fbe008a9fbe00c8
+:101750008c1f78000205be000004be00e00f5000a0
+:10176000e08f5800e00f5900e08f59000c003d0059
+:101770006000b8006011b800080450008984580067
+:101780000a0559008b8559001c0020001f00070026
+:1017900008003d00180007000006eb0005003700b8
+:1017a0000006eb001900070002003d000f000700d3
+:1017b0001c0020000800be000a01be00d7ff070081
+:1017c0000203be000002be000c00e0000100320077
+:1017d000060007000400be000601be004f067800a8
+:1017e0004f05be004f04be00000006006000b800b8
+:1017f0006011b800000037000402500085825800d4
+:10180000060359008783590000000600e00f5200cc
+:10181000e08f5a00e00f5b00e08f5b0000000600e5
+:10182000889fbe008a9fbe008c1f78000205be0004
+:101830000004be00e00f5000e08f5800e00f590098
+:10184000e08f59000a003d006000b8006011b80048
+:1018500008045000898458000a0559008b855900f6
+:101860001c0020001800070007003d00050037009d
+:101870000006eb001400070003003d006000b80004
+:101880006011b800150007000800be000a01be0084
+:10189000a9ff07000203be000002be000c00e0002a
+:1018a000030032006000b8006011b8000b000700b0
+:1018b0000400be000601be004f0678004f05be00c2
+:1018c0004f04be0000000600e00f5200e08f5a00f7
+:1018d000e00f5b00e08f5b00000006000402500098
+:1018e00085825800060359008783590000000600ce
+:020000040000fa
+:020000040001f9
+:0457fc007f3e0000ec
+:020000040000fa
+:1000080090020000900200009002000090020000a0
+:100018009002000090020000900200009002000090
+:100028009002000090020000900200009002000080
+:100038009002000090020000900200009002000070
+:100048009002000090020000500f000016160000f9
+:100058009002000090020000900200009002000050
+:100068009002000090020000900200009002000040
+:10007800fa0e0000900200009002000090020000ba
+:100088009002000090020000900200009002000020
+:100098009002000090020000900200009002000010
+:1000a800900200004810000090020000900200003a
+:1000b80090020000900200009002000090020000f0
+:1000c80090020000900200009002000090020000e0
+:1000d80090020000900200009002000090020000d0
+:1000e80090020000900200009002000090020000c0
+:1000f80090020000900200009002000090020000b0
+:10010800900200009002000090020000900200009f
+:10011800900200009002000090020000900200008f
+:10012800900200009002000090020000900200007f
+:10013800900200009002000090020000900200006f
+:10014800900200009002000090020000900200005f
+:10015800900200009002000090020000900200004f
+:10016800900200009002000090020000900200003f
+:10017800900200009002000090020000900200002f
+:10018800900200009002000090020000900200001f
+:10019800900200009002000090020000900200000f
+:1001a80090020000900200009002000090020000ff
+:1001b80090020000900200009002000090020000ef
+:1001c80090020000900200009002000090020000df
+:1001d80090020000900200009002000090020000cf
+:1001e80090020000900200009002000090020000bf
+:0801f8009002000090020000db
+:020000040000fa
+:10020800900200009002000090020000900200009e
+:10021800900200009002000090020000900200008e
+:10022800900200009002000090020000900200007e
+:10023800900200009002000090020000900200006e
+:100248009002000090020000500f000016160000f7
+:10025800900200009002000090020000900200004e
+:10026800900200009002000090020000900200003e
+:10027800fa0e0000900200009002000090020000b8
+:10028800900200009002000090020000900200001e
+:10029800900200009002000090020000900200000e
+:1002a8009002000048100000900200009002000038
+:1002b80090020000900200009002000090020000ee
+:1002c80090020000900200009002000090020000de
+:1002d80090020000900200009002000090020000ce
+:1002e80090020000900200009002000090020000be
+:1002f80090020000900200009002000090020000ae
+:10030800900200009002000090020000900200009d
+:10031800900200009002000090020000900200008d
+:10032800900200009002000090020000900200007d
+:10033800900200009002000090020000900200006d
+:10034800900200009002000090020000900200005d
+:10035800900200009002000090020000900200004d
+:10036800900200009002000090020000900200003d
+:10037800900200009002000090020000900200002d
+:10038800900200009002000090020000900200001d
+:10039800900200009002000090020000900200000d
+:1003a80090020000900200009002000090020000fd
+:1003b80090020000900200009002000090020000ed
+:1003c80090020000900200009002000090020000dd
+:1003d80090020000900200009002000090020000cd
+:1003e80090020000900200009002000090020000bd
+:0803f8009002000090020000d9
+:020000040000fa
+:1018f000434c000041530000533d000025300000e0
+:101900003258000020490000443d0000253000000e
+:1019100032580000204c0000454e00003d250000dc
+:10192000640d00000a000000535400004152000002
+:10193000540d00000a000000535400004152000002
+:10194000542000006465000062750000670d00000f
+:101950000a00000052500000494e000052320000c0
+:10196000303d000025300000345800000d0a000012
+:101970000053000050490000314300004f4e00006a
+:10198000313d000025300000345800000d0a0000f1
+:101990000053000050490000314300004f4e00004a
+:1019a000323d000025300000345800000d0a0000d0
+:1019b0000053000050490000315300005441000022
+:1019c000543d000025300000345800000d0a00008e
+:1019d0000000000025300000325800002000000008
+:1019e0000d0a000000410000434b00000d0a0000fa
+:1019f000004e0000414300004b0d00000a000000b3
+:020000040000fa
+:101a0000004378006312b9008180fb006009200068
+:101a10000088b900840040000682fb0040382000a6
+:101a200000a2b90084804000608020000080400057
+:101a300034c0b300335878000442e900fdff3a0097
+:101a4000000006000000fb007801b900e0d1210091
+:101a5000020040000b000900311878008001b1003d
+:101a60008101b100000006000401fa00881f78001f
+:101a7000e8f72f0008844700a0ef2f000f00400078
+:101a8000e40140000081e8008000e800a0ef2f00a2
+:101a90000f004000ee020700efb89600811f7800ab
+:101aa0001ff895000080fb00801f7800eff0950084
+:101ab0000180fb00801f780080c72800801f78000d
+:101ac00008007800defa0700080078001605070015
+:101ad000e8875700e8ff37000400fa0064815700e8
+:101ae0008000780031597800315978001149780028
+:101af000204090000004e00003003d0000c0eb0027
+:101b0000f0ff9f00020037000040eb00f0ff9f0055
+:101b10006fb89700ffb897000080fa000000060039
+:101b20002000fa00881f7800103a8000f00bb20005
+:101b30007205200061042000237420008149780090
+:101b40008249780080497800a4c6bf0001ceb30066
+:101b5000014060006040b300a4e6b700c5c6bf0006
+:101b6000014060003040b300c5e6b700a6c6bf0024
+:101b7000014060005041b300a6e6b700d4c6bf00e4
+:101b8000014060005040b300d4e6b700d9c6bf00a2
+:101b900001406000d9e6b700acc6bf00014060005c
+:101ba000d040b300ace6b700adc6bf000140600056
+:101bb0007041b300ade6b700aec6bf0001406000a3
+:101bc0008041b300aee6b700d6c6bf00014060005a
+:101bd000a040b300d6e6b700a8c6bf000140600031
+:101be0002041b300a8e6b700d0c6bf0001406000a6
+:101bf0000034a000d0e6b700d1c6bf0001406000ad
+:101c00007040b300d1e6b7000001eb000216880077
+:101c1000000c230040168800401a2000801688001f
+:101c2000223a88002ca3ef0081c6bf00014060006b
+:101c3000c040b30081e6b700aec0bf0088cfb3009c
+:101c4000084060000024a000aee0b7008220a80099
+:101c50000001fd0000e8b7000001fd00fb020700e5
+:101c6000920120000140200000802800400407006d
+:101c7000920120000140200000802800430407005a
+:101c80007b0407008604070040c92800a60407005b
+:101c9000c0c9280060fa070040358000801f780026
+:101ca000a3ca2800831f7800a0fd2f000f0040006a
+:101cb00063fa0700a0fd2f000f0040009a04070000
+:101cc00010128000801f780093cb2800831f7800bb
+:101cd00060fd2f000f00400059fa070060fd2f0043
+:101ce0000f0040009004070020128000801f780041
+:101cf00093cc2800831f780020fd2f000f004000a8
+:101d00004ffa070020fd2f000f0040008604070057
+:101d100000128000801f780093cd2800831f780078
+:101d2000e0fc2f000f00400045fa0700e0fc2f0008
+:101d30000f0040007c0407009560a800a9c0bf0008
+:101d4000f1c8b3000140600001c4b300014070005d
+:101d5000a9e0b70042c0bf007f40600001407000b2
+:101d600042e0b700ff0307000058220001002000f6
+:101d70006001070080020700fa030700ba010700ac
+:101d80007d020700a30107007b020700cb42a800e9
+:101d9000100020000100200055040700cb62a900bc
+:101da000100020000100200051040700a7020700d6
+:101db000b302070000a82100610020004c040700c6
+:101dc00087020700d102070002030700f3030700a0
+:101dd0008540a900a9c0bf00084060000024a00001
+:101de000a9e0b7009680a800f08757001eff070003
+:101df000feff37003600f800809fbe00829fbe00c5
+:101e0000849fbe00869fbe003400f80000002000c2
+:101e1000a00188008680a900cbc2bf00704060008e
+:101e200018003a00aefdb70010c0b30001e8b700db
+:101e30000048e2000c003a00b03def00b23def0078
+:101e4000b43def00b63def00b83def00ba3def0006
+:101e5000bc3def00be3def00c03def00c23def00d6
+:101e6000c43def00c63def00aeddbf0063020700da
+:101e700040c2a900401280008540a9009540a800fa
+:101e80004822ef003400f9004f03be004f02be00ad
+:101e90004f01be004f00be003600f90000400600b2
+:101ea0003600f800809fbe00829fbe00849fbe0067
+:101eb000869fbe00889fbe008a9fbe003400f80047
+:101ec00000002000a00188000400fa0041128000f8
+:101ed0000144780040c2a90001c8bf00e24f500091
+:101ee0000a003200e34f50000e003200e14f500074
+:101ef0005b003a000100780004e8b70020c0b3009e
+:101f000001e8b7004822ef005700370001007800d1
+:101f100003e8b70030c0b30001e8b7004822ef0083
+:101f200051003700490207000800780002e8b700b6
+:101f300020802000e8fe0700e0bf9f00f1bf9f0067
+:101f40000a8020001a4578000a05fb00e8da210023
+:101f500018447800a403070080407800648157008b
+:101f60006355b9000884fb006009200000c4b90073
+:101f70000a0444008180fb00403820000088b9003a
+:101f800000044400608020000000440031c0b30021
+:101f9000325878008140e900fdff3a00e1da210083
+:101fa000914078000100fb004200dd0002db2100cf
+:101fb000020040006fba9700ffba97001008420075
+:101fc00050904a000140e800aefdb700e54f5000d8
+:101fd0001e0034000048ec008040780000e8b700a4
+:101fe00010c3b30080cf5000150034000204780005
+:101ff0000105fb00cfd5de0089dc21000a01be000f
+:102000001800be0048f90700009cbe00888f5400ed
+:10201000faff3a00740307000000fb007801b900e2
+:10202000e0d121000200400001db21000b0009008b
+:10203000311878008001b1006e0307000068ef00de
+:102040009540a9000168ef0007003700eb01070089
+:102050004822ef0010c0b30001e8b70002003700cb
+:102060009540a9000168ef000080fa003400f900f3
+:102070004f05be004f04be004f03be004f02be001e
+:102080004f01be004f00be003600f90000400600c0
+:10209000809fbe00829fbe00849fbe003400f80077
+:1020a00000002000a001880072f68000538020000c
+:1020b0009341780044c2b3001200370060c2bf00f1
+:1020c00005c2b3008540600005003a00401380005f
+:1020d000844f500002003a00320020008141780015
+:1020e00060c2bf000018a30006003a000200e00032
+:1020f000040032000380fb00401388008341e800a5
+:102100000201e90060c2bf000058a300ebff3200eb
+:1021100072f688000300780005e8b70060c2bf00cf
+:102120000068a3000100320060c2a9003400f90079
+:102130004f02be004f01be004f00be00004006002f
+:10214000881f78000004eb0000902000d1032000dd
+:102150006703070008407800a80107000804e800aa
+:10216000ef0f5400f8ff34000004eb00f6ff3700d7
+:1021700040138000d322a80000a8210061002000a5
+:102180005b030700d322a90000e82e0061032000b2
+:1021900057030700f7ff3700000278000040eb000c
+:1021a0000049780080497800e4804000090032004e
+:1021b0008482e8000002eb001243780035404300bf
+:1021c00000497800934940000402e800810f520062
+:1021d000f9ff3a00000006000200fa00889fbe00e6
+:1021e000820478000404780052cbb300024a7800dd
+:1021f00022c6b30012429800204298003142980053
+:10220000494298004848de0050429800660042006b
+:102210000901780083007800e2f80700e5815700a3
+:10222000668157000800be00dbff07000904440078
+:102230002ff89700604498003ff89700704498008a
+:10224000688044004f04be000080fa0000000600d1
+:102250001000fa00889fbe008a1f780000057800f1
+:10226000810478000100e0000e0032000004eb0061
+:102270006a407c000080fb00801f7800a0ce280010
+:10228000801f78007a805700edf807007a805700a9
+:10229000250307000804e800e4875700890f54006d
+:1022a000f3ff390000cf28001f0307004f05780017
+:1022b0004f04be000080fa00000006008001780094
+:1022c0000100e0000a0032000001eb0023c2bf0061
+:1022d0000018a300fdff3a00634079000080fb0076
+:1022e000201188000201e800828f5000f7ff3a00b9
+:1022f000000006002000fa00881f78000003be00de
+:102300000f047800f68747008801780012c0b300f8
+:10231000024c78008040eb00114498002144980062
+:102320003144980000cdb3004044980080c0b30011
+:10233000504498006144980071449800064c9800fd
+:102340004838dd004832de0004027000c83ade0082
+:10235000144c9800403ade0005002000244c980000
+:10236000483bde00364c9800424c9800514c980097
+:10237000624c9800714c98000154980011549800d8
+:1023800021549800315498000e0278004201200038
+:1023900060c0b30090ff0700800078000e00780056
+:1023a000c6ff0700880778004f0478000080fa0015
+:1023b000000006002000fa00881f78000f04780053
+:1023c000e687470088017800004ceb0030c2b3007c
+:1023d0001044980000c0eb002044980020c0b300d7
+:1023e000304498000e0278004200200071c1b30012
+:1023f00060c0b30078ff0700800078000e0078000e
+:10240000aeff0700880778004f0478000080fa00cc
+:10241000000006002000fa00881f78000f047800f2
+:10242000e48747008801780011c0b300014c7800b0
+:1024300010c2b30010449800214498000e027800a6
+:102440003200200060c0b30063ff07008000780006
+:102450000e00780099ff0700880778004f04780085
+:102460000080fa00000006004000fa00889fbe00cd
+:102470008a1f78000f0578002f02b00009022000a3
+:10248000090178008000eb000a0078004cf8070092
+:1024900010c0b300004d780020c3b3004045980041
+:1024a0000040eb00004d980001c8b300114d9800aa
+:1024b00002c7b300224d9800304d9800404d98005f
+:1024c000514d9800624d9800704d9800005598004d
+:1024d00010559800205598003155980040559800a7
+:1024e000505598006055980071559800f0ceb30093
+:1024f000405d98000e0278008a017800090178009a
+:1025000011c3b30060c0b30033ff07008000780040
+:102510000e00780069ff07008a0778004f057800f1
+:102520004f04be000080fa00000006004000fa00e0
+:10253000889fbe008a1f78000f0578002f02b00028
+:1025400009022000090178008000eb000a007800f1
+:102550001bf807008040eb00014d780020c3b3005a
+:102560004045980003c4b300034d980022c4b30053
+:10257000124d9800f0c0b300204d9800314d9800e6
+:10258000434d9800524d9800604d9800714d980051
+:102590000155980011559800215598003155980023
+:1025a000715598004155980050c3b300505598009c
+:1025b000c0c0b3006055980070cfb300405d980074
+:1025c0000e0278008a0178000901780011c3b30077
+:1025d00060c0b30000ff0700800078000e007800a4
+:1025e00036ff07008a0778004f0578004f04be00c9
+:1025f0000080fa00000006001000fa00889fbe006c
+:102600000004eb00793e2000bf0107000000e0005d
+:10261000fdff3200c5010700801f7800a0ce280012
+:10262000801f78007880570005f8070078805700f1
+:102630003d0207000804e800e4875700890f5400b2
+:10264000f1ff36004f04be000080fa0000000600d3
+:10265000889fbe008a9fbe008c9fbe000006be0001
+:1026600082047800830578000044eb000100370005
+:1026700018c0b300a40107000000e000fdff320015
+:10268000aa01070080007800e44f540026003200c1
+:102690000b003c00e14f54001800320003003c00e6
+:1026a0000804e00010003200f2ff3700e24f54004f
+:1026b00017003200e34f5400eeff3a0017003700d6
+:1026c000e64f5400200032001a003500e74f540056
+:1026d00003003200e84f5400e6ff3a0021003700c3
+:1026e00088c0b300e3ff37000044eb00500b20002c
+:1026f000808f5000dfff3a00ddff370028c0b300b5
+:1027000020062000808f5000daff3200d8ff37000b
+:10271000004e780038c0b300d6ff3700804e7800f6
+:1027200048c0b300d3ff3700800c780058c0b30016
+:10273000d0ff37004800dd00990c400068c0b300ae
+:102740000005eb00cbff370000f57d000a05e8002f
+:1027500078c0b300990f5500c6ff310068c0b300c0
+:10276000c4ff37000000eb004f06be004f05be005f
+:102770004f04be00000006008400fa00c0f72f00de
+:102780000f004000e40140000081e8008000e80004
+:10279000c0f72f000f004000adff07004ff8960074
+:1027a000e54f5000f5ff3a005ff89600e14f50000a
+:1027b00004003a0030cf2800db01070010002000a1
+:1027c000050037000004e000ecff3a0090cf28003d
+:1027d000d50107000000eb000080fa0000000600b1
+:1027e00000000000c2e2a90000000000c302a9002e
+:1027f00000000000c322a900000006000101200023
+:102800000080fb000000e800808f500002003a00ca
+:10281000c322a90001003700c322a8000000000065
+:10282000c302a800c302a9008100e900f6ff3a0034
+:1028300000000000c2e2a80000000000c322a900be
+:1028400000000000c2e2a90000000600c322a800a8
+:1028500000c1b300c302a800c302a9000040e90000
+:10286000fcff3a0000000000c2e2a80000000000e7
+:10287000c322a90000000000c2e2a9000000060077
+:10288000cb42a80040002000010020009801070072
+:10289000cb42a90000fa20000100200094010700ab
+:1028a000cb42a80000000600cb62a8004000200038
+:1028b000010020008e010700cb62a9000000060085
+:1028c0008040780040c2bf000018a300fdff3a001e
+:1028d0000180fb00401288000000060040c2a900f1
+:1028e00040c2bf000018a300fdff3a004012800064
+:1028f0004822ef0040c2bf000008a300fdff3200e5
+:10290000401280000080fb0000000600881f780055
+:102910000004eb0008407800b8ff070010c1b300c6
+:10292000e7ff0700c9ff070008407800b3ff070072
+:1029300000c4b300e2ff070080c0b300e0ff07005f
+:1029400050c0b300deff070080c0b300dcff07000b
+:1029500020c2b300daff07000040eb00d8ff0700f9
+:102960000040eb00d6ff07000040eb00d4ff07005b
+:102970000040eb00d2ff07000040eb00d0ff070053
+:1029800000c4b300ceff0700b0ff07000804e80052
+:10299000e60f5400dfff3a00cb62a80010002000d1
+:1029a00001002000520107000004eb0008407800fd
+:1029b00092ff070000c1b300c1ff0700a3ff07009b
+:1029c0000804e800e60f5400f8ff3a004f047800ce
+:1029d00000000600889fbe008004eb0066c444002f
+:1029e0000840780085ff070010c4b300b4ff07005b
+:1029f00010c0b300b2ff070094ff070000fa2000e8
+:102a0000010020003a010700084078007bff070022
+:102a100000c4b300aaff070080c0b300a8ff0700ee
+:102a20008aff07000840780074ff070080c4b300e5
+:102a3000a3ff0700f0c3b300a1ff070083ff070057
+:102a4000084078006dff0700c0c4b3009cff07007a
+:102a500000c4b3009aff07007cff07008904e80068
+:102a6000e68f5400ddff3a004f04be000000060070
+:020000040000fa
+:102a700000080000c815000000000000ce1e000085
+:102a8000020000000200000000020000c81d00005b
+:102a90000201000000000000ca1e00000400000047
+:102aa000000000009a1f0000260000000200000045
+:102ab0009c1fc2001f000000c21f09000000000090
+:102ac0000200c0001f000000c01f0600020100003d
+:102ad00000000000000000000000060002020000ec
+:102ae00000000000c01f0000060000000000000001
+:102af000d01e0000a0000000020000000100000045
+:102b00000000000000000a000000000000000000bb
+:102b1000006400000000000000000000e803000066
+:102b2000000000000000100027000000000000006e
+:102b300000a08600010000000000000040420f00dd
+:102b400000000000000080009698000000000000d7
+:102b50000000e100f50500000000000000ca9a0036
+:102b60003b00000000000000e40b540002000000e5
+:102b70000000e80076481700000000000010a500e3
+:102b8000d4e8000000000000a0724e001809000008
+:102b9000000040007a10f3005a0000000080c600d8
+:102ba000a47e8d000300000000c16f00f2862300a8
+:102bb000000000008a5d78004563010000006400a9
+:102bc000a7b3b600e00d000000e889000423c700a9
+:102bd0008a000000701f00002a00000002000000b0
+:102be000286e75006c6c29000030310032333400df
+:102bf000353637003839410042434400454600002d
+:102c000030313200333435003637380039616200f4
+:102c10006364650066000000c61f0000020000003b
+:0c2c2000020000000100000000000000a5
+:020000040000fa
+:102c2c00809fbe00829fbe003400f8000000200090
+:102c3c00a00188008560a90022c2bf000008a30083
+:102c4c000c00320082dc210012417800a3dc210050
+:102c5c00301180008280fb0080f079000241e80096
+:102c6c0022c2bf000008a300f9ff3a00020078005e
+:102c7c00c8fdb70022c2bf000018a300010032003b
+:102c8c002222a9003400f9004f01be004f00be0003
+:102c9c000040060000017800904078000104e0003c
+:102cac000800320023c2bf000018a300fdff3a0049
+:102cbc000100fb0020118800d24078000104e000e4
+:102ccc00f8ff3a0000000600000178009040780000
+:102cdc000104e0000800320033c2bf000018a3005a
+:102cec00fdff3a000100fb00a0118800d2407800e3
+:102cfc000104e000f8ff3a00000006008040eb0001
+:102d0c00c8ddbf00c95de30001003a0011c0b3008b
+:102d1c00014078000004a2000080fb0000000600c7
+:102d2c0092dc2100124178008080eb00c8ddbf00ee
+:102d3c000014e100060032008280fb00a0dc2100c0
+:102d4c00614078008080fb000240e800c9fdb700bc
+:102d5c000100780000000600c8ddbf00c9fdb70007
+:102d6c000000060000118800111188004211880033
+:102d7c000040eb00c8fdb700c9fdb700000006001d
+:102d8c008011880091118800c21188000000060093
+:102d9c000040eb00cafeb700cbfeb70060c0b3002a
+:102dac00ccfeb70000000600cbdebf000080fb00ad
+:102dbc0000000600cbfeb70000000600cb5eec0066
+:102dcc00cbfeb700c1ec2100914078000104e1007a
+:102ddc0001003900cb7eef0000000600cadebf0008
+:102dec000080fb0000000600ca5eec00cafeb700c3
+:102dfc00c1ec2100914078000104e1000100390090
+:102e0c00ca7eef0000000600b1ec21009140780072
+:102e1c00a0ec210090c0100002003b00ccdebf00f3
+:102e2c0080c040000180fb0000000600881f780075
+:102e3c000004eb00f4ff07000080fb00c1ec210054
+:102e4c00914078008180fb008100e900810f5000e7
+:102e5c000100350018002000080078004f047800ad
+:102e6c00000006004022ef0001012000401280000b
+:102e7c008100e900fdff3a008540a900e023200015
+:102e8c00101288002112880040c2a90041e2a8005b
+:102e9c00000006006022ef000201200040138000b9
+:102eac000201e900fdff3a008820a90060c2bf00c2
+:102ebc0031ceb300014060000044a00060e2b700d6
+:102ecc000010200010138800221388006322a90030
+:102edc0062e2a80060c2a9006402a80061e2a80036
+:042eec0000000600dc
+:020000040000fa
+:102ef000f03fb1000180b10006003500ee0309008b
+:102f000000000000403fb1000180b100fbff3d0028
+:102f10001000b000203fb000020035000080090022
+:082f20000000000000000600a3
+:020000040000fa
+:082f28006aff0700000006002b
+:00000001FF
diff --git a/dist/default/production/ad2010.production.out b/dist/default/production/ad2010.production.out
new file mode 100755 (executable)
index 0000000..75a5b80
Binary files /dev/null and b/dist/default/production/ad2010.production.out differ
diff --git a/main.c b/main.c
new file mode 100644 (file)
index 0000000..ffd7ac5
--- /dev/null
+++ b/main.c
@@ -0,0 +1,489 @@
+/*
+ * File:   main.c
+ *
+ * Created on February 9, 2010, 10:53 AM
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <p24FJ64GA004.h>
+#include <libpic30.h>
+//#include <uart.h>
+#include <string.h>
+#include "myuart.h"
+#include "myspi.h"
+#include "debug_print.h"
+#include "ublox.h"
+#include "myad.h"
+#include "delay.h"
+#include "ring.h"
+
+_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2 )
+//_CONFIG2( FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_OFF & FNOSC_FRC)
+#pragma config FCKSM = CSDCMD, OSCIOFNC = ON, POSCMOD = OFF, FNOSC = FRC, FPBDIV = DIV_8
+
+//#define CPU_CLOCK        10000000                         // クロック[ Hz ]
+//#define CPU_PLL          8                                // PLL
+//#define CLOCK_FREQUENCY  ( ( CPU_CLOCK * CPU_PLL ) / 4 )  // 動作周波数[ Hz ]
+//#define FOSC 4000000L
+// UART2 Debug Port
+#define BAUDRATE2         9600L
+// UART1 GPS
+#define BAUDRATE1         9600L
+
+/*** ADBUF **************************************************/
+#define ADBUF_BYTE  3   // AD 1dataのbyte数
+
+// SPI外部送信用バッファ AD_SAMPLE[Hz]
+static char adbuf[RING_NUM][AD_CHNUM][ADBUF_BYTE*AD_SAMPLE];
+// 1sec平均値
+static long adbuf_1sec[RING_NUM][AD_CHNUM];
+
+inline void adbuf_write(unsigned char buf_no, unsigned char ch, int cnt, long *data)
+{
+    unsigned char    *ptr = (unsigned char*)data;
+    unsigned char   i;
+    for(i = 0; i < ADBUF_BYTE; i++) {
+        adbuf[buf_no][ch][ADBUF_BYTE*cnt + i] = *(ptr++);
+    }
+}
+inline void adbuf_1sec_write(char buf_no, long *data)
+{
+    memcpy(adbuf_1sec[buf_no], data, sizeof(long) * AD_CHNUM);
+/*    char ch;
+    for(ch = 0; ch < AD_CHNUM; ch++)
+        adbuf_1sec[buf_no][ch] = data[ch];
+*/
+}
+
+/*****************************************************/
+
+void test_ublox_rcv_mon(void)
+{
+    unsigned char class, id;
+    unsigned int    len;
+    unsigned char   payload[128];
+    char    sz[128];
+
+    while(1) {
+        ublox_rcv_pkt(&class, &id, &len, payload);
+        sprintf(sz, "CLASS=%02X ID=%02X LEN=%d\r\n", class, id, len);
+        PDEBUG(sz);
+    }
+}
+
+/*
+ * INT1 Int及びSPI1 IntでADのデータを取得する
+ */
+#define ADSTS_IDLE  0
+#define ADSTS_H 1
+#define ADSTS_M 2
+#define ADSTS_L 3
+
+
+static char adint_ch;   // 取得中のCH
+static char adint_cnt = 0;  // 0〜AD_SAMPLE-1
+static char adint_sts = ADSTS_IDLE;
+static long adint_add[AD_CHNUM];    // 1秒平均用加算
+
+/*
+ * 3byte binary -> signed long
+ * Litte Endian
+ */
+long byte3_to_long(unsigned char *in)
+{
+    long    out;
+    unsigned char    *ptr = (unsigned char*)&out;
+
+    memcpy(ptr, in, 3);
+//    ptr[0] = in[0];
+//    ptr[1] = in[1];
+//    ptr[2] = in[2];
+
+    if (in[2] & 0x80) {
+        ptr[3] = 0xFF;
+    } else {
+        ptr[3] = 0x00;
+    }
+    return out;
+}
+
+int main(int argc, char** argv) {
+    unsigned int i;
+    // UART2 DebugPort
+    const double Baudrate2 = ( double )FCY / ( 16 * BAUDRATE2 ) - 1;
+    // ボーレートの小数点以下を四捨五入する
+    unsigned int baudrate2 = ( unsigned int )( Baudrate2 + 0.5 );
+    // UART1 GPS
+    const double Baudrate1 = ( double )FCY / ( 16 * BAUDRATE1 ) - 1;
+    // ボーレートの小数点以下を四捨五入する
+    unsigned int baudrate1 = ( unsigned int )( Baudrate1 + 0.5 );
+    char    sz[32];
+
+    __builtin_write_OSCCONL(OSCCON & 0xbf); //clear the bit 6 of OSCCONL to unlock Pin Re-map
+
+    // UART1ピン割り当て
+    RPINR18bits.U1RXR = 6;     // UART1 RX to RP6
+    RPOR2bits.RP5R =  3;               // UART1 TX(3) to RP5
+    // UART2ピン割り当て
+    RPINR19bits.U2RXR = 21;    // UART2 RX to RP21
+    RPOR10bits.RP20R = 5;       // UART2 TX(5) to RP20
+    // PIC-RDYピン割り当て
+    RPOR12bits.RP25R = 0;       // RC9
+
+    // DataOut SPI2 pin config
+    RPINR22bits.SDI2R = 13;     // SPI2 RX to RP13
+    RPINR22bits.SCK2R = 23;     // SPI2 CLK to RP23
+    RPINR23bits.SS2R = 24;      // SPI2 SS to RP24
+    RPOR11bits.RP22R = 10;      // SPI1 SDO2(10) to RP22
+    // AD SPI1 pin config
+    RPINR20bits.SDI1R = 18;     // SPI1 RX to RP18
+    RPOR8bits.RP16R = 8;        // SPI1 SCK1(8) to RP16
+    RPOR8bits.RP17R = 7;        // SPI1 SDO1(7) to RP17
+    // TRISx 1=input 0=output
+    TRISA = 0x0000;             // PortA RA7,8,9 output
+    //        5432109876543210
+    TRISB = 0b0011000011000000; // PortB RB13(RP13),RB12,RB7,RB6(RP6) input
+    TRISC = 0x01A4;             // ポートC RC8(RP24),RC7(RP23),RC5(RP21),RC2(RP18) input
+    CLKDIV = 0;                 // CPU Peripheral Clock Ratio=1:1
+    AD1PCFG = 0xFFFF;           // AN1-12input pin = Digital mode
+
+    // INT1(RP12 RB12) AD DRDY0 Int enable
+    RPINR0bits.INT1R = 12;  // RP12(RB12)
+    IPC5bits.INT1IP = 4;    // Int1 priority
+    INTCON2bits.INT1EP = 1; // Negative Edge
+//    ad_drdy0_intf_clear();
+
+    adint_cnt = 0;
+    ad_cs_dis();
+    // GPS UART1初期設定 BRGH=Standard mode
+    // 9600bps 8bit nonparity 1stop nonflowcnt.
+    //                           5432109876543210
+    unsigned int U1MODEvalue = 0b1000100000000000;
+    unsigned int U1STAvalue =  0b0000010000000000;
+//    OpenUART1( U1MODEvalue, U1STAvalue, baudrate1);
+    uart1_init( U1MODEvalue, U1STAvalue, baudrate1);
+    // DEBUG UART2初期設定 BRGH=Standard mode
+    // 9600bps 8bit nonparity 1stop nonflowcnt.
+    //                           5432109876543210
+    unsigned int U2MODEvalue = 0b1000100000000000;
+    unsigned int U2STAvalue =  0b0000010000000000;
+    uart2_init( U2MODEvalue, U2STAvalue, baudrate2);
+
+
+    spi1_init();
+    spi2_init();
+
+    PDEBUG("START\r\n");
+    puts("START debug\r\n");
+    sprintf(sz, "RPINR20=%04X\r\n", RPINR20);
+    PDEBUG(sz);
+    sprintf(sz, "SPI1CON1=%04X\r\n", SPI1CON1);
+    PDEBUG(sz);
+    sprintf(sz, "SPI1CON2=%04X\r\n", SPI1CON2);
+    PDEBUG(sz);
+    sprintf(sz, "SPI1STAT=%04X\r\n", SPI1STAT);
+    PDEBUG(sz);
+
+    // GPS UART1 受信割り込み許可
+    uart1_rx_int_enable();
+    uart1_set_int_level(4);  // 割り込みレベル デフォルト4
+    // DataOut SPI2 割り込み許可
+//    spi2_int_enable();
+//    spi2_set_int_level(4);
+
+    // 割り込み許可
+    // CPU割り込み優先レベル デフォルト2 ペリフェラルはデフォルト4
+    SRbits.IPL = 2;
+
+    // UBXプロトコルのみにする
+    ublox_rcvbuf_clear();
+    ublox_send_cfg_prt(BAUDRATE1);
+    ublox_rcv_ack();
+    // TimePulse2にAD用クロック出力する
+    ublox_rcvbuf_clear();
+    ublox_send_cfg_tp5_timepulse2();
+    ublox_rcv_ack();
+    // NAV-TIMEUTC出力させる
+    ublox_send_cfg_msg();
+    ublox_rcv_ack();
+
+    // AD初期化
+    ad_reset_dis();
+    ad_start_dis();
+    ad_cs_dis();
+    //
+    ad_reset(); // -AD RESET
+    // WAIT 2^16 AD system clocks
+    delay_ms(100);
+    //
+    ad_cs_init();
+    ad_init();
+    pga_init();
+    
+    ring_init();
+    // AD SPI1 割り込み設定のみ 許可しない
+    spi1_intf_clear();
+    spi1_set_int_level(4);
+
+    // INT1割り込み許可
+    IEC1bits.INT1IE = 1;    // Int enable
+
+    while(1) {
+        test_ublox_rcv_mon();
+    }
+    i = 0;
+    while(1) {
+        if (ring_read_get() != ring_write_get()) {
+            char ch;
+            for(ch=0; ch<AD_CHNUM; ch++) {
+                sprintf(sz, "%+7ld,", adbuf_1sec[ring_read_get()][ch]);
+                PDEBUG(sz);
+            }
+            PDEBUG("\r\n");
+
+            ring_read_plus();
+        }
+    }
+    
+    return (EXIT_SUCCESS);
+}
+
+/*
+ * INT1(RP12) AD DRDY0割り込みハンドラ
+ * Negativ Edge
+ */
+void _ISR _INT1Interrupt(void)
+{
+    IFS1bits.INT1IF = 0;
+    if (!ad_is_drdy0_enable()) {
+        return;
+    }
+//    ad_drdy0_intf_set();
+
+    adint_ch = 0;
+    adint_sts = ADSTS_H;
+    if (adint_cnt == 0) {
+        memset(adint_add, 0, sizeof(adint_add));
+    }
+
+    ad_cs(adint_ch);    // CSx=L
+    spi1_rx_overrun_clear();
+    // 前に受信したデータをクリア
+    spi1_getc();
+    // SPI割り込みON
+    spi1_intf_clear();
+    spi1_int_enable();
+    // 送信
+    spi1_putc(0);
+}
+/*
+ * AD SPI1 Interrupt Handler
+ */
+void _ISR _SPI1Interrupt(void)
+{
+    static unsigned char in[3];
+    unsigned char c;
+    long    l;
+
+    c = spi1_getc();
+//    spi1_intf_clear();
+    spi1_rx_overrun_clear();
+//spi1_int_disable();
+//ad_cs_dis();
+//return;
+//c=1;
+    switch(adint_sts) {
+        case ADSTS_H:
+            in[2] = c;
+            adint_sts = ADSTS_M;
+            spi1_putc(0);
+            break;
+        case ADSTS_M:
+            in[1] = c;
+            adint_sts = ADSTS_L;
+            spi1_putc(0);
+            break;
+        case ADSTS_L:
+            // CSx=H
+            ad_cs_dis();
+            in[0] = c;
+            l = byte3_to_long(in);
+            // バッファに書きこみ
+            adbuf_write(ring_write_get(), adint_ch, adint_cnt, &l);
+            // 平均用加算
+            adint_add[adint_ch] += l;
+            // CH進める
+            adint_ch++;
+            if (adint_ch >= AD_CHNUM) {
+                // 全CHデータgetした
+                adint_cnt++;
+                if (adint_cnt >= AD_SAMPLE) {
+                    // 1secぶんのデータgetした
+                    // 平均してバッファに書きこみ
+                    char ch;
+                    for(ch = 0; ch < AD_CHNUM; ch++) {
+                        adint_add[ch] /= adint_cnt;
+                    }
+                    // バッファに書きこみ
+                    adbuf_1sec_write(ring_write_get(), adint_add);
+                    // バッファ書き込み位置+1
+                    ring_write_plus();
+                    adint_cnt = 0;
+                }
+                spi1_int_disable(); // SPI割り込みOFF
+                adint_sts = ADSTS_IDLE;
+            } else {
+                // 次のCHへ
+                ad_cs(adint_ch);    // CSx=L
+                // 送信
+                spi1_putc(0);
+                adint_sts = ADSTS_H;
+            }
+
+            break;
+        default:
+            spi1_int_disable(); // SPI割り込みOFF
+            adint_sts = ADSTS_IDLE;
+            break;
+    }
+
+}
+
+/*
+ * DataOut SPI2 Interrupt Handler
+ * TX FIFOに1byteの空きが出来ると発生
+ */
+void _ISR _SPI2Interrupt(void)
+{
+static unsigned char   spi2c;
+    unsigned char   rx;
+    static unsigned int txlen = 512;
+/*
+    while(!spi2_tx_fifo_is_full())
+        spi2_putc(c++);
+    while(!spi2_rx_fifo_is_empty()) {
+        rx = spi2_getc();
+        if (rx == '$') c = 0;
+    }
+*/
+//spi2c = 123;
+// RX FIFOから読み出し
+//    while(!spi2_rx_fifo_is_empty() || (!spi2_tx_fifo_is_full() && txlen > 0)) {
+    while(!spi2_rx_fifo_is_empty()) {
+        if (!spi2_rx_fifo_is_empty()) {
+            rx = spi2_getc();
+            if (rx == '$') {
+                spi2c = 0;
+                txlen = 3;
+            }
+        }
+        // TX FIFOに書き込み
+        if (!spi2_tx_fifo_is_full()) {
+            if (txlen > 0) {
+                spi2_putc(spi2c++);
+                txlen--;
+            }
+        }
+    }
+    // オーバーランエラーならばクリアする
+    // spi2_rx_is_overrun()
+    if (SPI2STATbits.SPIROV == 1) SPI2STATbits.SPIROV = 0;
+
+    // TODO:Interrupt Flag@IEC Clear
+}
+/*
+void test_ad1()
+{
+        unsigned char in[3];
+        long l[6];
+        char cs;
+        while(!ad_is_drdy0_enable());
+//        PDEBUG("AD\r\n");
+        for(cs=0; cs<6; cs++) {
+            ad_cs(cs);
+                in[2] = ad_spi_rcv();
+                in[1] = ad_spi_rcv();
+                in[0] = ad_spi_rcv();
+            ad_cs_dis();
+            l[cs] = byte3_to_long(in);
+//            sprintf(sz, "%02X %02X %02X", in[2], in[1], in[0]);
+//            PDEBUG(sz);
+        }
+        for(cs=0; cs<6; cs++) {
+            sprintf(sz, "%+7ld,", l[cs]);
+            PDEBUG(sz);
+        }
+        PDEBUG("\r\n");
+
+}
+ */
+/*
+ * CS0〜15順番にenable
+ */
+void test_ad_cs()
+{
+    int i;
+    
+    while(1) {
+        delay_ms(1000);
+        ad_cs(i);
+        i++;
+        if (i >= 16) i = 0;
+    }
+}
+
+/*
+ Dataout SPI2 test
+ */
+void test_spi2()
+{
+    unsigned int    c = 0x12;
+    unsigned int    rx;
+    unsigned int    sts = 0;
+    int i;
+    
+    i = SPI2BUF;
+    while(1) {
+        PORTCbits.RC9 = 1;
+        delay_ms(100);
+        PORTCbits.RC9 = 0;
+        delay_ms(900);
+
+//        while(spi2_tx_fifo_is_full());
+//        spi2_putc(c++);
+//        while(spi2_rx_fifo_is_empty());
+//        rx = spi2_getc();
+#if 0
+        while(spi2STATbits.SPIRBF == 0);
+        sts = spi2STAT;
+        if (spi2STATbits.SPITBF == 0) {
+            spi2BUF = c++;
+        }
+//        while(spi2STATbits.SPIRBF == 1) {
+            i = spi2BUF;
+//        }
+        if (i == '$') {
+            c = 0;
+        }
+        if (spi2STATbits.SPIROV == 1) spi2STATbits.SPIROV = 0;
+        sprintf(sz, "%d %04X\r\n", i, sts);
+        PDEBUG(sz);
+#endif
+//        while(spi2STATbits.SPITBF == 1);
+//        while(spi2STATbits.SPITBF);
+/*
+         while(!spi2_tx_fifo_is_full())
+            spi2_putc(c++);
+        while(!spi2_rx_fifo_is_empty()) {
+            rx = spi2_getc();
+            if (rx == '$') c = 0;
+        }
+*/
+        //        i = ReadUART1();
+//        WriteUART2(i);
+
+//        PDEBUG(mes);
+//        delay();
+    }
+}
diff --git a/myad.c b/myad.c
new file mode 100644 (file)
index 0000000..2775718
--- /dev/null
+++ b/myad.c
@@ -0,0 +1,260 @@
+#include <p24FJ64GA004.h>
+#include <libpic30.h>
+
+#include "delay.h"
+#include "myspi.h"
+#include "myad.h"
+
+#define CS_RCLK PORTAbits.RA7
+#define CS_CLK  PORTAbits.RA8
+#define CS_DATA PORTAbits.RA9
+
+#if 0
+// AD DRDY0 INTフラグ 1=INTかかった 0=なし
+static char ad_drdy0_int;
+// AD DRDY0 INTフラグ
+void ad_drdy0_intf_set(void)
+{
+    ad_drdy0_int = 1;
+}
+void ad_drdy0_intf_clear(void)
+{
+    ad_drdy0_int = 0;
+}
+char ad_is_drdy0_intf(void)
+{
+    if (ad_drdy0_int == 1) {
+        return 1;
+    }
+    return 0;
+}
+#endif
+
+void ad_cs_init(void)
+{
+    asm("NOP");
+    CS_RCLK = 0;
+    asm("NOP");
+    CS_CLK = 0;
+    asm("NOP");
+    CS_DATA = 0;
+}
+/*
+ int cs: 0〜15
+ */
+void ad_cs(unsigned char cs)
+{
+    unsigned char i;
+
+//CS_CLK = 1;
+    for(i = 16; i > 0; i--) {
+        if (i == cs+1) {
+            CS_DATA = 0;
+        } else {
+            CS_DATA = 1;
+        }
+        asm("NOP");
+        CS_CLK = 1;
+        CS_CLK = 0;
+    }
+    asm("NOP");
+    CS_RCLK = 1;
+    asm("NOP");
+    CS_DATA = 0;
+    asm("NOP");
+    CS_RCLK = 0;
+}
+void ad_cs_dis(void)
+{
+    unsigned char i;
+
+    CS_DATA = 1;
+    for(i = 16; i > 0; i--) {
+        CS_CLK = 1;
+        CS_CLK = 0;
+    }
+    asm("NOP");
+    CS_RCLK = 1;
+    asm("NOP");
+    CS_DATA = 0;
+    asm("NOP");
+    CS_RCLK = 0;
+}
+
+void ad_reset(void)
+{
+    PORTBbits.RB10 = 1; // -AD RESET
+    delay_us(1);
+    PORTBbits.RB10 = 0; // -AD RESET
+    delay_ms(1);
+    PORTBbits.RB10 = 1; // -AD RESET
+}
+void ad_start(void)
+{
+    PORTBbits.RB11 = 1; // +AD START
+    delay_us(1);
+    PORTBbits.RB11 = 0; // +AD START
+}
+// polling send
+void ad_spi_send(unsigned char c)
+{
+    while(spi1_tx_fifo_is_full());
+    spi1_putc(c);
+}
+// polling rcv
+unsigned char ad_spi_rcv(void)
+{
+    spi1_rx_overrun_clear();
+    while(spi1_tx_fifo_is_full());
+    // 前に受信したデータをクリア
+    spi1_getc();
+    // 送信
+    spi1_putc(0);
+    // 受信待ち
+    while(!spi1_rx_fifo_is_full());
+    return spi1_getc();
+}
+
+void ad_init(void)
+{
+    int cs;
+    int i;
+for(i = 0; i < AD_CHNUM; i++) {
+    cs = AD_CH1_CS + i;
+//1. Send the SDATAC command <11h>. This command cancels the RDATAC mode. RDATAC mode must be
+//cancelled before the register write commands.
+
+    ad_cs(cs);
+        ad_spi_send(ADCMD_SDATAC);
+    ad_cs_dis();
+//2. Send the register write command. The following example shows the register write as a block of nine bytes,
+//starting at register 0 (CONFIG0).
+    ad_cs(cs);
+        ad_spi_send(ADCMD_WREG | 0);   // Register write command
+        ad_spi_send(9 - 1);            // 9byte write
+        // CONFIG0: RFBIAS OFF, SPI timeout enable
+        // Bit 2 RBIAS: Internal reference bias
+        //  0 = Internal reference bias disabled
+        //  1 = Internal reference bias enabled (default)
+        // Bit 0 SPI: SCLK timeout of SPI interface
+        //  0 = SPI timeout disabled
+        //  1 = SPI timeout enabled (default), when SCLK is held low for 216 clock cycles
+        //         bit76543210
+        ad_spi_send(0b00000101);
+        // CONFIG1: sinc1 filter, EXTREF ON, START delay = 0
+        // Bit 6 CHKSUM: Checksum
+        //  0 = Disabled (default)
+        //  1 = Conversion data checksum byte included in readback
+        // Bit 4 SINC2: Digital filter mode
+        //  0 = sinc1 filter (default)
+        //  1 = sinc2 filter
+        // Bit 3 EXTREF: Reference select
+        //  0 = Internal
+        //  1 = External (default)
+        // Bits 2-0 DELAY[2:0]: START conversion delay
+        //  000 = No delay (default)
+        //         bit76543210
+        ad_spi_send(0b00001000);
+
+
+        // CONFIG2: SYNCOUT ON, Gate control, DataRate=10Hz
+        // Bit 5 SYNCOUT: SYNCOUT clock enable
+        //  0 = SYNCOUT disabled (default)
+        //  1 = SYNCOUT enabled
+        // Bit 4 PULSE: Conversion Control mode select
+        //  0 = Gate Control mode (default)
+        //  1 = Pulse Control mode
+        // Bits 2-0 DR[2:0] Data rate setting
+        //  000 = 10SPS (default)
+        //  001 = 16.6SPS
+        //  010 = 50SPS
+        //  011 = 60SPS
+        //  100 = 400SPS
+        //  101 = 1200SPS
+        //  110 = 3600SPS
+        //  111 = 14400SPS
+        //  NOTE: fCLK = 7.3728MHz
+        unsigned char rate_bit;
+        switch(AD_SAMPLE) {
+            case 50:
+                rate_bit = 0b00000010;
+                break;
+            case 400:
+                rate_bit = 0b00000100;
+                break;
+            default:
+            case 10:
+                rate_bit = 0b00000000;
+                break;
+        }
+        //         bit76543210
+        ad_spi_send(0b00100000 | rate_bit);
+
+        // OFC0,1,2: no offset correction
+        ad_spi_send(0);
+        ad_spi_send(0);
+        ad_spi_send(0);
+
+    // FSC0,1,2: no full scale correction
+        ad_spi_send(0);
+        ad_spi_send(0);
+        ad_spi_send(0b01000000);
+    ad_cs_dis();
+
+}
+    // 4. Take the START pin high or send the START command to start conversions.
+    ad_start_ena(); // +AD START
+
+    for(i = 0; i < AD_CHNUM; i++) {
+        cs = AD_CH1_CS + i;
+        //5. Optionally, send the RDATAC command <10h>. This permits reading of conversion data without the need of
+        //the read data command. Otherwise, the read data opcode must be sent to read each conversion result.
+        ad_cs(cs);
+            ad_spi_send(ADCMD_RDATAC);
+        ad_cs_dis();
+    }
+
+}
+/*
+       PGA280 init
+       BUF OFF
+*/
+void pga_init(void)
+{
+    int cs;
+    int i;
+for(i = 0; i < AD_CHNUM; i++) {
+    cs = PGA_CH1_CS + i;
+    //Register 1
+    //Soft Reset
+    ad_cs(cs);
+        ad_spi_send(0x41);
+        ad_spi_send(0x01);
+    ad_cs_dis();
+    //waitいる?
+    delay_ms(1);
+
+    //Register 0
+    //Gain=1/4
+    ad_cs(cs);
+        ad_spi_send(0x40);  //(BUF OFF)
+        ad_spi_send(0x08);
+    ad_cs_dis();
+
+    //Register 8: GPIO Configuration Register
+    //使わないpinはoutput(=1)にする
+    //bit6 GPIO6(SYNCIN) input(=0)
+    ad_cs(cs);
+        ad_spi_send(0x48);
+        ad_spi_send(0b00111111);
+    ad_cs_dis();
+
+    //Register 12: Special Functions Register
+    //bit6 SYNCin=1 SYNCIN(GPIO6) Enable
+    ad_cs(cs);
+        ad_spi_send(0x4C);
+        ad_spi_send(0b01000000);
+    ad_cs_dis();
+}
+}
+
diff --git a/myad.h b/myad.h
new file mode 100644 (file)
index 0000000..b84ce72
--- /dev/null
+++ b/myad.h
@@ -0,0 +1,47 @@
+#ifndef __MYAD_H__
+#include <p24FJ64GA004.h>
+#include <libpic30.h>
+
+#define __MYAD_H__
+
+#define AD_CHNUM    6
+#define AD_CH1_CS   0   // AD CH1のCS番号
+#define PGA_CH1_CS  6   // PGA CH1のCS番号
+
+//#define AD_SAMPLE0  400 // AD ICの出力レート [Hz]
+//#define AD_SAMPLE1  50 // Main CPUに向けて出力するデータのサンプル数 [Hz]
+
+#define AD_SAMPLE  50 // AD ICの出力レート [Hz]
+
+// SPI CMD
+#define        ADCMD_SDATAC    0x11
+#define        ADCMD_WREG      0x40
+#define        ADCMD_RDATAC    0x10
+
+// AD DRDY0 INTフラグ
+//void ad_drdy0_intf_set(void);
+//void ad_drdy0_intf_clear(void);
+//char ad_is_drdy0_intf(void);
+
+void ad_cs_init(void);
+void ad_cs(unsigned char adr);
+void ad_cs_dis(void);
+
+#define ad_reset_dis()  PORTBbits.RB10 = 1; __delay32(1)
+#define ad_reset_ena()  PORTBbits.RB10 = 0; __delay32(1)
+
+#define ad_start_dis()  PORTBbits.RB11 = 0; __delay32(1)
+#define ad_start_ena()  PORTBbits.RB11 = 1; __delay32(1)
+
+#define ad_is_drdy0_enable()    (PORTBbits.RB12 == 0)
+
+void ad_reset(void);
+void ad_start(void);
+void ad_init(void);
+
+void ad_spi_send(unsigned char c);
+unsigned char ad_spi_rcv(void);
+
+void pga_init(void);
+
+#endif
diff --git a/myspi.c b/myspi.c
new file mode 100644 (file)
index 0000000..e92fff9
--- /dev/null
+++ b/myspi.c
@@ -0,0 +1,102 @@
+#include <p24FJ64GA004.h>
+
+#include "myspi.h"
+
+/*
+ AD SPI1 Init
+ Enhanced Buffer OFF
+ master mode
+*/
+int spi1_init(void)
+{
+    int i;
+    unsigned char   c;
+
+    SPI1STAT = 0;
+    //1. Clear the SPIxBUF register.
+    for(i = 0; i < 16; i++) c = SPI1BUF;
+    spi1_intf_clear();
+
+    //2. Write the desired settings to the SPIxCON register with MSTEN (SPIxCON1<5>) = 1.
+    // bit12 DISSCK=0 0=Internal SPI clock is enabled
+    // bit11 DISSDO=0 0 = SDOx pin is controlled by the module
+    // bit10 MODE16=0 8bit
+    // bit9  SMP=1 1=Input data sampled at end of data output time @MasterMode
+    // bit8  CKE=0 DATA CHANGE=CLK LtoH
+    // bit7  SSEN=0 SS pin disable
+    // bit6  CKP=0 CLK IDLE=LOW
+    // bit5  MSTEN=1 Master
+    // bit4-2 SPRE=0b111 Secondary Prescale 1:1
+    //  111 = Secondary prescale 1:1
+    //  110 = Secondary prescale 2:1
+    //  ...
+    //  000 = Secondary prescale 8:1
+    // bit1-0 PPRE=0b01 Primarily Prescale 4:1
+    //  11 = Primary prescale 1:1
+    //  10 = Primary prescale 4:1
+    //  01 = Primary prescale 16:1
+    //  00 = Primary prescale 64:1
+    //           5432109876543210
+    SPI1CON1 = 0b0000001000111110;
+
+    // Enahanced Buffer(FIFO) Disable
+    // bit0 SPIBEN: Enhanced Buffer Enable bit
+    //  1 = Enhanced Buffer enabled
+    //  0 = Enhanced Buffer disabled (Legacy mode)
+    SPI1CON2 = 0x00;
+//    SPI1CON2bits.SPIBEN = 1;
+
+    // bit 4-2 SISEL2:SISEL0: SPIx Buffer Interrupt Mode bits (valid in Enhanced Buffer mode)
+    //  001 = Interrupt when data is available in receive buffer (SRMPT bit is set)
+//    SPI1STATbits.SISEL = 0b001;
+
+    //3. Clear the SPIROV bit (SPIxSTAT<6>).
+    SPI1STATbits.SPIROV = 0;
+
+    //4. Enable SPIx operation by setting the SPIEN bit (SPIxSTAT<15>).
+    SPI1STATbits.SPIEN = 1;
+
+}
+/*
+ DataOut SPI2 Init
+ Enhanced Buffer ON
+ Slave mode
+*/
+int spi2_init(void)
+{
+    int i;
+    unsigned char   c;
+
+    SPI2STAT = 0;
+    //1. Clear the SPIxBUF register.
+    for(i = 0; i < 16; i++) c = SPI2BUF;
+    //2. If using interrupts:
+    //• Clear the SPIxIF bit in the respective IFSx register.
+    IFS2bits.SPI2IF = 0;
+//• Set the SPIxIE bit in the respective IECx register.
+//• Write the SPIxIP bits in the respective IPCx register to set the interrupt priority.
+
+    // 割り込み要因設定
+    // 0b100 = Interrupt when one data is shifted into the SPIxSR, as a result, the TX FIFO has one open spot
+    // TX FIFOに1byte空き生じた
+    SPI2STATbits.SISEL = 0b100;
+
+    //3. Write the desired settings to the SPIxCON1 and SPIxCON2 registers with MSTEN (SPIxCON1<5>) = 0.
+    // SLAVE,8bit,CLK IDLE=LOW, DATA CHANGE=CLK HtoL, SS pin enable
+    //           5432109876543210
+//  SPI1CON1 = 0b0000000110000000;
+    SPI2CON1 = 0b0000000100000000;
+    // Enahanced Buffer(FIFO) Disable
+    SPI2CON2 = 0x00;
+    //4. Clear the SMP bit. SPI1CON1<9>
+    SPI2CON1bits.SMP = 0;
+    //5. If the CKE<8> bit is set, then the SSEN<7> bit must be set, thus enabling the SSx pin.
+    SPI2CON1bits.SSEN = 1;
+    //6. Clear the SPIROV bit (SPIxSTAT<6>).
+    SPI2STATbits.SPIROV = 0;
+    //7. Select Enhanced Buffer mode by setting the SPIBEN bit (SPIxCON2<0>).
+    SPI2CON2bits.SPIBEN = 1;
+
+    //8. Enable SPI operation by setting the SPIEN bit (SPIxSTAT<15>).
+    SPI2STATbits.SPIEN = 1;
+}
diff --git a/myspi.h b/myspi.h
new file mode 100644 (file)
index 0000000..2677e6a
--- /dev/null
+++ b/myspi.h
@@ -0,0 +1,32 @@
+#ifndef __MYSPI_H__
+#include <p24FJ64GA004.h>
+
+#define __MYSPI_H__
+int spi1_init(void);
+int spi2_init(void);
+
+#define spi1_tx_fifo_is_full()   (SPI1STATbits.SPITBF == 1) // true=full(Transmit not yet started, SPIxTXB is full)
+#define spi1_rx_fifo_is_full()   (SPI1STATbits.SPIRBF == 1) // true=full(Receive complete)
+#define spi1_rx_fifo_is_empty()   (SPI1STATbits.SRXMPT == 1)    // true=empty, SRXMPT: Receive FIFO Empty bit (valid in Enhanced Buffer mode)
+#define spi1_rx_overrun_clear() SPI1STATbits.SPIROV = 0;
+
+#define spi1_putc(c)    SPI1BUF = (c & 0xFF)
+#define spi1_getc()    (SPI1BUF & 0xFF)
+
+#define spi1_set_int_level(i)  IPC2bits.SPI1IP = (i)
+#define spi1_int_enable()  IEC0bits.SPI1IE = 1
+#define spi1_int_disable()  IEC0bits.SPI1IE = 0
+#define spi1_intf_clear()   IFS0bits.SPI1IF = 0
+
+#define spi2_tx_fifo_is_full()   (SPI2STATbits.SPITBF == 1) // true=full
+#define spi2_rx_fifo_is_full()   (SPI2STATbits.SPIRBF == 1) // true=full
+#define spi2_rx_fifo_is_empty()   (SPI2STATbits.SRXMPT == 1)    // true=empty
+
+#define spi2_putc(c)    SPI2BUF = (c & 0xFF)
+#define spi2_getc()    (SPI2BUF & 0xFF)
+
+#define spi2_set_int_level(i)  IPC8bits.SPI2IP = (i)
+#define spi2_int_enable()  IEC2bits.SPI2IE = 1
+#define spi2_intf_clear()   IFS2bits.SPI2IF = 0
+
+#endif
diff --git a/myuart.c b/myuart.c
new file mode 100644 (file)
index 0000000..555e845
--- /dev/null
+++ b/myuart.c
@@ -0,0 +1,66 @@
+#include <p24FJ64GA004.h>
+#include "myuart.h"
+
+// ublox GPS受信用リングバッファ
+static unsigned char   ubx_w, ubx_r;
+static unsigned char    ubx_buf[256];
+
+void _ISR _U1RXInterrupt(void)
+{
+    // 割り込みフラグクリア
+    IFS0bits.U1RXIF = 0;
+    while(uart1_rx_is_rdy()) {
+        ubx_buf[ubx_w++] = uart1_getc();
+    }
+    if (U1STAbits.OERR == 1) U1STAbits.OERR = 0;
+}
+void uart1_puts(char *s)
+{
+    while(*s != 0) {
+        while(uart1_tx_is_full());
+        U1TXREG = *s++;
+    }
+}
+void uart2_puts(char *s)
+{
+    while(*s != 0) {
+        while(uart2_tx_is_full());
+        U2TXREG = *s++;
+    }
+}
+/*
+return 0=なし 1=あり
+ */
+int uart1_rcvbuf_is_data(void)
+{
+    if (ubx_r == ubx_w) return 0;
+    return 1;
+}
+/*
+ return データ -1=データ無し
+ */
+int uart1_rcvbuf_getc(void)
+{
+    if (ubx_r == ubx_w) return -1;
+    return ubx_buf[ubx_r++];
+}
+
+void uart1_rcvbuf_clear(void)
+{
+    ubx_r = ubx_w;
+}
+
+void uart1_init(unsigned int mode, unsigned int sts, unsigned int baud)
+{
+    U1MODE = mode;
+    U1STA = sts;
+    U1BRG = baud;
+    ubx_w = 0;
+    ubx_r = 0;
+}
+void uart2_init(unsigned int mode, unsigned int sts, unsigned int baud)
+{
+    U2MODE = mode;
+    U2STA = sts;
+    U2BRG = baud;
+}
diff --git a/myuart.h b/myuart.h
new file mode 100644 (file)
index 0000000..0c091ae
--- /dev/null
+++ b/myuart.h
@@ -0,0 +1,40 @@
+
+#ifndef __MYUART_H__
+
+#define __MYUART_H__
+
+#include <p24FJ64GA004.h>
+
+#define uart1_tx_is_full() (U1STAbits.UTXBF == 1)
+#define uart2_tx_is_full() (U2STAbits.UTXBF == 1)
+
+#define uart1_rx_is_rdy()  (U1STAbits.URXDA == 1)
+#define uart2_rx_is_rdy()  (U2STAbits.URXDA == 1)
+
+#define uart1_putc(c)    U1TXREG = (c)
+#define uart2_putc(c)    U2TXREG = (c)
+
+#define uart1_getc(c)    U1RXREG
+#define uart2_getc(c)    U2RXREG
+
+// 割り込みレベル デフォルト4
+#define uart1_set_int_level(i)  IPC2bits.U1RXIP = (i)
+#define uart1_rx_int_enable()  IEC0bits.U1RXIE = 1
+#define uart1_rx_int_disable()  IEC0bits.U1RXIE = 0
+
+#define uart2_set_int_level(i)  IPC7bits.U2RXIP = (i)
+#define uart2_rx_int_enable()  IEC1bits.U2RXIE = 1
+#define uart2_rx_int_disable()  IEC1bits.U2RXIE = 0
+
+
+void uart1_puts(char *s);
+void uart2_puts(char *s);
+
+int uart1_rcvbuf_is_data(void);
+int uart1_rcvbuf_getc(void);
+void uart1_rcvbuf_clear(void);
+
+void uart1_init(unsigned int mode, unsigned int sts, unsigned int baud);
+void uart2_init(unsigned int mode, unsigned int sts, unsigned int baud);
+
+#endif
diff --git a/nbproject/.dep.inc b/nbproject/.dep.inc
new file mode 100644 (file)
index 0000000..4560e55
--- /dev/null
@@ -0,0 +1,5 @@
+# This code depends on make tool being used
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/nbproject/Makefile-default.mk b/nbproject/Makefile-default.mk
new file mode 100644 (file)
index 0000000..f40ed2b
--- /dev/null
@@ -0,0 +1,207 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a -pre and a -post target defined where you can add customized code.
+#
+# This makefile implements configuration specific macros and targets.
+
+
+# Include project Makefile
+include Makefile
+
+# Environment
+# Adding MPLAB X bin directory to path
+PATH:=/opt/microchip/mplabx/mplab_ide/mplab_ide/modules/../../bin/:$(PATH)
+MKDIR=mkdir -p
+RM=rm -f 
+MV=mv 
+CP=cp 
+
+# Macros
+CND_CONF=default
+ifeq ($(TYPE_IMAGE), DEBUG_RUN)
+IMAGE_TYPE=debug
+FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out
+else
+IMAGE_TYPE=production
+FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out
+endif
+
+# Object Directory
+OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}
+
+# Distribution Directory
+DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
+
+# Object Files Quoted if spaced
+OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/debug_print.o ${OBJECTDIR}/main.o ${OBJECTDIR}/myad.o ${OBJECTDIR}/myspi.o ${OBJECTDIR}/myuart.o ${OBJECTDIR}/ring.o ${OBJECTDIR}/ublox.o
+
+# Object Files
+OBJECTFILES=${OBJECTDIR}/debug_print.o ${OBJECTDIR}/main.o ${OBJECTDIR}/myad.o ${OBJECTDIR}/myspi.o ${OBJECTDIR}/myuart.o ${OBJECTDIR}/ring.o ${OBJECTDIR}/ublox.o
+
+
+CFLAGS=
+ASFLAGS=
+LDLIBSOPTIONS=
+
+# Path to java used to run MPLAB X when this makefile was created
+MP_JAVA_PATH="/usr/lib/jvm/java-6-openjdk/jre/bin/"
+OS_CURRENT="$(shell uname -s)"
+############# Tool locations ##########################################
+# If you copy a project from one host to another, the path where the  #
+# compiler is installed may be different.                             #
+# If you open this project with MPLAB X in the new host, this         #
+# makefile will be regenerated and the paths will be corrected.       #
+#######################################################################
+MP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc"
+# MP_BC is not defined
+MP_AS="/opt/microchip/mplabc30/v3.30c/bin/pic30-as"
+MP_LD="/opt/microchip/mplabc30/v3.30c/bin/pic30-ld"
+MP_AR="/opt/microchip/mplabc30/v3.30c/bin/pic30-ar"
+DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar" 
+# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build
+FIXDEPS=fixDeps
+MP_CC_DIR="/opt/microchip/mplabc30/v3.30c/bin"
+# MP_BC_DIR is not defined
+MP_AS_DIR="/opt/microchip/mplabc30/v3.30c/bin"
+MP_LD_DIR="/opt/microchip/mplabc30/v3.30c/bin"
+MP_AR_DIR="/opt/microchip/mplabc30/v3.30c/bin"
+# MP_BC_DIR is not defined
+
+.build-conf:  ${BUILD_SUBPROJECTS}
+       ${MAKE}  -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out
+
+MP_PROCESSOR_OPTION=24FJ64GA004
+MP_LINKER_FILE_OPTION=,-Tp24FJ64GA004.gld
+# ------------------------------------------------------------------------------------
+# Rules for buildStep: assemble
+ifeq ($(TYPE_IMAGE), DEBUG_RUN)
+else
+endif
+
+# ------------------------------------------------------------------------------------
+# Rules for buildStep: assembleWithPreprocess
+ifeq ($(TYPE_IMAGE), DEBUG_RUN)
+else
+endif
+
+# ------------------------------------------------------------------------------------
+# Rules for buildStep: compile
+ifeq ($(TYPE_IMAGE), DEBUG_RUN)
+${OBJECTDIR}/debug_print.o: debug_print.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/debug_print.o.d 
+       @${RM} ${OBJECTDIR}/debug_print.o.ok ${OBJECTDIR}/debug_print.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/debug_print.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/debug_print.o.d" -o ${OBJECTDIR}/debug_print.o debug_print.c  
+       
+${OBJECTDIR}/myuart.o: myuart.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/myuart.o.d 
+       @${RM} ${OBJECTDIR}/myuart.o.ok ${OBJECTDIR}/myuart.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/myuart.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/myuart.o.d" -o ${OBJECTDIR}/myuart.o myuart.c  
+       
+${OBJECTDIR}/ublox.o: ublox.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/ublox.o.d 
+       @${RM} ${OBJECTDIR}/ublox.o.ok ${OBJECTDIR}/ublox.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/ublox.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/ublox.o.d" -o ${OBJECTDIR}/ublox.o ublox.c  
+       
+${OBJECTDIR}/myad.o: myad.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/myad.o.d 
+       @${RM} ${OBJECTDIR}/myad.o.ok ${OBJECTDIR}/myad.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/myad.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/myad.o.d" -o ${OBJECTDIR}/myad.o myad.c  
+       
+${OBJECTDIR}/main.o: main.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/main.o.d 
+       @${RM} ${OBJECTDIR}/main.o.ok ${OBJECTDIR}/main.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/main.o.d" -o ${OBJECTDIR}/main.o main.c  
+       
+${OBJECTDIR}/myspi.o: myspi.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/myspi.o.d 
+       @${RM} ${OBJECTDIR}/myspi.o.ok ${OBJECTDIR}/myspi.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/myspi.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/myspi.o.d" -o ${OBJECTDIR}/myspi.o myspi.c  
+       
+${OBJECTDIR}/ring.o: ring.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/ring.o.d 
+       @${RM} ${OBJECTDIR}/ring.o.ok ${OBJECTDIR}/ring.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/ring.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE) -g -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/ring.o.d" -o ${OBJECTDIR}/ring.o ring.c  
+       
+else
+${OBJECTDIR}/debug_print.o: debug_print.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/debug_print.o.d 
+       @${RM} ${OBJECTDIR}/debug_print.o.ok ${OBJECTDIR}/debug_print.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/debug_print.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/debug_print.o.d" -o ${OBJECTDIR}/debug_print.o debug_print.c  
+       
+${OBJECTDIR}/myuart.o: myuart.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/myuart.o.d 
+       @${RM} ${OBJECTDIR}/myuart.o.ok ${OBJECTDIR}/myuart.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/myuart.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/myuart.o.d" -o ${OBJECTDIR}/myuart.o myuart.c  
+       
+${OBJECTDIR}/ublox.o: ublox.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/ublox.o.d 
+       @${RM} ${OBJECTDIR}/ublox.o.ok ${OBJECTDIR}/ublox.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/ublox.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/ublox.o.d" -o ${OBJECTDIR}/ublox.o ublox.c  
+       
+${OBJECTDIR}/myad.o: myad.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/myad.o.d 
+       @${RM} ${OBJECTDIR}/myad.o.ok ${OBJECTDIR}/myad.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/myad.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/myad.o.d" -o ${OBJECTDIR}/myad.o myad.c  
+       
+${OBJECTDIR}/main.o: main.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/main.o.d 
+       @${RM} ${OBJECTDIR}/main.o.ok ${OBJECTDIR}/main.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/main.o.d" -o ${OBJECTDIR}/main.o main.c  
+       
+${OBJECTDIR}/myspi.o: myspi.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/myspi.o.d 
+       @${RM} ${OBJECTDIR}/myspi.o.ok ${OBJECTDIR}/myspi.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/myspi.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/myspi.o.d" -o ${OBJECTDIR}/myspi.o myspi.c  
+       
+${OBJECTDIR}/ring.o: ring.c  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} ${OBJECTDIR} 
+       @${RM} ${OBJECTDIR}/ring.o.d 
+       @${RM} ${OBJECTDIR}/ring.o.ok ${OBJECTDIR}/ring.o.err 
+       @${FIXDEPS} "${OBJECTDIR}/ring.o.d" $(SILENT) -c ${MP_CC} $(MP_EXTRA_CC_PRE)  -g -omf=elf -x c -c -mcpu=$(MP_PROCESSOR_OPTION) -O1 -MMD -MF "${OBJECTDIR}/ring.o.d" -o ${OBJECTDIR}/ring.o ring.c  
+       
+endif
+
+# ------------------------------------------------------------------------------------
+# Rules for buildStep: link
+ifeq ($(TYPE_IMAGE), DEBUG_RUN)
+dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out: ${OBJECTFILES}  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} 
+       ${MP_CC} $(MP_EXTRA_LD_PRE)  -omf=elf -mcpu=$(MP_PROCESSOR_OPTION)  -D__DEBUG -D__MPLAB_DEBUGGER_ICD3=1 -o dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out ${OBJECTFILES_QUOTED_IF_SPACED}        -Wl,--defsym=__MPLAB_BUILD=1,--heap=64,--no-check-sections$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--defsym=__MPLAB_DEBUG=1,--defsym=__ICD2RAM=1,--defsym=__DEBUG=1,--defsym=__MPLAB_DEBUGGER_ICD3=1
+else
+dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out: ${OBJECTFILES}  nbproject/Makefile-${CND_CONF}.mk
+       @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} 
+       ${MP_CC} $(MP_EXTRA_LD_PRE)  -omf=elf -mcpu=$(MP_PROCESSOR_OPTION)  -o dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out ${OBJECTFILES_QUOTED_IF_SPACED}        -Wl,--defsym=__MPLAB_BUILD=1,--heap=64,--no-check-sections$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION)
+       ${MP_CC_DIR}/pic30-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out -omf=elf
+endif
+
+
+# Subprojects
+.build-subprojects:
+
+# Clean Targets
+.clean-conf:
+       ${RM} -r build/default
+       ${RM} -r dist/default
+
+# Enable dependency checking
+.dep.inc: .depcheck-impl
+
+DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES}))
+ifneq (${DEPFILES},)
+include ${DEPFILES}
+endif
diff --git a/nbproject/Makefile-genesis.properties b/nbproject/Makefile-genesis.properties
new file mode 100644 (file)
index 0000000..6dab236
--- /dev/null
@@ -0,0 +1,8 @@
+#
+#Thu Nov 17 20:17:23 JST 2011
+default.languagetoolchain.dir=/opt/microchip/mplabc30/v3.30c/bin
+com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=11bb82e71763925c87fa30f6c65473b1
+default.languagetoolchain.version=3_30
+default.com-microchip-mplab-nbide-toolchainC30-C30LanguageToolchain.md5=17df7e8733752d3b984a90d5cec1213a
+host.platform=linux
+conf.ids=default
diff --git a/nbproject/Makefile-impl.mk b/nbproject/Makefile-impl.mk
new file mode 100644 (file)
index 0000000..80c38e4
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Generated Makefile - do not edit!
+#
+# Edit the Makefile in the project folder instead (../Makefile). Each target
+# has a pre- and a post- target defined where you can add customization code.
+#
+# This makefile implements macros and targets common to all configurations.
+#
+# NOCDDL
+
+
+# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
+# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
+# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
+# and .clean-reqprojects-conf unless SUB has the value 'no'
+SUB_no=NO
+SUBPROJECTS=${SUB_${SUB}}
+BUILD_SUBPROJECTS_=.build-subprojects
+BUILD_SUBPROJECTS_NO=
+BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
+CLEAN_SUBPROJECTS_=.clean-subprojects
+CLEAN_SUBPROJECTS_NO=
+CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
+
+
+# Project Name
+PROJECTNAME=ad2010
+
+# Active Configuration
+DEFAULTCONF=default
+CONF=${DEFAULTCONF}
+
+# All Configurations
+ALLCONFS=default 
+
+
+# build
+.build-impl: .build-pre
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
+
+
+# clean
+.clean-impl: .clean-pre
+       ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
+
+# dependency checking support
+.depcheck-impl:
+#      @echo "# This code depends on make tool being used" >.dep.inc
+#      @if [ -n "${MAKE_VERSION}" ]; then \
+#          echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
+#          echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
+#          echo "include \$${DEPFILES}" >>.dep.inc; \
+#          echo "endif" >>.dep.inc; \
+#      else \
+#          echo ".KEEP_STATE:" >>.dep.inc; \
+#          echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
+#      fi
diff --git a/nbproject/Makefile-variables.mk b/nbproject/Makefile-variables.mk
new file mode 100644 (file)
index 0000000..24650d2
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# Generated - do not edit!
+#
+# NOCDDL
+#
+CND_BASEDIR=`pwd`
+# default configuration
+CND_ARTIFACT_DIR_default=dist/default/production
+CND_ARTIFACT_NAME_default=ad2010.production.out
+CND_ARTIFACT_PATH_default=dist/default/production/ad2010.production.out
+CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package
+CND_PACKAGE_NAME_default=ad2010.tar
+CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/ad2010.tar
diff --git a/nbproject/Package-default.bash b/nbproject/Package-default.bash
new file mode 100644 (file)
index 0000000..d078840
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/bash -x
+
+#
+# Generated - do not edit!
+#
+
+# Macros
+TOP=`pwd`
+CND_CONF=default
+CND_DISTDIR=dist
+TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging
+TMPDIRNAME=tmp-packaging
+OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/ad2010.${IMAGE_TYPE}.out
+OUTPUT_BASENAME=ad2010.${IMAGE_TYPE}.out
+PACKAGE_TOP_DIR=ad2010/
+
+# Functions
+function checkReturnCode
+{
+    rc=$?
+    if [ $rc != 0 ]
+    then
+        exit $rc
+    fi
+}
+function makeDirectory
+# $1 directory path
+# $2 permission (optional)
+{
+    mkdir -p "$1"
+    checkReturnCode
+    if [ "$2" != "" ]
+    then
+      chmod $2 "$1"
+      checkReturnCode
+    fi
+}
+function copyFileToTmpDir
+# $1 from-file path
+# $2 to-file path
+# $3 permission
+{
+    cp "$1" "$2"
+    checkReturnCode
+    if [ "$3" != "" ]
+    then
+        chmod $3 "$2"
+        checkReturnCode
+    fi
+}
+
+# Setup
+cd "${TOP}"
+mkdir -p ${CND_DISTDIR}/${CND_CONF}/package
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Copy files and create directories and links
+cd "${TOP}"
+makeDirectory ${TMPDIR}/ad2010/bin
+copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
+
+
+# Generate tar file
+cd "${TOP}"
+rm -f ${CND_DISTDIR}/${CND_CONF}/package/ad2010.tar
+cd ${TMPDIR}
+tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/ad2010.tar *
+checkReturnCode
+
+# Cleanup
+cd "${TOP}"
+rm -rf ${TMPDIR}
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
new file mode 100644 (file)
index 0000000..92c2985
--- /dev/null
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <logicalFolder name="root" displayName="root" projectFiles="true">
+    <logicalFolder name="HeaderFiles"
+                   displayName="Header Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="LibraryFiles"
+                   displayName="Library Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="LinkerScript"
+                   displayName="Linker Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="ObjectFiles"
+                   displayName="Object Files"
+                   projectFiles="true">
+    </logicalFolder>
+    <logicalFolder name="SourceFiles"
+                   displayName="Source Files"
+                   projectFiles="true">
+      <itemPath>debug_print.c</itemPath>
+      <itemPath>debug_print.h</itemPath>
+      <itemPath>delay.h</itemPath>
+      <itemPath>main.c</itemPath>
+      <itemPath>myad.c</itemPath>
+      <itemPath>myad.h</itemPath>
+      <itemPath>myspi.c</itemPath>
+      <itemPath>myspi.h</itemPath>
+      <itemPath>myuart.c</itemPath>
+      <itemPath>myuart.h</itemPath>
+      <itemPath>ring.c</itemPath>
+      <itemPath>ring.h</itemPath>
+      <itemPath>ublox.c</itemPath>
+      <itemPath>ublox.h</itemPath>
+    </logicalFolder>
+    <logicalFolder name="ExternalFiles"
+                   displayName="Important Files"
+                   projectFiles="false">
+      <itemPath>Makefile</itemPath>
+    </logicalFolder>
+  </logicalFolder>
+  <projectmakefile>Makefile</projectmakefile>
+  <confs>
+    <conf name="default" type="2">
+      <toolsSet>
+        <developmentServer>localhost</developmentServer>
+        <targetDevice>PIC24FJ64GA004</targetDevice>
+        <targetHeader></targetHeader>
+        <platformTool>ICD3PlatformTool</platformTool>
+        <languageToolchain>C30</languageToolchain>
+        <languageToolchainVersion>3.24</languageToolchainVersion>
+        <platform>2</platform>
+      </toolsSet>
+      <compileType>
+        <linkerTool>
+          <linkerLibItems>
+          </linkerLibItems>
+        </linkerTool>
+      </compileType>
+      <makeCustomizationType>
+        <makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
+        <makeCustomizationPreStep></makeCustomizationPreStep>
+        <makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
+        <makeCustomizationPostStep></makeCustomizationPostStep>
+        <makeCustomizationAlternativeFileToLoadEnabled>false</makeCustomizationAlternativeFileToLoadEnabled>
+        <makeCustomizationAlternativeFileToLoad></makeCustomizationAlternativeFileToLoad>
+        <makeCustomizationUseOfUserID>makeCustomizationUseOfUserID</makeCustomizationUseOfUserID>
+        <makeCustomizationUserID>makeCustomizationUserID</makeCustomizationUserID>
+      </makeCustomizationType>
+      <C30>
+        <property key="optimization-level" value="1"/>
+        <property key="preprocessor-macros" value=""/>
+        <property key="code-model" value="default"/>
+        <property key="const-model" value="default"/>
+        <property key="enable-procedural-abstraction" value="false"/>
+        <property key="enable-ansi-warnings" value="false"/>
+        <property key="enable-short-double" value="false"/>
+        <property key="extra-include-directories" value=""/>
+        <property key="post-instruction-scheduling" value="default"/>
+        <property key="enable-unroll-loops" value="false"/>
+        <property key="enable-symbols" value="true"/>
+        <property key="data-model" value="default"/>
+        <property key="isolate-each-function" value="false"/>
+        <property key="enable-fatal-warnings" value="false"/>
+        <property key="enable-omit-frame-pointer" value="false"/>
+        <property key="enable-ansi-std" value="false"/>
+        <property key="enable-all-warnings" value="false"/>
+        <property key="pre-instruction-scheduling" value="default"/>
+        <property key="enable-large-arrays" value="false"/>
+        <property key="scalar-model" value="default"/>
+      </C30>
+      <C30-AS>
+        <property key="omit-debug-dirs" value="false"/>
+        <property key="extra-include-directories-for-assembler" value=""/>
+        <property key="preprocessor-macros" value=""/>
+        <property key="list-file" value=""/>
+        <property key="list-assembly" value="false"/>
+        <property key="list-source" value="false"/>
+        <property key="relax" value="false"/>
+        <property key="extra-include-directories-for-preprocessor" value=""/>
+        <property key="warning-level" value="emit-warnings"/>
+        <property key="list-section-info" value="false"/>
+        <property key="omit-forms" value="false"/>
+        <property key="list-symbols" value="false"/>
+        <property key="keep-locals" value="false"/>
+        <property key="false-conditionals" value="false"/>
+        <property key="expand-macros" value="false"/>
+        <property key="assembler-symbols" value=""/>
+      </C30-AS>
+      <C30-LD>
+        <property key="preprocessor-macros" value=""/>
+        <property key="general-code-protect" value="no_code_protect"/>
+        <property key="secure-write-protect" value="no_write_protect"/>
+        <property key="warn-section-align" value="false"/>
+        <property key="heap-size" value="64"/>
+        <property key="remove-unused-sections" value="false"/>
+        <property key="stack-size" value=""/>
+        <property key="linker-symbols" value=""/>
+        <property key="trace-symbols" value=""/>
+        <property key="map-file" value=""/>
+        <property key="enable-pack-data" value="true"/>
+        <property key="boot-eeprom" value="no_eeprom"/>
+        <property key="general-write-protect" value="no_write_protect"/>
+        <property key="enable-handles" value="true"/>
+        <property key="enable-data-init" value="true"/>
+        <property key="secure-flash" value="no_flash"/>
+        <property key="boot-write-protect" value="no_write_protect"/>
+        <property key="boot-flash" value="no_flash"/>
+        <property key="report-memory-usage" value="false"/>
+        <property key="generate-cross-reference-file" value="false"/>
+        <property key="input-libraries" value=""/>
+        <property key="secure-ram" value="no_ram"/>
+        <property key="enable-check-sections" value="true"/>
+        <property key="enable-default-isr" value="true"/>
+        <property key="symbol-stripping" value="keep-all"/>
+        <property key="boot-ram" value="no_ram"/>
+        <property key="secure-eeprom" value="no_eeprom"/>
+        <property key="extra-lib-directories" value=""/>
+      </C30-LD>
+      <C30Global>
+        <property key="fast-math" value="false"/>
+        <property key="output-file-format" value="elf"/>
+        <property key="legacy-libc" value="false"/>
+      </C30Global>
+      <ICD3PlatformTool>
+        <property key="UART 2" value="true"/>
+        <property key="UART 1" value="true"/>
+        <property key="programoptions.preserveprogramrange" value="false"/>
+        <property key="programoptions.eraseb4program" value="true"/>
+        <property key="memories.id" value="false"/>
+        <property key="ToolFirmwareFilePath" value=""/>
+        <property key="memories.eeprom" value="false"/>
+        <property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/>
+        <property key="programoptions.usehighvoltageonmclr" value="false"/>
+        <property key="INPUT CAPTURE 5" value="true"/>
+        <property key="INPUT CAPTURE 4" value="true"/>
+        <property key="INPUT CAPTURE 3" value="true"/>
+        <property key="INPUT CAPTURE 2" value="true"/>
+        <property key="INPUT CAPTURE 1" value="true"/>
+        <property key="programoptions.preserveeeprom" value="false"/>
+        <property key="ADC 1" value="true"/>
+        <property key="debugoptions.useswbreakpoints" value="false"/>
+        <property key="hwtoolclock.frcindebug" value="false"/>
+        <property key="OUTPUT COMPARE 5" value="true"/>
+        <property key="OUTPUT COMPARE 4" value="true"/>
+        <property key="memories.programmemory" value="true"/>
+        <property key="OUTPUT COMPARE 3" value="true"/>
+        <property key="OUTPUT COMPARE 2" value="true"/>
+        <property key="OUTPUT COMPARE 1" value="true"/>
+        <property key="poweroptions.powerenable" value="false"/>
+        <property key="memories.programmemory.start" value="0x0"/>
+        <property key="programoptions.preserveprogramrange.start" value="0x0"/>
+        <property key="AutoSelectMemRanges" value="auto"/>
+        <property key="voltagevalue" value="3.25"/>
+        <property key="memories.programmemory.end" value="0xabfb"/>
+        <property key="TIMER5" value="true"/>
+        <property key="TIMER4" value="true"/>
+        <property key="TIMER3" value="true"/>
+        <property key="SPI 2" value="true"/>
+        <property key="TIMER2" value="true"/>
+        <property key="SPI 1" value="true"/>
+        <property key="TIMER1" value="true"/>
+        <property key="hwtoolclock.instructionspeed" value=""/>
+        <property key="CRC" value="true"/>
+        <property key="I2C2" value="true"/>
+        <property key="I2C1" value="true"/>
+        <property key="hwtoolclock.units" value="mips"/>
+        <property key="Freeze All Other Peripherals" value="true"/>
+        <property key="programoptions.preserveprogramrange.end" value="0xff"/>
+      </ICD3PlatformTool>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/nbproject/private/configurations.xml b/nbproject/private/configurations.xml
new file mode 100644 (file)
index 0000000..78e4e03
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configurationDescriptor version="62">
+  <projectmakefile>Makefile</projectmakefile>
+  <defaultConf>0</defaultConf>
+  <confs>
+    <conf name="default" type="2">
+      <platformToolSN>:=MPLABCommUSB:=04D8:=9009:=0100:=Microchip Technology, Inc. (www.microchip.com):=MPLAB ICD3 tm (www.microchip.com):=TPM403082521:=x:=en</platformToolSN>
+      <languageToolchainDir>/opt/microchip/mplabc30/v3.24/bin</languageToolchainDir>
+      <mdbdebugger version="1">
+        <placeholder1>place holder 1</placeholder1>
+        <placeholder2>place holder 2</placeholder2>
+      </mdbdebugger>
+      <runprofile version="6">
+        <args></args>
+        <rundir></rundir>
+        <buildfirst>true</buildfirst>
+        <console-type>0</console-type>
+        <terminal-type>0</terminal-type>
+        <remove-instrumentation>0</remove-instrumentation>
+        <environment>
+        </environment>
+      </runprofile>
+    </conf>
+  </confs>
+</configurationDescriptor>
diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
new file mode 100644 (file)
index 0000000..c1f155a
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644 (file)
index 0000000..bf17316
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>com.microchip.mplab.nbide.embedded.makeproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/make-project/1">
+            <name>AD2010</name>
+            <make-project-type>0</make-project-type>
+            <c-extensions>c</c-extensions>
+            <cpp-extensions/>
+            <header-extensions>h</header-extensions>
+            <sourceEncoding>UTF-8</sourceEncoding>
+            <make-dep-projects/>
+        </data>
+    </configuration>
+</project>
diff --git a/ring.c b/ring.c
new file mode 100644 (file)
index 0000000..0d29ea0
--- /dev/null
+++ b/ring.c
@@ -0,0 +1,65 @@
+#include "ring.h"
+
+/*
+       Ring Buffer用基本機能
+       write位置
+       read位置
+*/
+static unsigned char   r_write;
+static unsigned char   r_read;
+static unsigned char   r_num;
+
+/*
+*/
+void ring_init(void)
+{
+    r_write = 0;
+    r_read = 0;
+    r_num = RING_NUM;
+}
+/*
+    読み出し位置
+*/
+unsigned char ring_read_get(void)
+{
+    return r_read;
+}
+void ring_read_set(unsigned char i)
+{
+       r_read = i;
+}
+void ring_read_plus(void)
+{
+       r_read++;
+       if (r_read >= r_num) r_read = 0;
+}
+// 書き込み位置
+unsigned char ring_write_get(void)
+{
+    return r_write;
+}
+void ring_write_plus(void)
+{
+    r_write++;
+    if (r_write >= r_num) r_write = 0;
+}
+// 読み込んでいないデータ数
+unsigned char ring_num_get()
+{
+    signed char        i;
+
+    i = (signed char)r_write - (signed char)r_read;
+    if (i < 0) i += r_num;
+    return (unsigned char)i;
+}
+
+/*
+       パケットバッファフル?
+       1=Full
+       0=not Full
+*/
+unsigned char ring_is_full(void)
+{
+    if (ring_num_get() >= r_num - 1) return 1;
+    return 0;
+}
diff --git a/ring.h b/ring.h
new file mode 100644 (file)
index 0000000..6a80ed8
--- /dev/null
+++ b/ring.h
@@ -0,0 +1,24 @@
+
+#ifndef __RING_H__
+
+#define __RING_H__
+
+#define RING_NUM    6
+
+#define ring_clear()    ring_read_set(ring_write_get(t))
+
+void ring_init(void);
+//読み出し位置
+unsigned char ring_read_get(void);
+void ring_read_set(unsigned char i);
+void ring_read_plus(void);
+
+// 書き込み位置
+unsigned char ring_write_get(void);
+void ring_write_plus(void);
+
+unsigned char ring_num_get();
+unsigned char ring_is_full(void);
+
+#endif
+
diff --git a/ublox.c b/ublox.c
new file mode 100644 (file)
index 0000000..5e0cf14
--- /dev/null
+++ b/ublox.c
@@ -0,0 +1,408 @@
+#include <stdio.h>
+#include <string.h>
+
+#include "ublox.h"
+#include "myuart.h"
+
+// UBX packet内のデータ位置
+#define UBX_CLASS   2
+#define UBX_PAYLOAD 6
+// payload長さからパケット全体の長さ(checksum含む)をget
+#define UBX_PKTLEN(len_payload) (len_payload + 8)
+
+
+
+// ublox_rcv_pkt()用
+#define UBX_STS_HEAD1   0
+#define UBX_STS_HEAD2   1
+#define UBX_STS_CLASS   2
+#define UBX_STS_ID      3
+#define UBX_STS_LEN1    4
+#define UBX_STS_LEN2    5
+#define UBX_STS_PAYLOAD 6
+#define UBX_STS_SUMA    7
+#define UBX_STS_SUMB    8
+
+/*
+ len: payload length
+ */
+void ublox_make_sum(unsigned char *pkt, unsigned int lenp, unsigned char *suma, unsigned char *sumb)
+{
+    unsigned int    i;
+    *suma = 0;
+    *sumb = 0;
+    for(i = 0; i < lenp+4; i++) {
+        *suma += pkt[UBX_CLASS + i];
+        *sumb += *suma;
+    }
+}
+/*
+ * unsgined char len: payloadのバイト数
+ return: 作成したパケットpktのバイト数
+ */
+int ublox_make_cmd(unsigned char id1, unsigned char id2, unsigned int lenp, unsigned char *payload, unsigned char pkt[])
+{
+    unsigned char   suma, sumb;
+
+    pkt[0] = 0xb5;
+    pkt[1] = 0x62;
+    pkt[2] = id1;
+    pkt[3] = id2;
+    pkt[4] = (0xFF & lenp);
+    pkt[5] = (0xFF & (lenp >> 8));
+    memcpy(&pkt[UBX_PAYLOAD], payload, lenp);
+    ublox_make_sum(pkt, lenp, &suma, &sumb);
+    pkt[UBX_PAYLOAD + lenp] = suma;
+    pkt[UBX_PAYLOAD + lenp + 1] = sumb;
+    return UBX_PKTLEN(lenp);
+}
+/*
+ Debug用
+ * GPS送信パケットのモニタ出力
+ */
+void ublox_debug_pkt_out(unsigned char *pkt, int len)
+{
+    unsigned int i;
+    char    buf[16];
+
+    for(i = 0; i < len; i++) {
+        sprintf(buf, "%02X ", (unsigned char)(pkt[i] & 0xFF));
+        PDEBUG(buf);
+    }
+    PDEBUG("\r\n");
+}
+/*
+ ubloxにデータ送信
+ */
+void ublox_send(unsigned char *pkt, unsigned int len_pkt)
+{
+    unsigned int i;
+
+    for(i = 0; i < len_pkt; i++) {
+//        while(U1STAbits.UTXBF==1); /* Wait until TX buf read for new data */
+        while(uart1_tx_is_full());
+        uart1_putc(pkt[i]);
+
+    }
+}
+
+/*
+ * CFG-PRT
+ *  プロトコル選択
+*/
+void ublox_send_cfg_prt(unsigned long bps)
+{
+    const unsigned char   lenp = 20;
+    unsigned char   payload[lenp];
+    unsigned char   pkt[32];
+    unsigned int i;
+    unsigned int len_pkt;
+
+    payload[0] = 0x01;  // Port
+    payload[1] = 0x00;
+    payload[2] = 0x00;  // TxReady
+    payload[3] = 0x00;
+    // mode
+    payload[4] = 0b11010000;    // 8bit
+    payload[5] = 0b00001000;    // 1stop non-parity
+    payload[6] = 0x00;
+    payload[7] = 0x00;
+    // baudrate
+    payload[8] = (bps & 0xFF);
+    payload[9] = ((bps >> 8)& 0xFF);
+    payload[10] = ((bps >> 16)& 0xFF);
+    payload[11] = ((bps >> 24)& 0xFF);
+    payload[12] = 0x01;     // inProtoMask
+    payload[13] = 0x00;
+    payload[14] = 0x01;     // outProtoMask
+    payload[15] = 0x00;
+    payload[16] = 0x00;     // reserved
+    payload[17] = 0x00;
+    payload[18] = 0x00;
+    payload[19] = 0x00;
+
+    len_pkt = ublox_make_cmd(UBX_CLS_CFG, UBX_ID_CFG_PRT, lenp, payload, pkt);
+    ublox_send(pkt, len_pkt);
+
+}
+/*
+ CFG-NMEA
+ */
+void ublox_send_cfg_nmea(void)
+{
+    const unsigned char   lenp = 4;
+    unsigned char   payload[lenp];
+    unsigned char   pkt[32];
+    unsigned int len_pkt;
+
+    payload[0] = 0x00;
+    payload[1] = 0x23;
+    payload[2] = 0xFF;
+    payload[3] = 0x02;
+
+    len_pkt = ublox_make_cmd(UBX_CLS_CFG, 0x17, lenp, payload, pkt);
+    ublox_send(pkt, len_pkt);
+}
+/*
+ * CFG-MSG
+ * パケットの出力レートを指定
+ */
+void ublox_send_cfg_msg(void)
+{
+    const unsigned char   lenp = 3;
+    unsigned char   payload[lenp];
+    unsigned char   pkt[32];
+    unsigned int len_pkt;
+
+    payload[0] = UBX_CLS_NAV;
+    payload[1] = UBX_ID_NAV_TIMEUTC;
+    payload[2] = 1; // Rate[Hz]
+
+    len_pkt = ublox_make_cmd(UBX_CLS_CFG, UBX_ID_CFG_MSG, lenp, payload, pkt);
+    ublox_send(pkt, len_pkt);
+}
+/*
+ * CFG_TP5
+ * TIMEPULSE2
+ * AD用CLOCK出力
+ */
+void ublox_send_cfg_tp5_timepulse2(void)
+{
+    const unsigned char   lenp = 32;
+    unsigned char   payload[lenp];
+    unsigned char   pkt[64];
+    unsigned int len_pkt;
+
+    memset(payload, 0, lenp);
+
+    payload[0] = 0x01;  // Timepulse2
+
+    payload[4] = 50;    // cable delay ns
+
+//    payload[8] = 0x80;  // Freq 10MHz
+//    payload[9] = 0x96;
+//    payload[10] = 0x98;
+//    payload[11] = 0x00;
+
+    payload[8] = 0x00;  // Freq 7.372800MHz
+    payload[9] = 0x80;
+    payload[10] = 0x70;
+    payload[11] = 0x00;
+
+//    payload[12] = 0x80;  // Freq locked 10MHz
+//    payload[13] = 0x96;
+//    payload[14] = 0x98;
+//    payload[15] = 0x00;
+
+    payload[12] = 0x00;  // Freq locked 7.372800MHz
+    payload[13] = 0x80;
+    payload[14] = 0x70;
+    payload[15] = 0x00;
+
+    payload[16] = 00;   // Pulse Duty
+    payload[17] = 00;
+    payload[18] = 00;
+    payload[19] = 0x80;
+
+    payload[20] = 00;   // Pulse Duty locked
+    payload[21] = 00;
+    payload[22] = 00;
+    payload[23] = 0x80;
+
+    // gridUtcGps,ploarity,alignToTow,isLength,isFreq,lockedOtherSet,LockGpsFreq,Active
+    payload[28] = 0b11101111;   // Grid=GPS,Pol=Rise
+
+    len_pkt = ublox_make_cmd(UBX_CLS_CFG, UBX_ID_CFG_TP5, lenp, payload, pkt);
+    ublox_send(pkt, len_pkt);
+}
+
+/*
+ * CFG TP5
+ * TIMEPULSE1
+ * 1Hz OUT
+ */
+void ublox_send_cfg_tp5_timepulse1(void)
+{
+    const unsigned char   lenp = 32;
+    unsigned char   payload[lenp];
+    unsigned char   pkt[64];
+    unsigned int len_pkt;
+
+    memset(payload, 0, lenp);
+
+    payload[0] = 0x00; //Timepulse1
+
+    payload[4] = 50;    // cable delay ns
+
+    payload[8] = 0x40;  // Period us
+    payload[9] = 0x42;
+    payload[10] = 0x0F;
+    payload[11] = 0x00;
+
+    payload[12] = 0x40;  // Period Locked us
+    payload[13] = 0x42;
+    payload[14] = 0x0F;
+    payload[15] = 0x00;
+
+    payload[16] = 0x00;   // Pulse width us
+    payload[17] = 0x00;
+    payload[18] = 0x00;
+    payload[19] = 0x00;
+
+//    payload[20] = 0xA0;   // Pulse width locked 100,000us
+//    payload[21] = 0x86;
+//    payload[22] = 0x01;
+//    payload[23] = 0x00;
+
+    payload[20] = 0x20;   // Pulse width locked 500,000us
+    payload[21] = 0xA1;
+    payload[22] = 0x07;
+    payload[23] = 0x00;
+
+    payload[20] = 0x00;   // Pulse width locked 800,000us
+    payload[21] = 0x35;
+    payload[22] = 0x0C;
+    payload[23] = 0x00;
+
+
+    payload[28] = 0b11110111;   // Grid=GPS,Pol=Rise
+
+    len_pkt = ublox_make_cmd(UBX_CLS_CFG, UBX_ID_CFG_TP5, lenp, payload, pkt);
+    ublox_send(pkt, len_pkt);
+}
+
+
+#if 0
+void ublox_rcv_poll(void)
+{
+    unsigned int i, data;
+    char    buf[16];
+    unsigned char    buf_rcv[48];
+
+    // Header wait
+    for(i = 0; i < 1000; i++) {
+//        while(DataRdyUART1() == 0);
+//        data = ReadUART1();
+        while(U1STAbits.URXDA == 0);
+        data = U1RXREG;
+        if ((data & 0xFF) == 0xB5) break;
+    }
+    // rcv
+    for(i = 0; i < 48; i++) {
+        if (U1STAbits.OERR == 1) {
+            U1STAbits.OERR = 0;
+        }
+        buf_rcv[i]= U1RXREG;
+        while(U1STAbits.URXDA == 0);
+    }
+    // debug out
+    for(i = 0; i < 48; i++) {
+//        while(DataRdyUART1() == 0);
+//        data = ReadUART1();
+        sprintf(buf, "%02X ", buf_rcv[i]);
+        PDEBUG(buf);
+    }
+
+    PDEBUG("\r\n");
+}
+#endif
+void ublox_rcv_poll(void)
+{
+    unsigned int i, data;
+    char    buf[16];
+
+    // Header wait
+    for(i = 0; i < 1000; i++) {
+//        while(DataRdyUART1() == 0);
+//        data = ReadUART1();
+        while(uart1_rcvbuf_is_data() == 0);
+        data = uart1_rcvbuf_getc();
+        sprintf(buf, "%02X ", data);
+        PDEBUG(buf);
+    }
+}
+
+/*
+ * 受信バッファから1packet取り出す
+ * UART割り込み使用
+ * return
+ *  0=受信OK
+ *  -1=受信エラー or タイムアウト
+ */
+//TODO: timeout処理, timeout指定
+//TODO: check sum check
+int ublox_rcv_pkt(unsigned char *class, unsigned char *id, unsigned int *len, unsigned char *payload)
+{
+    unsigned int i, data;
+    char    sts = UBX_STS_HEAD1;
+    unsigned int ptr;
+    unsigned char   suma, sumb;
+
+    while(1) {
+        while(uart1_rcvbuf_is_data() == 0);
+        data = uart1_rcvbuf_getc();
+        switch(sts) {
+            case UBX_STS_HEAD1:
+                if (data == 0xB5) sts = UBX_STS_HEAD2;
+                break;
+            case UBX_STS_HEAD2:
+                if (data == 0x62) sts = UBX_STS_CLASS;
+                break;
+            case UBX_STS_CLASS:
+                *class = data;
+                sts = UBX_STS_ID;
+                break;
+            case UBX_STS_ID:
+                *id = data;
+                sts = UBX_STS_LEN1;
+                break;
+            case UBX_STS_LEN1:
+                *len = data;
+                sts = UBX_STS_LEN2;
+                break;
+            case UBX_STS_LEN2:
+                *len += ((data << 8) & 0xFF00);
+                ptr = 0;
+                sts = UBX_STS_PAYLOAD;
+                break;
+            case UBX_STS_PAYLOAD:
+                payload[ptr++] = data;
+                if (ptr >= *len) sts = UBX_STS_SUMA;
+                break;
+            case UBX_STS_SUMA:
+                suma = data;
+                sts = UBX_STS_SUMB;
+                break;
+            case UBX_STS_SUMB:
+                sumb = data;
+                return 0;
+        }
+    }
+}
+/*
+ * 受信バッファからACKまたはNAKを取り出す
+ * return
+ *  1=ACK受信
+ *  0=NACK受信
+ *  -1=timeout
+ */
+// TODO: timeout処理,timeoutを引数で指定
+int ublox_rcv_ack(void)
+{
+    unsigned char class, id;
+    unsigned int    len;
+    unsigned char   payload[128];
+
+    while(1) {
+        ublox_rcv_pkt(&class, &id, &len, payload);
+        if (class == 0x05 && id == 0x01) {
+            // ACK
+            PDEBUG("ACK\r\n");
+            return 1;
+        } else if (class == 0x05 && id == 0x00) {
+            // NACK
+            PDEBUG("NACK\r\n");
+            return 0;
+        }
+    }
+}
diff --git a/ublox.h b/ublox.h
new file mode 100644 (file)
index 0000000..6a12472
--- /dev/null
+++ b/ublox.h
@@ -0,0 +1,36 @@
+#ifndef __UBLOX_H__
+
+#define __UBLOX_H__
+
+#include "myuart.h"
+
+// UBXパケットID
+#define UBX_CLS_CFG  0x06
+#define UBX_CLS_NAV  0x01
+
+// CFG-
+#define UBX_ID_CFG_PRT  0x00
+#define UBX_ID_CFG_TP5  0x31
+#define UBX_ID_CFG_MSG  0x01
+// NAV-
+#define UBX_ID_NAV_TIMEUTC  0x21
+
+void ublox_make_sum(unsigned char *pkt, unsigned int lenp, unsigned char *suma, unsigned char *sumb);
+int ublox_make_cmd(unsigned char id1, unsigned char id2, unsigned int lenp, unsigned char *payload, unsigned char pkt[]);
+void ublox_debug_pkt_out(unsigned char *pkt, int len);
+void ublox_send(unsigned char *pkt, unsigned int len_pkt);
+
+void ublox_send_cfg_prt(unsigned long bps);
+void ublox_send_cfg_nmea(void);
+void ublox_send_cfg_tp5_timepulse2(void);
+void ublox_send_cfg_msg(void);
+
+void ublox_send_cfg_tp5_timepulse1(void);
+
+//void ublox_rcv_poll(void);
+#define ublox_rcvbuf_clear() uart1_rcvbuf_clear()
+
+int ublox_rcv_pkt(unsigned char *class, unsigned char *id, unsigned int *len, unsigned char *payload);
+int ublox_rcv_ack(void);
+
+#endif