Spehro: >Handy, but the error handling could be improved. ;-) >---- >Ingrese BaudRate en bps:600 >Ingrese el valor del cristal en hz:32768 >Division by zero in line 56199 of module &g__5 at address FD28:2897 >---- >Thanks & Best regards, :-), Yeah, that's why I wrote "dirty",... I suppose someone can improves this for all new guys. In C would be better and shorter. Also the SPBRG calculation can be adjusted for rounding errors using Tony K|bek formula: ; calculates baudrate when BRGH = 1, adjust for rounding errors ;* spbrg_value = (((d'10'*XTAL_FREQ/(d'16'*baudrate))+d'5')/d'10')-1 ;* ;* ; calculates baudrate when BRGH = 0, adjust for rounding errors ;* spbrg_value = (((d'10'*XTAL_FREQ/(d'64'*baudrate))+d'5')/d'10')-1 (Ripped from Thomas McGahee Picusart,... wherever he is. ?Where is he?) Here is my "old-qbasic-dirty" code: INPUT "Ingrese BaudRate en bps:", Baud INPUT "Ingrese el valor del cristal en hz:", Fosc BRGH0 = 64 BRGH1 = 16 SPBRG0 = INT(Fosc / BRGH0 / Baud) - 1 SPBRG1 = INT(Fosc / BRGH1 / Baud) - 1 CalcBaud0 = INT(Fosc / (BRGH0 * (SPBRG0 + 1))) CalcBaud1 = INT(Fosc / (BRGH1 * (SPBRG1 + 1))) Error0 = (CalcBaud0 - Baud) / Baud Error1 = (CalcBaud1 - Baud) / Baud a$ = RIGHT$(" " + STR$(Baud), 10) b$ = RIGHT$(" " + STR$(Fosc), 10) c$ = RIGHT$(" " + STR$(BRGH1), 10) d$ = RIGHT$(" " + STR$(BRGH0), 10) e$ = RIGHT$(" " + STR$(SPBRG1), 10) F$ = RIGHT$(" " + STR$(SPBRG0), 10) g$ = RIGHT$(" " + STR$(CalcBaud1), 10) h$ = RIGHT$(" " + STR$(CalcBaud0), 10) i$ = RIGHT$(" " + MID$(LEFT$(STR$(Error1 * 100), 4), 1) + "%", 10) j$ = RIGHT$(" " + MID$(LEFT$(STR$(Error0 * 100), 4), 1) + "%", 10) PRINT " BRGH=1 BRGH=0" PRINT PRINT " Brate "; a$; a$ PRINT " Focs "; b$; b$ PRINT " BRGH "; c$; d$ PRINT " SPBRG "; e$; F$ PRINT " CalcBRate "; g$; h$ PRINT " Error "; i$; j$ Regards, Dennis Ahora podis usar Yahoo! Messenger desde tu celular. Aprendi csmo hacerlo en Yahoo! Msvil: http://ar.mobile.yahoo.com/sms.html -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics