2011-04-20 54 views
-1

我想通過使用bitbanging方法發送'A'字符。誰能幫我寫在send_serial()函數的代碼使用bitbanging方法發送'A'字符

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); 

    } 

} 
+0

這功課呢? – t0mm13b 2011-04-20 23:21:32

+0

哪個輸出位應該被驅動? – wallyk 2011-04-20 23:30:25

+1

聽起來不愉快。你真的應該弄清楚你的輸出波形是什麼樣的。這裏的一切都應該是直截了當的。 – 2011-04-21 06:17:23

回答

1

這是在Microchip的Application Note AN510太平洋島嶼沒有一個內置的UART充分說明。但是,如果您可以更改爲具有UART的模塊,則可以更輕鬆地找到代碼,並且可以減輕時序限制,因爲這些位是由硬件發送的。有關如何使用內置UART的說明,請參見PIC數據表或AN774