不使用定时器串口例程

上传:lecture69136 浏览: 15 推荐: 0 文件:pdf 大小:88.28 KB 上传时间:2022-10-23 02:57:02 版权申诉

ThePIC16C5Xhasone8-bittimer(Timer0)whichcan

usean8-bitprescaler.Insomeinstances,theuser

wouldliketousethistimerforsomeotherpurposeand

yet,beabletodoatransmitandreceiveusingtheserial

port.Thisapplicationnoteoffersroutinestodoasim-

ple8-bittransmitandreceivewithnohandshake,at

baudratesfrom1200to9600.Pleasenotethatthese

routinesuseatimedloopwhichisasaccurateasthe

clockwhichdrivesthePIC16C5X.Theuserentersthe

frequencyandbaudratedesired.Thecalculatedvalue

“delay”intheserialroutinehastobean8-bitvalueonly.

Ifthevalueisgreaterthan8-bits,thefrequencyand

baudratevalueshavetobechanged.AN593SerialPortRoutinesWithoutUsingTimer0CONCLUSIONAuthor:StanD’SouzaMicrochipTechnologyInc.SimpletransmitandreceiveroutinescanbewrittenwithoutusingTimer0togeneratethebaudrate.INTRODUCTIONThePIC16C5Xhasone8-bittimer(Timer0)whichcanusean8-bitprescaler.Insomeinstances,theuserwouldliketousethistimerforsomeotherpurposeandyet,beabletodoatransmitandreceiveusingtheserialport.Thisapplicationnoteoffersroutinestodoasim-ple8-bittransmi

上传资源
用户评论