毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 计算机安全 >> 正文

无线胶囊内窥镜系统设计 第15页

更新时间:2014-6-29:  来源:毕业论文

无线胶囊内窥镜系统设计 第15页

for(i=0;ov_reg[i].need != 0xff;i++)
{
   if(ov_reg[i].need == 1)
   {
    temp = TWI_poll( TWI_CHIP_OV7660|TWI_WRITE, (ov_reg[i].addr), &(ov_reg[i].data) );
    if( temp )
    {
     return temp;
    }
   }
}

txnum=0;
for(i=0;ov_reg[i].need != 0xff;i++)
{
   if(ov_reg[i].need == 1)
   {
    temp = TWI_poll( TWI_CHIP_OV7660|TWI_READ, (ov_reg[i].addr), &(txPacket[txnum++]) );
    if( temp )
    {
     return temp;
    }
   }
}
// uartDebug_txPacket(txPacket,txnum);
my_delay_ms(200);


return 0x00; //ok
}
 /* OV7660_init() */
附录八、NRF24LE1芯片main.c部分
Main.c 文件:

#include <Nordic\reg24le1.h>
#include "hal_nrf_reg.h"
#include "hal_nrf.h"
#include "radio.h"

#include "application.h"


uint8_t xdata packet[RADIO_MAX_PL];     // Buffer for sending or receiving
char combuf[240];
char *p=&combuf[240];

void send_packet(uint8_t command)
{
  bool packet_sent;
  uint8_t data_length;

  packet[0] = CMD_SEND_DATA;            // Add TYPE (data = 0x00)
  packet[1] = data_length = 1;          // Add LENGTH (1 byte)
  packet[DATA_POS] = command;           // Add DATA to send

  radio_send_packet(packet, data_length+DATA_POS);

  while(radio_busy())
    ;

  packet_sent = radio_packet_sent();

  if(packet_sent)
  {
 //   LED1_BLINK();                       // Packet sent, flash LED1
  }
  else
  {
 //   LED0_BLINK();                       // Packet lost, flash LED0
  }
}

 

uint8_t read_packet(void)
{
  uint8_t command, data_length,type, pck_length;

  /* Get the packet from radio */
  pck_length = radio_read_data(packet);

  /* Disassemble packet */
  type        =  packet[0];             // Get TYPE of message
  data_length =  packet[1];             // Get LENGTH of data part

  /* .... Room for decryption of message .... */

  command = packet[DATA_POS];           // Get the received command
  return command;
}

void radio_irq(void) interrupt RF_READY_INT_VECT 
{
  radio_interrupt(); 
}

void get_AD()
{
   p=data_ov7660;
}

void main(void){
  uint8_t command;
  uint8_t ctr;

  P0 = 0;      
  P0DIR = 0x0C;   
                                                  
  RFCKEN = 1;  
  RF = 1;          // enable RF interrupt 
  EA = 1;           // Global interrupt enable
           
    radio_init(1);                           
    while(true) 
 {
      while(radio_busy());
  if(VSYNC=0)
  {
   if(HREF=1)
   {
    if(PCLK=1)
    {
     get_AD();
    }
    else
    p++;  // ++ 指针
   }
   else
    {
     send_packet(combuf[240]);
     while(HREF=0);
    }
  }
  else
  send_packet(CMD1);
   }
}
application.h 文件:

#define CMD_SEND_DAT

 << 上一页  [11] [12] [13] [14] [15] [16] 下一页

无线胶囊内窥镜系统设计 第15页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。