• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






PIC與RS323間傳輸
#1
新會員
新會員


查看用戶資訊
請問一下,有人知道PIC與RS323間傳輸,的程式要怎麼寫嗎??

發表於: 2004/10/4 0:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC與RS323間傳輸
#2
版主
版主


查看用戶資訊
C 還是Assembly ? which PIC ?

發表於: 2004/10/4 13:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC與RS323間傳輸
#3
新會員
新會員


查看用戶資訊
是PIC16F87X這顆單晶片

發表於: 2004/10/4 23:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC與RS323間傳輸
#4
資深會員
資深會員


查看用戶資訊
參照:

e0958303 寫道:
是PIC16F87X這顆單晶片


你要的是 CCS 的 C 程式嗎 ?給你個現成的

#include <16F877.H>  // device header file from CCS-C

#fuses HS, NOWDT, NODEBUG, NOLVP, PUT  

#use delay(clock = 20000000)        // 20 MHz crystal
#use rs232( baud = 9600, xmit = PIN_C6, rcv = PIN_C7 )

void main()
{
   
int8 i=0;                   
   
   
printf("rnn Hello world ! rn");

   while(
1)
   {
      
printf"rn i = %u "i++ );     

      
delay_ms 500 );      

      if ( 
kbhit() )
      {
         
printf("rn PC-keyboard: %c"getc() );
      }
   }
}

發表於: 2004/10/5 8:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC與RS323間傳輸
#5
高級會員
高級會員


查看用戶資訊
你可以參考PIC單晶片學習秘笈....(PIC16F877為例)
作者:趙春棠
全威圖書有限公司
應該容易可買到或借到...

list p=16F877
#include<p16F877.INC>
trans_c equ 0x20
;**********************
org 0x00
nop
initial:
movlw .3
movwf trans_c ;設定trans_c次數為3次
banksel SPBRG
movlw .36 ;Baud Rate=2400 bps
movwf SPBRG
bcf TXSTA,SYNC ;SYNC設定為0
banksel RCSTA
bsf RCSTA,SPEN ;SPEN設定為1
banksel TXSTA
bsf TXSTA,TXEN ;TXEN設定為1
Trans:
banksel TXSTA
btfss TXSTA,TRMT ;測試TRMT是否為1(1:TSR空的,0:TSR滿的)
goto Trans
banksel TXREG
movlw 0x55
movwf TXREG
banksel trans_c
decfsz trans_c,f ;trans_c內容減一後存到f暫存器並測試節果是否為0
goto Trans
end

希望對你有些幫助!

發表於: 2004/10/20 9:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC與RS323間傳輸
#6
高級會員
高級會員


查看用戶資訊
對了...

我提供的這例子是由PIC端發信號...

電腦端用VB接收...

發表於: 2004/10/20 9:38
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------