查看5d的源代码
←
5d
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== First Tuning == === Change Net Type === net_type 网络类型: * 0 - GPRS * 1 - RS485 * 2 - Ethernet (NOT SUPPORT) * 3 - Zigbee (NOT SUPPORT) <source lang=c> typedef enum em_net_mod { em_net_gprs = 0, em_net_rs485, em_net_eth, em_net_zigbee } net_mod; </source> <source lang=bash> [root@mcuzone root]#cd /app [root@mcuzone /app]#sqlite3 ./gatherdb.db SQLite version 3.10.0 2016-01-06 11:01:07 Enter ".help" for usage hints. sqlite> select * from t_base_define; sqlite> .head on sqlite> .mode column sqlite> select * from t_base_define; f_id f_config_name f_config_value ---------- -------------- -------------- 1 primary_server 122.5.18.174 2 primary_dns 219.146.0.130 3 primary_port 9011 4 second_server 219.146.0.130 5 second_dns 219.146.0.130 6 second_port 9027 7 gateway_id 37060001 8 net_type 0 9 md5_key 863CA654 10 aes_key d41d8cd98f00b2 11 collect_mode 0 12 collect_cycle 15 13 report_mode 0 14 beat_cycle 2 15 svr_num 0001 16 appmd5 28a011de19210e sqlite> update t_base_define set f_config_value='1' where f_config_name='net_type'; sqlite> sqlite> select * from t_base_define; f_id f_config_name f_config_value ---------- -------------- -------------- 1 primary_server 122.5.18.174 2 primary_dns 219.146.0.130 3 primary_port 9011 4 second_server 219.146.0.130 5 second_dns 219.146.0.130 6 second_port 9027 7 gateway_id 37060001 8 net_type 15 9 md5_key 863CA654 10 aes_key d41d8cd98f00b2 11 collect_mode 0 12 collect_cycle 1 13 report_mode 0 14 beat_cycle 2 15 svr_num 0001 16 appmd5 28a011de19210e </source> <br><br> === Setup RTC === <source lang=bash> [root@mcuzone root]#date -s 2017.01.05-18:38:48 Thu Jan 5 18:38:48 CST 2017 [root@mcuzone root]#hwclock -w # write RTC to store the time [root@mcuzone root]#hwclock -r Thu Jan 5 18:38:56 2017 0.000000 seconds </source> <br><br> == Update APP == Your PC: <source lang=bash> $ sudo apt-get install nfs-kernel-server Config the nfs directory: $ sudo mkdir -p /tftpboot/rootfs $ cat /etc/exports /work/armv9 *(async,rw,insecure,insecure_locks,no_root_squash) $ sudo /etc/init.d/nfs-kernel-server restart </source> In collector: <source lang=bash> [root@mcuzone /app]#mount -o port=2049,nolock,proto=tcp -t nfs 192.168.1.72:/wor k/5d/src ./x [root@mcuzone /app]#ls x bin db include nfsroot src ubi.in chmod.sh dbtest.c lib sh src-x [root@mcuzone /app]#ls x/src-x Makefile main.c sysinit.c bsp.c meter_table.c uart_gprs.c commap.c notes.md uart_mbus_down485.c db.c queue.c uart_set.c elect.c read_heatmeter.c water.c gather_V1 readallmeters.c xml.c gprs.c rs485up.c include sysfuctions.c </source> Copy the gather_V1 into collector: <source lang=bash> [root@mcuzone /app]#cp x/src-x/gather_V1 . [root@mcuzone /app]#ls 1runapp.sh buff2.xml gather_V0 gatherdb.db rcS x buff1.xml buff3.xml gather_V1 log.txt runapp.sh </source> <br><br> == TODO == "使用485组网,是不允许信息主动上推的,必须等待上位要数, 如果多个集中器都往485总线上推数据, 会引发冲突" <source lang=cpp> void ReadAllMeters(void) { ...... ...... if (RPT_ACTIVE == atoi(sysconfig.f_config_value)) { //如果是主动上报, 则发送上报消息 lnetMod = g_sysConfigHex.netType; if (lnetMod != em_net_rs485) { //使用485组网,是不允许信息主动上推的,必须等待上位要数, 如果多个集中器都往485总线上推数据, 会引发冲突 ...... ...... } } ...... ...... } </source> <br><br> == ZLAN 5102 Config == [[文件:Zlan5130-config.png]] <br> == Uploaded XML Data == From collector: <source lang=xml> <?xml version="1.0" encoding="utf-8"?> <root> <common> <sadd>37060001</sadd> <oadd></oadd> <func_type>6</func_type> <oper_type>3</oper_type> </common> <trans> <total_meter_num>1</total_meter_num> <frame_idx>1</frame_idx> <meter_num>1</meter_num <time_node>2017-01-05 22:38:00</time_node> </trans> <row id="1"> <f_id>2375</f_id> <f_meter_type>40</f_meter_type> <f_device_id>3</f_device_id> <f_meter_address>00000000000087</f_meter_address> <f_timestamp>2017-01-05 22:38:43</f_timestamp> <f_time>2017-01-05 22:38:00</f_time> <f_pact_tot_elec>null</f_pact_tot_elec> <f_nact_tot_elec>null</f_nact_tot_elec> <f_preact_tot_elec>null</f_preact_tot_elec> <f_nreact_tot_elec>null</f_nreact_tot_elec> <f_act_tot_elec>null</f_act_tot_elec> <f_react_tot_elec>null</f_react_tot_elec> </row> </root> </source> <br> == NOTES == === Meter Type === * HEATMETER 0x20 * WATERMETER 0x10 * ELECTMETER 0x40 * GASMETER 0x30 * SENSORDEV 0x50 // RTU module of sensors <br> === ElectMeter Protocol === <source lang=cpp> /* * Format:串口设置, 读取电表数据标识符, 前导符个数, 通讯类型 (0:MBUS 1:485), 通讯协议类型(0:MODBUS 1:645) */ uint16 gELEC_METER_Table[ELECMETER_PROTO_SUM][5] = { {ELEC_COMSET_1, 0x0000, 0, ELEC_RS485, ELEC_PROTO_MODBUS}, //力创电表 -----idx: -0- {ELEC_COMSET_1, 0x0000, 0, ELEC_RS485, ELEC_PROTO_MODBUS}, //acrel DDSD1352单相电表 -----idx: -1- {ELEC_COMSET_1, 0x0000, 0, ELEC_RS485, ELEC_PROTO_MODBUS}, //acrel DTSF1352三相电表 -----idx: -2- {ELEC_COMSET_1, 0x0000, 0, ELEC_RS485, ELEC_PROTO_MODBUS}, //acrel PZ80-E4C三相电表 -----idx: -3- }; </source> <br> === Meter Channel === Only support: * RS485_DOWN_CHANNEL 7 <br> === Meter Config in Database === <source lang=bash> sqlite> .schema t_meter_info CREATE TABLE t_meter_info ( f_id integer primary key autoincrement, f_meter_type varchar(2), f_device_id varchar(4), f_meter_address varchar(14), f_meter_channel varchar(2), f_meter_proto_type varchar(2), f_install_pos varchar(50) ); sqlite> select * from t_meter_info; 18|40|3|00000000000001|7|0|3#地下室 19|20|4|11110020160429|1|0|3#under sqlite> .dump t_meter_info PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; INSERT INTO "t_meter_info" VALUES(18,'40','3','00000000000001','7','0','3#地下室'); INSERT INTO "t_meter_info" VALUES(19,'20','4','11110020160429','1','0','3#under'); COMMIT; </source> <br><br> == Hardware == === Serial Console === * CP2102_PIN26 --- ARM9_CORE_J2_32_DRXD * CP2102_PIN25 --- ARM9_CORE_J2_30_DTXD <br> === RS485_1 === * RS485_1_A+ --- MAX485_PIN6 * RS485_1_B- --- MAX485_PIN7 * MAX485_PIN4 --- ARM9_CORE_J2_68_TXD0 * MAX485_PIN1 --- ARM9_CORE_J2_69_RXD0 * MAX485_PIN2 & 3 --- ARM9_CORE_J1_69_PC30 <br> === RS485_2 === * RS485_2_A+ --- MAX485_PIN6 * RS485_2_B- --- MAX485_PIN7 * MAX485_PIN4 --- ARM9_CORE_J2_55_CANTX1 * MAX485_PIN1 --- ARM9_CORE_J2__57_CANRX1 * MAX485_PIN2 & 3 --- ARM9_CORE_J1_68_PC31 <br> == Reference == * DTSD106-M100 三相电子式电能表用户使用手册: http://www.go-gddq.com/down/2011-10/11102117032297.pdf * ZLAN5102-3 用户使用手册l: http://www.zlmcu.com/download/ZLAN5102-3.pdf <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br>
返回到
5d
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面