发送“A”使用 bitbanging 方法的字符
我正在尝试使用 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);
}
}
i am trying to send 'A' character by using bitbanging method. Can anyone help me to write this code in send_serial() function
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);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Microchip 的应用笔记 AN510 对此进行了完整描述适用于没有内置 UART 的 PIC。然而,如果您可以更改为具有 UART 的设备,您会发现代码更容易,并且由于这些位是由硬件发送的,因此可以减轻时序限制。有关如何使用内置 UART 的说明,请参见 PIC 数据表或 AN774。
This is fully described in Microchip's Application Note AN510 for PICs without a built in UART. However, if you can change to one which has a UART you would find the code much easier and it eases the timing restriction since the bits are sent by the hardware. The description of how to use a built in UART is described in the PIC datasheet or AN774.