Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/14/20 22:58
Modified:
  02/14/20 22:59

Read: times


 
#190972 - Yay
Responding to: ???'s previous message
Wow, this is craziness. Today for baseline, I tried to create the original issue (no L) and the defect has moved. I added underscores for visibility.

#define  SYS_CLK   12000000L           // Tcyc = 1/12MHz = 83ns

static U16 code BaudParams[NUM_BAUDRATES] =
   {
   65536 - (SYS_CLK/(1*2*1200)),       // 0xEC78 (exact)
   65536 - (SYS_CLK/(1*2*2400)),       // 0xF63C (exact)
   65536 - (SYS_CLK/(1*2*4800)),       // 0xFB1E (exact)
   65536 - (SYS_CLK/(1*2*9600)),       // 0xFD8F (exact)
   65536 - (SYS_CLK/(1*2*19200)),      // 0xFEC7 (0.16%)  yesterday's defect, now ok (except rounding)
   65536 - (SYS_CLK/(1*2*38400)),      // 0xFF64 (0.16%)
   65536 - (SYS_CLK/(1*2*57600)),      // 0xFF98 (0.16%)
   65536 - (SYS_CLK/(1*2*115200)),     // 0xFFCC (0.16%)
   65536 - (SYS_CLK/(1*2*31250))       // 0xFF40 (exact)  today's issue
   };

dump:
 A160 : 12 9D 0A C2 86 7F E8 7E  03 02 9D 0A EC_78 F6_3C
 A170 : FB_1E FD_8F FE_C7 FF_64  FF_98 FF_CC 0F_70 E5 5C

 



Now with the L added for each denominator.

static U16 code BaudParams[NUM_BAUDRATES] =
   {
   65536 - (SYS_CLK/(1L*2*1200)),       // 0xEC78 (exact)
   65536 - (SYS_CLK/(1L*2*2400)),       // 0xF63C (exact)
   65536 - (SYS_CLK/(1L*2*4800)),       // 0xFB1E (exact)
   65536 - (SYS_CLK/(1L*2*9600)),       // 0xFD8F (exact)
   65536 - (SYS_CLK/(1L*2*19200)),      // 0xFEC7 (0.16%) See below.
   65536 - (SYS_CLK/(1L*2*38400)),      // 0xFF64 (0.16%)
   65536 - (SYS_CLK/(1L*2*57600)),      // 0xFF98 (0.16%)
   65536 - (SYS_CLK/(1L*2*115200)),     // 0xFFCC (0.16%)
   65536 - (SYS_CLK/(1L*2*31250))       // 0xFF40 (exact)
   };

dump:
 A160 : 12 9D 0A C2 86 7F E8 7E  03 02 9D 0A EC_78 F6_3C
 A170 : FB_1E FD_8F FE_C8 FF_64  FF_98 FF_CC FF_40 E5 5C


 


Issue resolved and rounding/truncation changed. (I will fix the check too!)

Thanks gang!




List of 6 messages in thread
TopicAuthorDate
Keil C51 Bug            01/01/70 00:00      
   integer overflow            01/01/70 00:00      
      Same result (bad)            01/01/70 00:00      
         Spreadsheet Analysis             01/01/70 00:00      
         please try again            01/01/70 00:00      
            Yay            01/01/70 00:00      

Back to Subject List