Cygwin的安装使用,及其软件包apt-cyg的配置使用,以及apt-cyg错误“/usr/bin/apt-cyg: line 25: $‘\r‘: command not found”解决

2023-05-16

  • 首先官网下载Cygwin的安装包,然后双击开始安装,如下选择:
    在这里插入图片描述
  • 接下来的安装地址你就随意了,一直下一步到,镜像地址的选择,选了国内的快一些,我这里就选了阿里,你也可以选择其他的:
    在这里插入图片描述
  • 接下来是很重要的一点,决定你后续软件安装的方便与否,先选 View中的 Full 然后一定要搜索下载一个 wget 就行了(wget上本来显示的是Skip,你双击这个Skip就好了):
    在这里插入图片描述
    一般来说,暂时装这一个就够了,后续有需要的软件,安装后进入到软件里再安装就行了,当然如果你有别的指定需求,你也可以在这个界面搜素并选择。
    然后就一直下一步,直到安装结束,至于你要不要桌面快捷方式和开始里创建相关文件夹就随你的意了:
    在这里插入图片描述
  • 打开软件后,很多软件应该都没有:
    在这里插入图片描述

接下来很重要一点,用记事本创建一个名为apt-cyg的文件,复制粘贴进去如下内容:

#!/bin/bash
# apt-cyg: install tool for Cygwin similar to debian apt-get
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Trans-code Design
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

if [ ${BASH_VERSINFO}${BASH_VERSINFO[1]} -lt 42 ]
then
  echo 'Bash version 4.2+ required'
  exit
fi

usage="\
NAME
  apt-cyg - package manager utility

SYNOPSIS
  apt-cyg [operation] [options] [targets]

DESCRIPTION
  apt-cyg is a package management utility that tracks installed packages on a
  Cygwin system. Invoking apt-cyg involves specifying an operation with any
  potential options and targets to operate on. A target is usually a package
  name, file name, URL, or a search string. Targets can be provided as command
  line arguments.

OPERATIONS
  install
    Install package(s).

  remove
    Remove package(s) from the system.

  update
    Download a fresh copy of the master package list (setup.ini) from the
    server defined in setup.rc.

  download
    Retrieve package(s) from the server, but do not install/upgrade anything.

  show
    Display information on given package(s).

  depends
    Produce a dependency tree for a package.

  rdepends
    Produce a tree of packages that depend on the named package.

  list
    Search each locally-installed package for names that match regexp. If no
    package names are provided in the command line, all installed packages will
    be queried.

  listall
    This will search each package in the master package list (setup.ini) for
    names that match regexp.

  category
    Display all packages that are members of a named category.

  listfiles
    List all files owned by a given package. Multiple packages can be specified
    on the command line.

  search
    Search for downloaded packages that own the specified file(s). The path can
    be relative or absolute, and one or more files can be specified.

  searchall
    Search cygwin.com to retrieve file information about packages. The provided
    target is considered to be a filename and searchall will return the
    package(s) which contain this file.

  mirror
    Set the mirror; a full URL to a location where the database, packages, and
    signatures for this repository can be found. If no URL is provided, display
    current mirror.

  cache
    Set the package cache directory. If a file is not found in cache directory,
    it will be downloaded. Unix and Windows forms are accepted, as well as
    absolute or regular paths. If no directory is provided, display current
    cache.

OPTIONS
  --nodeps
    Specify this option to skip all dependency checks.

  --version
    Display version and exit.
"

version="\
apt-cyg version 1

The MIT License (MIT)

Copyright (c) 2005-9 Stephen Jungels
"

function wget {
  if command wget -h &>/dev/null
  then
    command wget "$@"
  else
    warn wget is not installed, using lynx as fallback
    set "${*: -1}"
    lynx -source "$1" > "${1##*/}"
  fi
}

function find-workspace {
  # default working directory and mirror
  
  # work wherever setup worked last, if possible
  cache=$(awk '
  BEGIN {
    RS = "\n\\<"
    FS = "\n\t"
  }
  $1 == "last-cache" {
    print $2
  }
  ' /etc/setup/setup.rc)

  mirror=$(awk '
  /last-mirror/ {
    getline
    print $1
  }
  ' /etc/setup/setup.rc)
  mirrordir=$(sed '
  s / %2f g
  s : %3a g
  ' <<< "$mirror")

  mkdir -p "$cache/$mirrordir/$arch"
  cd "$cache/$mirrordir/$arch"
  if [ -e setup.ini ]
  then
    return 0
  else
    get-setup
    return 1
  fi
}

function get-setup {
  touch setup.ini
  mv setup.ini setup.ini-save
  wget -N $mirror/$arch/setup.bz2
  if [ -e setup.bz2 ]
  then
    bunzip2 setup.bz2
    mv setup setup.ini
    echo Updated setup.ini
  else
    echo Error updating setup.ini, reverting
    mv setup.ini-save setup.ini
  fi
}

function check-packages {
  if [[ $pks ]]
  then
    return 0
  else
    echo No packages found.
    return 1
  fi
}

function warn {
  printf '\e[1;31m%s\e[m\n' "$*" >&2
}

function apt-update {
  if find-workspace
  then
    get-setup
  fi
}

function apt-category {
  check-packages
  find-workspace
  for pkg in "${pks[@]}"
  do
    awk '
    $1 == "@" {
      pck = $2
    }
    $1 == "category:" && $0 ~ query {
      print pck
    }
    ' query="$pks" setup.ini
  done
}

function apt-list {
  local sbq
  for pkg in "${pks[@]}"
  do
    let sbq++ && echo
    awk 'NR>1 && $1~pkg && $0=$1' pkg="$pkg" /etc/setup/installed.db
  done
  let sbq && return
  awk 'NR>1 && $0=$1' /etc/setup/installed.db
}

function apt-listall {
  check-packages
  find-workspace
  local sbq
  for pkg in "${pks[@]}"
  do
    let sbq++ && echo
    awk '$1~pkg && $0=$1' RS='\n\n@ ' FS='\n' pkg="$pkg" setup.ini
  done
}

function apt-listfiles {
  check-packages
  find-workspace
  local pkg sbq
  for pkg in "${pks[@]}"
  do
    (( sbq++ )) && echo
    if [ ! -e /etc/setup/"$pkg".lst.gz ]
    then
      download "$pkg"
    fi
    gzip -cd /etc/setup/"$pkg".lst.gz
  done
}

function apt-show {
  find-workspace
  check-packages
  for pkg in "${pks[@]}"
  do
    (( notfirst++ )) && echo
    awk '
    $1 == query {
      print
      fd++
    }
    END {
      if (! fd)
        print "Unable to locate package " query
    }
    ' RS='\n\n@ ' FS='\n' query="$pkg" setup.ini
  done
}

function apt-depends {
  find-workspace
  check-packages
  for pkg in "${pks[@]}"
  do
    awk '
    @include "join"
    $1 == "@" {
      apg = $2
    }
    $1 == "requires:" {
      for (z=2; z<=NF; z++)
        reqs[apg][z-1] = $z
    }
    END {
      prpg(ENVIRON["pkg"])
    }
    function smartmatch(small, large,    values) {
      for (each in large)
        values[large[each]]
      return small in values
    }
    function prpg(fpg) {
      if (smartmatch(fpg, spath)) return
      spath[length(spath)+1] = fpg
      print join(spath, 1, length(spath), " > ")
      if (isarray(reqs[fpg]))
        for (each in reqs[fpg])
          prpg(reqs[fpg][each])
      delete spath[length(spath)]
    }
    ' setup.ini
  done
}

function apt-rdepends {
  find-workspace
  for pkg in "${pks[@]}"
  do
    awk '
    @include "join"
    $1 == "@" {
      apg = $2
    }
    $1 == "requires:" {
      for (z=2; z<=NF; z++)
        reqs[$z][length(reqs[$z])+1] = apg
    }
    END {
      prpg(ENVIRON["pkg"])
    }
    function smartmatch(small, large,    values) {
      for (each in large)
        values[large[each]]
      return small in values
    }
    function prpg(fpg) {
      if (smartmatch(fpg, spath)) return
      spath[length(spath)+1] = fpg
      print join(spath, 1, length(spath), " < ")
      if (isarray(reqs[fpg]))
        for (each in reqs[fpg])
          prpg(reqs[fpg][each])
      delete spath[length(spath)]
    }
    ' setup.ini
  done
}

function apt-download {
  check-packages
  find-workspace
  local pkg sbq
  for pkg in "${pks[@]}"
  do
    (( sbq++ )) && echo
    download "$pkg"
  done
}

function download {
  local pkg digest digactual
  pkg=$1
  # look for package and save desc file

  awk '$1 == pc' RS='\n\n@ ' FS='\n' pc=$pkg setup.ini > desc
  if [ ! -s desc ]
  then
    echo Unable to locate package $pkg
    exit 1
  fi

  # download and unpack the bz2 or xz file

  # pick the latest version, which comes first
  set -- $(awk '$1 == "install:"' desc)
  if (( ! $# ))
  then
    echo 'Could not find "install" in package description: obsolete package?'
    exit 1
  fi

  dn=$(dirname $2)
  bn=$(basename $2)

  # check the md5
  digest=$4
  case ${#digest} in
   32) hash=md5sum    ;;
  128) hash=sha512sum ;;
  esac
  mkdir -p "$cache/$mirrordir/$dn"
  cd "$cache/$mirrordir/$dn"
  if ! test -e $bn || ! $hash -c <<< "$digest $bn"
  then
    wget -O $bn $mirror/$dn/$bn
    $hash -c <<< "$digest $bn" || exit
  fi

  tar tf $bn | gzip > /etc/setup/"$pkg".lst.gz
  cd ~-
  mv desc "$cache/$mirrordir/$dn"
  echo $dn $bn > /tmp/dwn
}

function apt-search {
  check-packages
  echo Searching downloaded packages...
  for pkg in "${pks[@]}"
  do
    key=$(type -P "$pkg" | sed s./..)
    [[ $key ]] || key=$pkg
    for manifest in /etc/setup/*.lst.gz
    do
      if gzip -cd $manifest | grep -q "$key"
      then
        package=$(sed '
        s,/etc/setup/,,
        s,.lst.gz,,
        ' <<< $manifest)
        echo $package
      fi
    done
  done
}

function apt-searchall {
  cd /tmp
  for pkg in "${pks[@]}"
  do
    printf -v qs 'text=1&arch=%s&grep=%s' $arch "$pkg"
    wget -O matches cygwin.com/cgi-bin2/package-grep.cgi?"$qs"
    awk '
    NR == 1 {next}
    mc[$1]++ {next}
    /-debuginfo-/ {next}
    /^cygwin32-/ {next}
    {print $1}
    ' FS=-[[:digit:]] matches
  done
}

function apt-install {
  check-packages
  find-workspace
  local pkg dn bn requires wr package sbq script
  for pkg in "${pks[@]}"
  do

  if grep -q "^$pkg " /etc/setup/installed.db
  then
    echo Package $pkg is already installed, skipping
    continue
  fi
  (( sbq++ )) && echo
  echo Installing $pkg

  download $pkg
  read dn bn </tmp/dwn
  echo Unpacking...

  cd "$cache/$mirrordir/$dn"
  tar -x -C / -f $bn
  # update the package database

  awk '
  ins != 1 && pkg < $1 {
    print pkg, bz, 0
    ins = 1
  }
  1
  END {
    if (ins != 1) print pkg, bz, 0
  }
  ' pkg="$pkg" bz=$bn /etc/setup/installed.db > /tmp/awk.$$
  mv /etc/setup/installed.db /etc/setup/installed.db-save
  mv /tmp/awk.$$ /etc/setup/installed.db

  [ -v nodeps ] && continue
  # recursively install required packages

  requires=$(awk '$1=="requires", $0=$2' FS=': ' desc)
  cd ~-
  wr=0
  if [[ $requires ]]
  then
    echo Package $pkg requires the following packages, installing:
    echo $requires
    for package in $requires
    do
      if grep -q "^$package " /etc/setup/installed.db
      then
        echo Package $package is already installed, skipping
        continue
      fi
      apt-cyg install --noscripts $package || (( wr++ ))
    done
  fi
  if (( wr ))
  then
    echo some required packages did not install, continuing
  fi

  # run all postinstall scripts

  [ -v noscripts ] && continue
  find /etc/postinstall -name '*.sh' | while read script
  do
    echo Running $script
    $script
    mv $script $script.done
  done
  echo Package $pkg installed

  done
}

function apt-remove {
  check-packages
  cd /etc
  cygcheck awk bash bunzip2 grep gzip mv sed tar xz > setup/essential.lst
  for pkg in "${pks[@]}"
  do

  if ! grep -q "^$pkg " setup/installed.db
  then
    echo Package $pkg is not installed, skipping
    continue
  fi

  if [ ! -e setup/"$pkg".lst.gz ]
  then
    warn Package manifest missing, cannot remove $pkg. Exiting
    exit 1
  fi
  gzip -dk setup/"$pkg".lst.gz
  awk '
  NR == FNR {
    if ($NF) ess[$NF]
    next
  }
  $NF in ess {
    exit 1
  }
  ' FS='[/\\\\]' setup/{essential,$pkg}.lst
  esn=$?
  if [ $esn = 0 ]
  then
    echo Removing $pkg
    if [ -e preremove/"$pkg".sh ]
    then
      preremove/"$pkg".sh
      rm preremove/"$pkg".sh
    fi
    mapfile dt < setup/"$pkg".lst
    for each in ${dt[*]}
    do
      [ -f /$each ] && rm /$each
    done
    for each in ${dt[*]}
    do
      [ -d /$each ] && rmdir --i /$each
    done
    rm -f setup/"$pkg".lst.gz postinstall/"$pkg".sh.done
    awk -i inplace '$1 != ENVIRON["pkg"]' setup/installed.db
    echo Package $pkg removed
  fi
  rm setup/"$pkg".lst
  if [ $esn = 1 ]
  then
    warn apt-cyg cannot remove package $pkg, exiting
    exit 1
  fi

  done
}

function apt-mirror {
  if [ "$pks" ]
  then
    awk -i inplace '
    1
    /last-mirror/ {
      getline
      print "\t" pks
    }
    ' pks="$pks" /etc/setup/setup.rc
    echo Mirror set to "$pks".
  else
    awk '
    /last-mirror/ {
      getline
      print $1
    }
    ' /etc/setup/setup.rc
  fi
}

function apt-cache {
  if [ "$pks" ]
  then
    vas=$(cygpath -aw "$pks")
    awk -i inplace '
    1
    /last-cache/ {
      getline
      print "\t" vas
    }
    ' vas="${vas//\\/\\\\}" /etc/setup/setup.rc
    echo Cache set to "$vas".
  else
    awk '
    /last-cache/ {
      getline
      print $1
    }
    ' /etc/setup/setup.rc
  fi
}

if [ -p /dev/stdin ]
then
  mapfile -t pks
fi

# process options
until [ $# = 0 ]
do
  case "$1" in

    --nodeps)
      nodeps=1
      shift
    ;;

    --noscripts)
      noscripts=1
      shift
    ;;

    --version)
      printf "$version"
      exit
    ;;

    update)
      command=$1
      shift
    ;;

    list | cache  | remove | depends | listall  | download | listfiles |\
    show | mirror | search | install | category | rdepends | searchall )
      if [[ $command ]]
      then
        pks+=("$1")
      else
        command=$1
      fi
      shift
    ;;

    *)
      pks+=("$1")
      shift
    ;;

  esac
done

set -a

if type -t apt-$command | grep -q function
then
  readonly arch=${HOSTTYPE/i6/x}
  apt-$command
else
  printf "$usage"
fi

注意:
- 写完保存后,一定要把这个文件的后缀名给删掉啊,用记事本写的,就一定要去掉.txt,特别有些没开显示文件扩展名的,你看着文件叫apt-cyg,但它是由扩展名的,没显示而已
- 文本写完后,用vscode打开,把windows下的换行符CRLF改成linux下的LF:
在这里插入图片描述
不然,你后续使用的时候应该就会得到一个这样的错误:
在这里插入图片描述
当然,你也可以在linux系统上编辑好,再下载下来,我这里也再分享一个百度网盘,提取码:4hr4,可以直接使用这个文件。

  • 接下来,把刚刚的apt-cyg文件剪贴到Cygwin安装目录的bin文件夹里(记不得安装在哪里的,就桌面右键点击快捷方式,选择打开文件所在的位置)。
  • 然后就可以愉快的安装相关需求软件了,甚至都不用重启:
    在这里插入图片描述

最后你还可以把Cygwin的bin目录添加进环境变量,这样你就可以在cmd或是powershell中使用linux的命令,如whereis、which等。但是要注意一点哦,环境变量添加多了,可能与你原来的一些环境变量中的同名程序冲突哦,因为先后顺序的问题就可能会出现一些意外的奇怪的情况,所以慎用,除非你很清楚你的环境变量,你也知道你在干嘛!

希望能帮到你~

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Cygwin的安装使用,及其软件包apt-cyg的配置使用,以及apt-cyg错误“/usr/bin/apt-cyg: line 25: $‘\r‘: command not found”解决 的相关文章

  • Keil工程添加源文件和头文件(.c和.h)的方法

    在此把Keil项目添加源文件和头文件的方法做个记录 xff1a 1 Keil项目添加源文件和头文件的方法之一 1 1 右键点击项目名称 xff0c 弹出菜单中选择Add Group xff0c 我们把所有需要添加的源文件都放在这个Group
  • 漂亮的html表格

    原文 xff1a http www textfixer com resources css tables php css table01 一个像素边框的表格 xff1a Info Header 1 Info Header 2 Info He
  • SIPp之认证注册

    欢迎大家转载 xff0c 为保留作者成果 xff0c 转载请注明出处 xff0c http blog csdn net netluoriver xff0c 有些文件在资源中也可以下载 xff01 如果你没有积分 xff0c 可以联系我 xf
  • HTTP:DIGEST认证的请求和响应报文

    以下是HTTP DIGEST认证的请求和响应报文的例子 xff0c 供以后参考 IE first request GET boe checkedServlet HTTP 1 1 Accept image gif image jpeg ima
  • Linux配置篇 | Ubuntu配置apt镜像源

    以下以 Ubuntu18 04 LTS 为例 xff0c 也适用于 Ubuntu 其他版本 一 修改apt镜像源 xff08 1 xff09 备份apt配置文件 xff1a cp etc apt sources list etc apt s
  • STC89C52RC单片机额外篇 | 04 - 认识头文件<intrins.h>与_nop_函数

    1 lt intrins h gt 头文件 头文件 lt intrins h gt 在我们51单片机日常开发中经常使用 xff0c 特别是 nop 函数 xff0c 以下是 lt intrins h gt 的内容 xff1a span cl
  • HTTP协议详解 - 通过C++实现HTTP服务剖析HTTP协议

    前言 C C 43 43 程序员一般很少会接触到HTTP服务端的东西 xff0c 所以对HTTP的理解一般停留在理论 本文章实现通过C 43 43 实现了一个http服务 xff0c 可以通过代码对HTTP协议有更深的理解 xff0c 并且
  • GIT 中如何打标签

    前言0x1 GIT 标签常用指令0x2 轻量标签0x3 附注标签0x4 远程仓库中的标签 前言 在我们开发的过程中 xff0c 可能经过多次 commit 提交才会确定一个版本 xff0c 那么除了用 commit comments 来标识
  • 用VSCode开发C++项目

    写在前面 最近在新学C 43 43 xff0c 又不想用VisualStudio那么庞大的IDE xff0c VS体量稍微有那么点笨重 xff08 主要还是因为穷 xff0c 没钱换电脑 xff0c 目前的电脑开个VS要个两三分钟 xff0
  • petalinux2018.3 error 记录

    petalinux config get hw description 61 报错 INFO sourcing bitbake ERROR Failed to source bitbake ERROR Failed to config pr
  • petalinux 编译,源码编译

    1 测试环境 Ubuntu 16 04PetaLinux 2019 1PetaLinux 2019 1 ZCU106 BSPZCU106 2 PetaLinux介绍 PetaLinux是Xilinx基于Yocto推出的Linux开发工具 Y
  • Optitrack Motive软件安装及使用说明

    Motive 软件安装程序 http www naturalpoint com optitrack downloads motive html 安装Motive需要安装两个底层插件 xff0c Directx aug2009 redist
  • Failed to get convolution algorithm. This is probably because cuDNN failed to initialize

    Failed to get convolution algorithm This is probably because cuDNN failed to initialize from tensorflow compat v1 import
  • C语言---整型字符串转换

    C语言提供了几个标准库函数 xff0c 可以将任意类型 整型 长整型 浮点型等 的数字转换为字符串 以下是用itoa 函数将整数转 换为字符串的一个例子 xff1a include lt stdio h gt include lt stdl
  • 约瑟夫环(C语言单项循环链表)

    约瑟夫环 C 语言单项循环链表 约瑟夫环 问题描述 xff1a 约瑟夫问题的一种描述是 xff1a 编号为1 xff0c 2 xff0c xff0c n 的n 个人按顺时针方向围坐一圈 xff0c 每人持一个密码 xff08 正整数 xff
  • 交换机VLAN的定义、意义以及划分方式

    什么是VLAN 虚拟网技术 xff08 VLAN xff0c Virtual Local Area Network xff09 的诞生主要源于广播 广播在网络中起着非常重要的作用 xff0c 如发现新设备 调整网络路径 IP地址租赁等等 x
  • coredump简介与coredump原因总结

    coredump简介与coredump原因总结 什么是coredump xff1f 通常情况下coredmp包含了程序运行时的内存 xff0c 寄存器状态 xff0c 堆栈指针 xff0c 内存管理信息等 可以理解为把程序工作的当前状态存储
  • 嵌入式设备web服务器比较

    现在在嵌入式设备中所使用的web服务器主要有 xff1a boa thttpd mini httpd shttpd lighttpd goaheand appweb和apache等 Boa 1 介绍 Boa诞生于1991年 xff0c 作者
  • memfd.c:40:12: error: static declaration of ‘memfd_create’ follows non-static declaration

    qemu编译安装出错 xff1a memfd c 40 12 error static declaration of memfd create follows non static declaration 修改 xff1a a util m
  • windows10 驱动开发环境 VS2019+WDK10

    windows10 驱动开发环境 1 下载SDK https developer microsoft com zh cn windows downloads windows 10 sdk 通用驱动demo xff1a https githu

随机推荐

  • 在用户配置文件中添加 IDF_PATH 和 idf.py PATH

    在用户配置文件中添加 IDF PATH 和 idf py PATH CMake 英文 注解 本文档将介绍如何使用 CMake 编译系统 目前 xff0c CMake 编译系统仍处于预览发布阶段 xff0c 如您在使用中遇到任何问题 xff0
  • error C3861: “gets”: 找不到标识符

    error C3861 gets 找不到标识 把 gets 改成 gets s 用VS2015打开一个win32工程 xff0c 生成解决方案失败 报错信息 xff1a 命令行 error D8016 ZI 和 Gy 命令行选项不兼容 选中
  • ROS和Optitrack通信

    ROS xff1a indigo Ubuntu xff1a 14 04 目的 xff1a 一台计算机通过Optitrack获得刚体 xff08 crazyflie2 0 xff09 的姿态信息并广播到同一局域网的其他计算机上 xff08 如
  • 运算放大电路(三)-加法器

    加法器 由虚短知 xff1a V 61 V 43 61 0 a 由虚断及基尔霍夫定律知 xff0c 通过R2与R1的电流之和等于通过R3的电流 xff0c 故 V1 V R1 43 V2 V R2 61 Vout V R3 b 代入a式 x
  • 一个嵌入式硬件高手的设计心得

    一 xff1a 成本节约 现象一 xff1a 这些拉高 拉低的电阻用多大的阻值关系不大 xff0c 就选个整数5K吧 点评 xff1a 市场上不存在5K的阻值 xff0c 最接近的是 4 99K xff08 精度1 xff09 xff0c
  • 跟着我从零开始入门FPGA(一周入门系列)第五

    5 同步和异步设计 前面已有铺垫 xff0c 同步就是与时钟同步 同步就是走正步 xff0c 一二一 xff0c 该迈哪个脚就迈那个脚 xff0c 跑的快的要等着跑的慢的 异步就是搞赛跑 xff0c 各显神通 xff0c 尽最大力量去跑 x
  • 硬件原理图设计规范(二)

    1 可编程逻辑器件 编号 级别 条目内容 备注 1 推荐 FPGA的LE资源利用率要保证在50 xff5e 80 之间 xff0c EPLD的MC资源的利用率要保证在50 xff5e 90 之间 对于FPGA中的锁相环 RAM 乘法器 DS
  • 嵌入式Linux应用程序开发-TCP-IP网络通信应用程序

    作为全世界最优秀的开源操作系统 xff0c Linux内部已经集成了强大的网络协议栈 xff0c 并向应用层提供丰富的系统调用 xff0c 开发者可以基于通用的系统调用接口 xff0c 使用Linux内核提供的网络功能 如果要分析Linux
  • STM32“死机“(实用调试技巧)

    2 硬件环境导致 34 死机 34 1 供电电源电压不在合适范围 单片机都需要有一个能够稳定运行的电压工作范围 xff0c 如果低于或者高于正常工作电压范围其单片机并不一定会立马无法工作 也有可能会立马死机 xff0c 而是工作一段时间在某
  • TI的ADS8320使用说明

    在调试程序的过程中遇到一个奇怪的现象 xff0c 使用ADS8320的16位AD采样温度数据 xff0c 在实际使用过程中遇到问题 xff0c 记录如下 xff1a 初始化 ADS8320 拉低片选 读取16位数据 拉高片选 使用STM32
  • [C++] 模板函数声明与实现的分离

    在使用模板时 xff0c 一般要求定义与实现在一起 xff0c 那么为了程序的统一与美观 xff0c 若想在仅在头文件中定义 xff0c 在源文件中实现 xff0c 例如 xff1a span class token comment tem
  • Android List 排序

    Android List lt Point gt 排序 1 按照x来排序 1 1升序 List points xff1b Collections sort points new Comparator 64 Override public i
  • Android反射机制

    Android反射机制实例 创建一个测试类 Person public class Person private String name 61 34 张三 34 private int age 61 15 private String de
  • 将json字符串转换为自定义对象

    将json字符串转换为自定义对象 将json转自定义对象或者List String json 61 34 34 name 34 cece 34 Gson gson 61 new Gson Person person1 61 gson fro
  • 启动一个没有注册的Activity

    废话不多说 xff0c 直接上代码 xff0c 如有不明白的可以私信留言 xff0c 一起进步 在Application 中调用即可 AndroidManifest 中已经有注册过的activity class App extends Ap
  • 将List<Object>集合(汉字、字母、数字)按照拼音来排序

    目录 将List xff1c Object xff1e 集合按照拼音来排序 1 需求 2 使用系统自带的compareTo可以排序汉字 xff0c 如果其中混入了字母 xff08 纯字母 xff09 xff0c 会直接排在汉字之前 xff0
  • 手写findviewbyid和使用注解给变量赋值

    手写findviewbyid和使用注解给变量赋值 使用到注解和反射 注解本身没有什么含义 xff0c 只有配合反射和插桩技术时才能体现价值 我们平时要初始化view都需要调用findviewbyid xff0c 那我们可不可以省去这一步呢
  • Android Studio 内无法直接运行 main 方法

    Android Studio 内无法直接运行 main 方法 在 idea 下的 gradle xml 下 GradleProjectSettings 结点增加以下代码 span class token operator lt span o
  • Android 获取文件类型

    根据文件头获取文件类型 我这里只列举了4种 xff0c 其他种类只需要替换掉对应的判断即可 span class token operator span span class token operator span span class t
  • Cygwin的安装使用,及其软件包apt-cyg的配置使用,以及apt-cyg错误“/usr/bin/apt-cyg: line 25: $‘\r‘: command not found”解决

    首先官网下载Cygwin的安装包 xff0c 然后双击开始安装 xff0c 如下选择 xff1a 接下来的安装地址你就随意了 xff0c 一直下一步到 xff0c 镜像地址的选择 xff0c 选了国内的快一些 xff0c 我这里就选了阿里