| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c/c++ >> C++ shi xian yong zhang shang dian nao yao kong dian shi

C++ shi xian yong zhang shang dian nao yao kong dian shi

2008-06-01 02:04:55 编辑來源:互联网 评论
 
 
 
本文为【C++实现用掌上电脑遥控电视】的拼音翻译版
  1. jian jie
  ni shi fou zeng xiang guo tong guo ni de zhang shang dian nao shang de IR duan kou kong zhi ni de TV、Hi-Fi huo zhe qi ta shi pin ? ben wen jiang jie shao zen yang shi yong zhang shang dian nao zhong de IR duan kou lai bian cheng kong zhi yi tai TV。
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  2. bei jing
  wo jin xie ri zi diu shi le wo de lao shi suo ni TV de yao kong qi 。 zhe ben shen mei you shen me wen ti , yin wei wo mai le ge xin de yao kong qi zuo wei dai ti 。 ran er , dang dian shi shi qu le ta de she ding de yan se shi , wo peng dao le wen ti , yin wei ta zhi neng xian shi hei bai se le , er xin de yao kong qi mei you yan se tiao zheng an niu 。 wo jue ding zai wo de lao shi de Jornada 525 zhang shang dian nao shang xie yi ge cheng xu shi yong IR duan kou ba zheng que de dai ma fa song gei TV。
  gong you san ge zhu yao xie yi ke yi yong yu fa song IR dai ma dao she bei shang 。 suo ni TV shi yong ’Pulse Coded’ fang fa , ta xu yao fa song yi ge bao han tou (header) wei de yi kong ge ge kai de ’1’ wei he ’0’ wei de shu ju liu 。 zhe xie wei bei tiao zhi cheng yi zhong 40KHz de zai bo xin hao 。 qi zhong , tou chang du wei 2200 μs,’1’ wei wei 110 μs,’0’ wei wei 550 μs, er kong ge shi 550μs de chen mo (silence)。 da duo shu suo ni she bei shi yong 12 wei shu ju , ta bei fen li cheng 6 wei de di zhi ( she bei lei xing ) he 6 wei ming ling 。 yin ci shu ju kan qi lai xiang zhe ge yang zi :hxxxxxxyyyyyy, qi zhong h shi tou wei ,xxxxxx shi 6 wei de ming ling (msb first),yyyyyy shi 6 wei de di zhi 。 dui ci wo bu zai xi shu , yin wei wang shang you hen duo zi yuan miao shu zhe zhong xie yi , bing lie ju le zhen dui bu tong she bei de dai ma 。 yi xie xin de suo ni she bei shi yong 19 wei dai ma , wo xiang xin ling wai de zhi zao shang ye shi yong he wo miao shu de xiang tong de ge shi 。 huan you ke neng wei shi yong ’Space Coded’ huo ’Shift Coded’ xie yi de she bei xie chu xiang si de lei 。
  wo zeng shi yong qian ru shi C++ xie guo yi ge lei CirPulse, ta feng zhuang le cong yi tai yun xing Windows CE 3.0 de Jornada 525 PC shang kong zhi suo ni ji qi xiang pi pei she bei de gong neng 。 gu ji ta neng gou yu qi ta xiang pi pei she bei he cao zuo xi tong yi qi gong zuo , dan shi ni xu yao shi yan cai xing !
  
C++实现用掌上电脑遥控电视
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo
  3. shi xian guo cheng fen xi
  zhe ge CIrPulse lei bao lu le ji ge han shu , ta men shi de fa song IR dai ma jin ke neng qing yi 。 zai sheng ming CIrPulse lei shi , ni ying gai tiao yong yi ci FindIrPort(), ta fan hui yi ge miao shu IrDA duan kou de duan kou hao de UINT, zhe tong guo sou suo zhu ce biao de dao 。
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  zhe ge duan kou hao yong yu hou mian de tiao yong lai da kai IrDA duan kou jin xing chuan xing tong xun 。
  UINT CIrPulse::FindIrPort()
  {
  // cha xun zhu ce biao zhong de IR duan kou hao
  HKEY hKey = NULL;
  if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Comm\IrDA"),0, 0, &hKey) == ERROR_SUCCESS)
  {
  DWord dwType = 0;
  DWORD dwData = 0;
  DWORD dwSize = sizeof(dwData);
  if (RegQueryValueEx(hKey, _T("Port"), NULL, &dwType, (LPBYTE) &dwData, &dwSize) == ERROR_SUCCESS)
  {
  if (dwType == REG_DWORD && dwSize == sizeof(dwData))
  {
  RegCloseKey(hKey);
  
   return (UINT) dwData;
  }
  }
  RegCloseKey(hKey);
  }
  return 0;
  }
  de dao duan kou hao hou , ni ke yi tiao yong Open(UINT) han shu , ba tong guo tiao yong FindIrPort() de dao de duan kou hao chuan di guo qu 。 zhe da kai gai duan kou bing she zhi chuan kou shen shu , jia ru cheng gong fan hui true。 gai duan kou bei she zhi wei 115200 bo te ,8 ge shu ju wei ,2 ge ting zhi wei he qi ou xiao yan wei 。 guan yu ru he chan sheng zai bo yi ji wei shen me wo shi yong zhe xie she zhi jiang zai ben wen hou mian jie shao 。
  BOOL CIrPulse::Open(UINT uiport)
  {
  ASSERT(uiPort > 0 && uiPort <= 255);
  Close();
  // da kai IRDA duan kou
  CString strPort;
  strPort.Format(_T("COM%d:"), uiPort);
  m_irPort = CreateFile((LPCTSTR) strPort, GENERIC_READ GENERIC_WRITE,0, NULL, OPEN_EXISTING, 0, NULL);
  if (m_irPort == INVALID_HANDLE_VALUE)
  {
  return FALSE;
  }
  // she zhi shu ru he shu chu huan chong qu de da xiao
  VERIFY(SetupComm(m_irPort, 2048, 2048));
  // qing chu du he xie huan chong qu
  VERIFY(PurgeComm(m_irPort,PURGE_TXABORTPURGE_RXABORT
  PURGE_TXCLEARPURGE_RXCLEAR));
  // chong xin chu shi hua suo you de IRDA duan kou she zhi
  DCB dcb;
  dcb.DCBlength = sizeof(DCB);
  VERIFY(GetCommState(m_irPort, &dcb));
  dcb.BaudRate = CBR_115200;
  dcb.fBinary = TRUE;
  dcb.fParity = TRUE;
  dcb.fOutxCtsFlow = FALSE;
  dcb.fOutxDsrFlow = FALSE;
  dcb.fDtrControl = DTR_CONTROL_DISABLE;
  dcb.fDsrSensitivity = FALSE;
  dcb.fTXContinueOnXoff = FALSE;
  dcb.fOutX = FALSE;
  dcb.fInX = FALSE;
  dcb.fErrorChar = FALSE;
  dcb.fNull = FALSE;
  dcb.fRtsControl = RTS_CONTROL_DISABLE;
  dcb.fAbortOnError = FALSE;
  dcb.ByteSize = 8;
  dcb.Parity = EVENPARITY;
  dcb.StopBits = TWOSTOPBITS;
  VERIFY(SetCommState(m_irPort, &dcb));
  // wei suo you de du he xie cao zuo she zhi chao shi zhi
  COMMTIMEOUTS timeouts;
  VERIFY(GetCommTimeouts(m_irPort, &timeouts));
  timeouts.ReadIntervalTimeout = MAXDWORD;
  timeouts.ReadTotalTimeoutMultiplier = 0;
  timeouts.ReadTotalTimeoutConstant = 0;
  timeouts.WriteTotalTimeoutMultiplier = 0;
  timeouts.WriteTotalTimeoutConstant = 0;
  VERIFY(SetCommTimeouts(m_irPort, &timeouts));
  DWORD dwEvent=EV_TXEMPTY;
  SetCommMask(m_irPort,dwEvent);
  return TRUE;
  }
C++实现用掌上电脑遥控电视
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo
  tiao yong han shu SetCodeSize(DWORD) lai she zhi yao chuan song de wei shu ( ru 12 wei )。 zhe ke yi zai ren he shi hou wan cheng qie zhi xu yao zuo yi ci 。 ta yi zhi bao chi you xiao , zhi dao hou mian de tiao yong gai bian ta wei zhi 。
  zui hou tiao yong SendCode(long), chuan di shi ji yao fa song de dai ma 。
  BOOL CIrPulse::SendCode(DWORD lValue)
  {
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  DWORD dwCount;
  int i=0;
  ASSERT(iDataLength>0);
  // qing chu chuan song huan chong qu
  VERIFY(PurgeComm(m_irPort,PURGE_TXABORT PURGE_RXABORT PURGE_TXCLEAR PURGE_RXCLEAR));
  
   // mei ci an jian she zhi dai ma 6 ci
  for(int x=0;x<6;x++) {
  MakeStream(lValue); // fa song dai ma
  dwCount=GetTickCount();
  while(GetTickCount()<dwCount+26) // yan chi 26ms
  i++;
  }
  return true;
  }
  zhu chong zhe ge han shu tiao yong ling wai yi ge han shu MakeStream(long)6 ci , mei liang ci tiao yong zhi jian ting dun 26 hao miao 。 wo fa xian gai dai ma bi xu fa song hao ji ci cai neng shi jie shou she bei xiang ying , da gai shi wei fang zhi jia xing wei de yuan gu ba 。26 hao miao dui yu jie shou she bei deng ji gai dai ma shi bi xu de , zai xia yi ge dai ma chu xian zhi qian 。
  zhe ge han shu MakeStream(long) ba zi jie liu xie ru IrPort, bing gen ju shi fou you qi shi wei (1 huo zhe 0) lai que bao fa song zheng que de shu ju bao chang du 。 bao han shu ju zi jie (0xdb) de huan chong qu shi yi yi ge ByteArray xing shi cun zai de 。
  han shu Close() yong yu zai duan kou shi yong hou , zi ran di guan bi IrPort。
  
C++实现用掌上电脑遥控电视
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo
  zhe ge han shu zai wo de ornada shang yun xing liang hao 。 qing kan xia mian de tao lun yi jin yi bu que ding ni yao zuo de ke neng xing gai bian 。
  BOOL CIrPulse::MakeStream(DWORD lValue) {
  DWORD dwStreamLength;
  // chuang jian kai shi mai chong
  dwStreamLength=iHPulse/charWidth;
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  ASSERT(Write((const char *)bPulseStream.GetData(),
  dwStreamLength)==dwStreamLength);
  // ************************************
  // ***** zai xia yi ge mai chong dao lai qian yan chi yi duan shi jian
  // ************************************
  // xun huan cao zuo dai ma zhong de wei lai fa song mai chong
  for(int i=0;i<iDataLength;i++) {
  if(lValue & 1) {
  // chuang jian yi ge mai chong 1
  dwStreamLength=i1Pulse/charWidth;
  ASSERT(Write((const char *)bPulseStream.GetData(),
  dwStreamLength)==dwStreamLength);
  // *********************************
  // *** zai xia yi ge mai chong dao lai qian yan chi yi duan shi jian
  // *********************************
  }
  else {
  // chuang jian yi ge mai chong 0
  dwStreamLength=i0Pulse/charWidth;
  ASSERT(Write((const char *)bPulseStream.GetData(),
  dwStreamLength)==dwStreamLength);
  // ********************************
  // ** zai xia yi ge mai chong dao lai qian yan chi yi duan shi jian
  // ********************************
  }
  lValue >>= 1;
  }
  return TRUE;
  }
  wo zai suo fu yuan dai ma zhong bao han le yi ge jian dan de ying yong cheng xu , ta shi yong CIrPulse lai chuang jian yi tai suo ni TV de yuan ju li yao kong 。 ta ju you ji ben de pin dao xuan ze 、 yin liang tiao zheng he kai / guan ji de gong neng 。
  4. fei fan zhu chong
  yin wei gai CIrPort lei shi yong yi ge chuan xing duan kou lian jie dao gai IR duan kou , suo yi bi xu sheng cheng yi ge 40KHz de zai bo xin hao , zhe tong guo cong gai chuan xing duan kou fa song qia dang de zi fu lai shi xian 。 xing hao , jia ru wo men fa song zi fu 0xdb, yi 115200 bo te , yong 8 ge shu ju wei ,2 ge ting zhi wei he qi ou xiao yan , zhe yang jiu neng chan sheng yi zhong ji jie jin 38.4KHz de zai bo xin hao 。 wo men suo you de suo ni she bei jie shou zhe zhong shu ju shi mei you wen ti de 。
  zui da de wen ti shi , ru he shi xian jian ge mei ci mai chong de chen mo zhou qi 。 bu ke neng you chuan xing duan kou lai chan sheng gai chen mo zhou qi , yin wei jiu suan ni fa song yi ge 0x0 zi fu , you yu cun zai qi shi he ting zhi wei , ni reng ran zai gai IR shang de dao mai chong 。 wo tong guo fa song bu tong de zi fu jin xing shi yan , yi ju de qian ti shi jia ru ni bu yi 40KHz de pin lv fa song yi ge zai bo xin hao , zhe you ke neng shi she bei wu ba zhe ge dang zuo yi ge chen mo 。 zhe yang zuo de you dian shi ni ke yi chan sheng yi ge bao han wan zheng de dai ma de byteArray, yi que bao zhun que ji shi 。 dan shi jie guo bing bu yi zhi , suo yi wo ju jue shi yong zhe ge fang fa , wei de shi shi xian zai liang ci cong chuan xing duan kou fa chu cheng zu de 0xdb zi fu zhi jian zhi chi zan ting 。 yin wei xu yao de yan chi shi yi 550μs de shun xu ; dao mu qian wei zhi , wo huan mei you zhao dao qu de du li yu chu li qi su du de zan ting de fang fa 。 zai wo de Jornada shang , shi wan quan bu bi chan sheng yi ge yan chi de , yin wei mei ci tiao yong Write han shu kan shang qu dou shi yong le he shi de shi xian 。 bu guan zen yang , wo dan xin de shi , ni ke neng hu luan chan sheng yi ge ke yi shi ni de zhang shang dian nao neng gong zuo de yi ge yan chi 。
C++实现用掌上电脑遥控电视
geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
1. jian jie    ni shi fou zeng xiang guo tong guo ni de zhang shang dian nao shang de IR duan kou kong zhi ni de TV、Hi-Fi huo zhe qi ta shi pin ? ben wen jiang jie shao zen yang shi yong zhang shang dian nao zhong de IR duan kou lai bian cheng kong zhi yi tai TV。 2. bei jing    wo jin xie ri zi diu shi le wo de lao shi suo ni TV de yao kong qi 。 zhe ben shen mei you shen me wen ti , yin wei wo mai le ge xin de yao kong qi zuo wei dai ti 。 ran er , dang dian shi shi qu le ta de she ding de yan se shi , wo peng dao le wen ti , yin wei ta zhi neng xian shi hei bai se le , er xin de yao kong qi mei you yan se tiao zheng an niu 。 wo jue ding zai wo de lao shi de Jornada 525 zhang shang dian nao shang xie yi ge cheng xu shi yong IR duan kou ba zheng que de dai ma fa song gei TV。    gong you san ge zhu yao xie yi ke yi yong yu fa song IR dai ma dao she bei shang 。 suo ni TV shi yong ’Pulse Coded’ fang fa , ta xu yao fa song yi ge bao han tou (header) wei de yi kong ge ge kai de ’1’ wei he ’0’ wei de shu ju liu 。 zhe xie wei bei tiao zhi cheng yi zhong 40KHz de zai bo xin hao 。 qi zhong , tou chang du wei 2200 μs,’1’ wei wei 110 μs,’0’ wei wei 550 μs, er kong ge shi 550μs de chen mo (silence)。 da duo shu suo ni she bei shi yong 12 wei shu ju , ta bei fen li cheng 6 wei de di zhi ( she bei lei xing ) he 6 wei ming ling 。 yin ci shu ju kan qi lai xiang zhe ge yang zi :hxxxxxxyyyyyy, qi zhong h shi tou wei ,xxxxxx shi 6 wei de ming ling (msb first),yyyyyy shi 6 wei de di zhi 。 dui ci wo bu zai xi shu , yin wei wang shang you hen duo zi yuan miao shu zhe zhong xie yi , bing lie ju le zhen dui bu tong she bei de dai ma 。 yi xie xin de suo ni she bei shi yong 19 wei dai ma , wo xiang xin ling wai de zhi zao shang ye shi yong he wo miao shu de xiang tong de ge shi 。 huan you ke neng wei shi yong ’Space Coded’ huo ’Shift Coded’ xie yi de she bei xie chu xiang si de lei 。    wo zeng shi yong qian ru shi C++ xie guo yi ge lei CirPulse, ta feng zhuang le cong yi tai yun xing Windows CE 3.0 de Jornada 525 PC shang kong zhi suo ni ji qi xiang pi pei she bei de gong neng 。 gu ji ta neng gou yu qi ta xiang pi pei she bei he cao zuo xi tong yi qi gong zuo , dan shi ni xu yao shi yan cai xing ! [url=http://www.wangchao.net.cn/bbs/pydetail_1785327.html][img]http://image.wangchao.net.cn/it/1323423865151.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo 3. shi xian guo cheng fen xi    zhe ge CIrPulse lei bao lu le ji ge han shu , ta men shi de fa song IR dai ma jin ke neng qing yi 。 zai sheng ming CIrPulse lei shi , ni ying gai tiao yong yi ci FindIrPort(), ta fan hui yi ge miao shu IrDA duan kou de duan kou hao de UINT, zhe tong guo sou suo zhu ce biao de dao 。 zhe ge duan kou hao yong yu hou mian de tiao yong lai da kai IrDA duan kou jin xing chuan xing tong xun 。 UINT CIrPulse::FindIrPort() {  // cha xun zhu ce biao zhong de IR duan kou hao  HKEY hKey = NULL;  if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Comm\IrDA"),0, 0, &hKey) == ERROR_SUCCESS)  {   DWord dwType = 0;   DWORD dwData = 0;   DWORD dwSize = sizeof(dwData);   if (RegQueryValueEx(hKey, _T("Port"), NULL, &dwType, (LPBYTE) &dwData, &dwSize) == ERROR_SUCCESS)   {    if (dwType == REG_DWORD && dwSize == sizeof(dwData))    {     RegCloseKey(hKey);     return (UINT) dwData;    }   }   RegCloseKey(hKey);  }  return 0; }    de dao duan kou hao hou , ni ke yi tiao yong Open(UINT) han shu , ba tong guo tiao yong FindIrPort() de dao de duan kou hao chuan di guo qu 。 zhe da kai gai duan kou bing she zhi chuan kou shen shu , jia ru cheng gong fan hui true。 gai duan kou bei she zhi wei 115200 bo te ,8 ge shu ju wei ,2 ge ting zhi wei he qi ou xiao yan wei 。 guan yu ru he chan sheng zai bo yi ji wei shen me wo shi yong zhe xie she zhi jiang zai ben wen hou mian jie shao 。 BOOL CIrPulse::Open(UINT uiport) {  ASSERT(uiPort > 0 && uiPort <= 255);  Close();  // da kai IRDA duan kou  CString strPort;  strPort.Format(_T("COM%d:"), uiPort);  m_irPort = CreateFile((LPCTSTR) strPort, GENERIC_READ GENERIC_WRITE,0, NULL, OPEN_EXISTING, 0, NULL);  if (m_irPort == INVALID_HANDLE_VALUE)  {   return FALSE;  }  // she zhi shu ru he shu chu huan chong qu de da xiao  VERIFY(SetupComm(m_irPort, 2048, 2048));  // qing chu du he xie huan chong qu  VERIFY(PurgeComm(m_irPort,PURGE_TXABORTPURGE_RXABORT  PURGE_TXCLEARPURGE_RXCLEAR));  // chong xin chu shi hua suo you de IRDA duan kou she zhi  DCB dcb;  dcb.DCBlength = sizeof(DCB);  VERIFY(GetCommState(m_irPort, &dcb));  dcb.BaudRate = CBR_115200;  dcb.fBinary = TRUE;  dcb.fParity = TRUE;  dcb.fOutxCtsFlow = FALSE;  dcb.fOutxDsrFlow = FALSE;  dcb.fDtrControl = DTR_CONTROL_DISABLE;  dcb.fDsrSensitivity = FALSE;  dcb.fTXContinueOnXoff = FALSE;  dcb.fOutX = FALSE;  dcb.fInX = FALSE;  dcb.fErrorChar = FALSE;  dcb.fNull = FALSE;  dcb.fRtsControl = RTS_CONTROL_DISABLE;  dcb.fAbortOnError = FALSE;  dcb.ByteSize = 8;  dcb.Parity = EVENPARITY;  dcb.StopBits = TWOSTOPBITS;  VERIFY(SetCommState(m_irPort, &dcb));  // wei suo you de du he xie cao zuo she zhi chao shi zhi  COMMTIMEOUTS timeouts;  VERIFY(GetCommTimeouts(m_irPort, &timeouts));  timeouts.ReadIntervalTimeout = MAXDWORD;  timeouts.ReadTotalTimeoutMultiplier = 0;  timeouts.ReadTotalTimeoutConstant = 0;  timeouts.WriteTotalTimeoutMultiplier = 0;  timeouts.WriteTotalTimeoutConstant = 0;  VERIFY(SetCommTimeouts(m_irPort, &timeouts));  DWORD dwEvent=EV_TXEMPTY;  SetCommMask(m_irPort,dwEvent);  return TRUE; } [url=http://www.wangchao.net.cn/bbs/pydetail_1785327.html][img]http://image.wangchao.net.cn/it/1323423865178.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo    tiao yong han shu SetCodeSize(DWORD) lai she zhi yao chuan song de wei shu ( ru 12 wei )。 zhe ke yi zai ren he shi hou wan cheng qie zhi xu yao zuo yi ci 。 ta yi zhi bao chi you xiao , zhi dao hou mian de tiao yong gai bian ta wei zhi 。    zui hou tiao yong SendCode(long), chuan di shi ji yao fa song de dai ma 。 BOOL CIrPulse::SendCode(DWORD lValue) {  DWORD dwCount;  int i=0;  ASSERT(iDataLength>0);  // qing chu chuan song huan chong qu  VERIFY(PurgeComm(m_irPort,PURGE_TXABORT PURGE_RXABORT PURGE_TXCLEAR PURGE_RXCLEAR));  // mei ci an jian she zhi dai ma 6 ci  for(int x=0;x<6;x++) {   MakeStream(lValue); // fa song dai ma   dwCount=GetTickCount();   while(GetTickCount()<dwCount+26) // yan chi 26ms    i++;  }  return true; }    zhu chong zhe ge han shu tiao yong ling wai yi ge han shu MakeStream(long)6 ci , mei liang ci tiao yong zhi jian ting dun 26 hao miao 。 wo fa xian gai dai ma bi xu fa song hao ji ci cai neng shi jie shou she bei xiang ying , da gai shi wei fang zhi jia xing wei de yuan gu ba 。26 hao miao dui yu jie shou she bei deng ji gai dai ma shi bi xu de , zai xia yi ge dai ma chu xian zhi qian 。    zhe ge han shu MakeStream(long) ba zi jie liu xie ru IrPort, bing gen ju shi fou you qi shi wei (1 huo zhe 0) lai que bao fa song zheng que de shu ju bao chang du 。 bao han shu ju zi jie (0xdb) de huan chong qu shi yi yi ge ByteArray xing shi cun zai de 。    han shu Close() yong yu zai duan kou shi yong hou , zi ran di guan bi IrPort。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785327.html][img]http://image.wangchao.net.cn/it/1323423865200.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo    zhe ge han shu zai wo de ornada shang yun xing liang hao 。 qing kan xia mian de tao lun yi jin yi bu que ding ni yao zuo de ke neng xing gai bian 。 BOOL CIrPulse::MakeStream(DWORD lValue) {  DWORD dwStreamLength;  // chuang jian kai shi mai chong  dwStreamLength=iHPulse/charWidth;  ASSERT(Write((const char *)bPulseStream.GetData(),  dwStreamLength)==dwStreamLength);  // ************************************  // ***** zai xia yi ge mai chong dao lai qian yan chi yi duan shi jian  // ************************************  // xun huan cao zuo dai ma zhong de wei lai fa song mai chong  for(int i=0;i<iDataLength;i++) {   if(lValue & 1) {    // chuang jian yi ge mai chong 1    dwStreamLength=i1Pulse/charWidth;    ASSERT(Write((const char *)bPulseStream.GetData(),    dwStreamLength)==dwStreamLength);    // *********************************    // *** zai xia yi ge mai chong dao lai qian yan chi yi duan shi jian    // *********************************   }   else {    // chuang jian yi ge mai chong 0    dwStreamLength=i0Pulse/charWidth;    ASSERT(Write((const char *)bPulseStream.GetData(),    dwStreamLength)==dwStreamLength);    // ********************************    // ** zai xia yi ge mai chong dao lai qian yan chi yi duan shi jian    // ********************************   }   lValue >>= 1;  }  return TRUE; }    wo zai suo fu yuan dai ma zhong bao han le yi ge jian dan de ying yong cheng xu , ta shi yong CIrPulse lai chuang jian yi tai suo ni TV de yuan ju li yao kong 。 ta ju you ji ben de pin dao xuan ze 、 yin liang tiao zheng he kai / guan ji de gong neng 。 4. fei fan zhu chong    yin wei gai CIrPort lei shi yong yi ge chuan xing duan kou lian jie dao gai IR duan kou , suo yi bi xu sheng cheng yi ge 40KHz de zai bo xin hao , zhe tong guo cong gai chuan xing duan kou fa song qia dang de zi fu lai shi xian 。 xing hao , jia ru wo men fa song zi fu 0xdb, yi 115200 bo te , yong 8 ge shu ju wei ,2 ge ting zhi wei he qi ou xiao yan , zhe yang jiu neng chan sheng yi zhong ji jie jin 38.4KHz de zai bo xin hao 。 wo men suo you de suo ni she bei jie shou zhe zhong shu ju shi mei you wen ti de 。    zui da de wen ti shi , ru he shi xian jian ge mei ci mai chong de chen mo zhou qi 。 bu ke neng you chuan xing duan kou lai chan sheng gai chen mo zhou qi , yin wei jiu suan ni fa song yi ge 0x0 zi fu , you yu cun zai qi shi he ting zhi wei , ni reng ran zai gai IR shang de dao mai chong 。 wo tong guo fa song bu tong de zi fu jin xing shi yan , yi ju de qian ti shi jia ru ni bu yi 40KHz de pin lv fa song yi ge zai bo xin hao , zhe you ke neng shi she bei wu ba zhe ge dang zuo yi ge chen mo 。 zhe yang zuo de you dian shi ni ke yi chan sheng yi ge bao han wan zheng de dai ma de byteArray, yi que bao zhun que ji shi 。 dan shi jie guo bing bu yi zhi , suo yi wo ju jue shi yong zhe ge fang fa , wei de shi shi xian zai liang ci cong chuan xing duan kou fa chu cheng zu de 0xdb zi fu zhi jian zhi chi zan ting 。 yin wei xu yao de yan chi shi yi 550μs de shun xu ; dao mu qian wei zhi , wo huan mei you zhao dao qu de du li yu chu li qi su du de zan ting de fang fa 。 zai wo de Jornada shang , shi wan quan bu bi chan sheng yi ge yan chi de , yin wei mei ci tiao yong Write han shu kan shang qu dou shi yong le he shi de shi xian 。 bu guan zen yang , wo dan xin de shi , ni ke neng hu luan chan sheng yi ge ke yi shi ni de zhang shang dian nao neng gong zuo de yi ge yan chi 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785327.html][img]http://image.wangchao.net.cn/it/1323423865232.gif[/img][/url] geng duo nei rong qing kan C/C++ ji shu zhuan ti dian nao pei zhi shou ce dian nao wei xiu zhuan ti zhuan ti , huo
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
赏心悦目的模特儿(9)
赏心悦目的模特儿(8)
赏心悦目的模特儿(7)
赏心悦目的模特儿(6)
周六一日游--绿野翠蜂场(一)
骆驼峰
下一站上环
杂乱的几张Danang
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有