不使用定时器串口例程
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