-1

我正在尝试使用 bitbanging 方法发送“A”字符。谁能帮我在 send_serial() 函数中编写这段代码

void send_serial()
{
//send data 

}

void main()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_CLOCK_DIV_2);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_ccp1(CCP_OFF);
   setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab


   //!!!!!!!!!!!deney!!!!!!!!!!!!!
   //c6 pin using for data transfer
   //config tris
   //set_tris_c(??)



   while(1)
   {
      //'A' on ascii 0x41
      send_serial();
      delay_ms(1000);

   }

}
4

1 回答 1

1

这在 Microchip 的适用于没有内置 UART 的 PIC的应用笔记 AN510中有完整描述。但是,如果您可以更改为具有 UART 的代码,您会发现代码更容易,并且由于这些位是由硬件发送的,因此可以缓解时序限制。PIC 数据表或AN774中描述了如何使用内置 UART 。

于 2011-04-26T07:37:40.333 回答