intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 1.3 BAUD RATES AND CRYSTALS The following program generates the appropriate TIMER2 reload values for a given baud rate. The user supplies the system clock frequency and the desired baud rate and the program calculates the proper TIMER2 reload value. Additionally, percent error, for both the baud rate generator and MCS BASlC- 52's REAL TIME CLOCK are calculated and displayed. >10 INPUT"ENTER CRYSTAL - ",X >20 INPUT"ENTER BAUD RATE - ",B >30 R=X/(32*B) : T=X/76800 >40 R1=R-INT(R) :

T1=T-INT(T) >50 IF R1 >60 R1=1-R1 >70 R=R+1 >80 IF T1 >90 T1=1-T1 >100 T=T+1 >110 PRINT "TIMER2 RELOAD VALUE IS - ",USING(######),INT(65536-R) >120 PRINT "BAUD RATE ERROR IS - ",USING(## ###),(R1/R)*100,"%" >130 PRINT "REAL TIME CLOCK ERROR IS - "(T1/T)*100,"/." - 175 -