• 大小: 97KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-03
  • 语言: 其他
  • 标签: 485通讯  

资源简介

经典485通讯程序,带CRC校验,用于和下位机通讯,芯片用的是AVR

资源截图

代码片段和文件信息

#include “Connect_Ups.h“

uint  asc_hex(uchar dotuchar *dt)
{
    long unsigned int tmp;
    unsigned char ik;
    k=strlen((char *)dt);
    for(i=0;i    {
        if(dt[i]==‘.‘) k=i;
    }
    tmp=0;
    for(i=0;i    {
        if(dt[i]!=‘ ‘)
        {
            tmp=tmp*10+(dt[i]&0x0f);
        }
    }
    tmp=tmp*10;
    if((k+1)        tmp=tmp+(dt[k+1]&0x0f);
    if(dot==S2D0||dot==S3D0||dot==S5D0||dot==S4D0)
        tmp=tmp/10;
    if((dot==S2D2)|(dot==S3D2))
    {
        tmp=tmp*10;
        if((k+2)        tmp=tmp+(dt[k+2]&0x0f);
    }
    if(tmp>60000)
        tmp=65535;
    return (uint)tmp;
}






 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-10-27 20:49  Connect_Ups\
     文件         714  2011-08-04 13:44  Connect_Ups\asc_hex.c
     文件          56  2011-08-04 13:44  Connect_Ups\asc_hex.h
     文件        3405  2011-08-04 13:44  Connect_Ups\Connect_Ups.aps
     文件         761  2011-08-08 09:59  Connect_Ups\connect_ups.aws
     文件        2492  2011-08-04 13:44  Connect_Ups\Connect_Ups.c
     文件        2124  2011-08-04 13:44  Connect_Ups\Connect_Ups.h
     文件        4292  2011-08-04 13:44  Connect_Ups\crc.c
     文件         182  2011-08-04 13:44  Connect_Ups\crc.h
     目录           0  2011-10-27 20:49  Connect_Ups\DebugRel\
     文件        4304  2011-08-04 13:44  Connect_Ups\DebugRel\asc_hex.o
     文件        4456  2011-08-04 13:44  Connect_Ups\DebugRel\Connect_Ups.o
     文件        4528  2011-08-04 13:44  Connect_Ups\DebugRel\crc.o
     文件       14832  2011-08-04 13:44  Connect_Ups\DebugRel\downcom.o
     文件        9268  2011-08-04 13:44  Connect_Ups\DebugRel\ISR.o
     文件       21846  2011-08-04 13:44  Connect_Ups\DebugRel\UPS.elf
     文件       37839  2011-08-04 13:44  Connect_Ups\DebugRel\UPS.map
     目录           0  2011-10-27 20:49  Connect_Ups\default\
     文件        4216  2011-08-05 13:13  Connect_Ups\default\asc_hex.o
     文件       21442  2011-08-05 13:13  Connect_Ups\default\Connect_Ups.elf
     文件        9464  2011-08-05 13:13  Connect_Ups\default\Connect_Ups.hex
     文件       68126  2011-08-05 13:13  Connect_Ups\default\Connect_Ups.lss
     文件       19908  2011-08-05 13:13  Connect_Ups\default\Connect_Ups.map
     文件        4372  2011-08-05 13:13  Connect_Ups\default\Connect_Ups.o
     文件        4444  2011-08-05 13:13  Connect_Ups\default\crc.o
     目录           0  2011-10-27 20:49  Connect_Ups\default\dep\
     文件        1956  2011-08-05 13:13  Connect_Ups\default\dep\asc_hex.o.d
     文件        1964  2011-08-05 13:13  Connect_Ups\default\dep\Connect_Ups.o.d
     文件        1948  2011-08-05 13:13  Connect_Ups\default\dep\crc.o.d
     文件        1956  2011-08-05 13:13  Connect_Ups\default\dep\downcom.o.d
     文件        1948  2011-08-05 13:13  Connect_Ups\default\dep\ISR.o.d
............此处省略9个文件信息

评论

共有 条评论