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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/29/04 13:04
Read: times


 
#84033 - yet another
Responding to: ???'s previous message
My current method is at follows (this is C, thus not before)
sfr S0_TCON           = 0x88;    // timer control            
  sbit    SB0_TCON_IT0  = 0x88;
  sbit    SB0_TCON_IE0  = 0x89;
  sbit    SB0_TCON_IT1  = 0x8A;
  sbit    SB0_TCON_IE1  = 0x8B;
  sbit    SB0_TCON_TR0  = 0x8C;
  sbit    SB0_TCON_TF0  = 0x8D;
  sbit    SB0_TCON_TR1  = 0x8E;
  sbit    SB0_TCON_TF1  = 0x8F;
  #define SM_TCON_IT0     0x01
  #define SM_TCON_IE0     0x02
  #define SM_TCON_IT1     0x04
  #define SM_TCON_IE1     0x08
  #define SM_TCON_TR0     0x10
  #define SM_TCON_TF0     0x20
  #define SM_TCON_TR1     0x40
  #define SM_TCON_TF1     0x80


//S0_TCON = SM_TCON_IT0 + SM_TCON_IE0 + SM_TCON_IT1 + SM_TCON_IE1 + SB0_TCON_TR0 + SB0_TCON_TF0 + SB0_TCON_TR1 + SB0_TCON_TF1;
  S0_TCON = SM_TCON_IT0               + SM_TCON_IT1                                                                          ;
//S0_TMOD = SM_TMOD_T1CLR + SM_TMOD_T0TM1 + SM_TMOD_T0CM1 + SM_TMOD_T0CLR + SM_TMOD_T1TM1 + SM_TMOD_T1CM1 + SM_TMOD_T1TM2;
  S0_TMOD =                                 SM_TMOD_T0CM1                                 + SM_TMOD_T1CM1                ;


The "list" above the actual definition makes it very easy to a) include bits and b) see what is not included.

Again, I have these "canned" so for a project it is just cut and paste, then copy the bits wanted to the active lines.

My "strange" definitions are there so a global search on "anything related to a SFR" can be found. I have spent too much time when debugging finding that mov TCON,#..h and setb TR1 did not come up in the same search.

In other words, a search on TR1 will show EVERY place that bit is affected and a search om TCON will show EVERY place that SFR is affected.

The above is for a Cygnal F12x thus S0_... refer to SFR bank 0. I have found that that little "flag" makes the places where a change of SFRPAGE is missed easy to find.

Erik


List of 7 messages in thread
TopicAuthorDate
Timer 2 baud generation problem            01/01/70 00:00      
   avoid binary, it is difficult to read            01/01/70 00:00      
      That was it!            01/01/70 00:00      
         how I used to use binary            01/01/70 00:00      
            Another approach            01/01/70 00:00      
         binary and defines            01/01/70 00:00      
            yet another            01/01/70 00:00      

Back to Subject List