CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Disabling peripherals on PIC24FJ256GB110 [resource]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Oli
Guest







Disabling peripherals on PIC24FJ256GB110 [resource]
PostPosted: Tue Feb 23, 2010 8:29 am     Reply with quote

Hi All

Because of my power critical application, I have to disable everything that isn't necessary. Defining all of the stop in idle mode bits and module enable bits took some time, so I've posted them here if it helps anybody else out.

Code:
/******************* STOP IN IDLE MODE BITS (SIDL), MODULE ENABLE BITS ****************************/
   
// timers
#word T1CON = 0x0104    // timer 1
#bit  T1SIDL = T1CON.13
#word T2CON = 0x0110    // timer 2
#bit  T2SIDL = T2CON.13
#word T3CON = 0x0112    // timer 3
#bit  T3SIDL = T3CON.13
#word T4CON = 0x011E    // timer 4
#bit  T4SIDL = T4CON.13
#word T5CON = 0x0120    // timer 5
#bit  T5SIDL = T5CON.13


// input capture
#word IC1CON1 = 0x140      // input capture 1
#bit  IC1SIDL = IC1CON1.13
#word IC2CON1 = 0x148      // input capture 2
#bit  IC2SIDL = IC2CON1.13
#word IC3CON1 = 0x150      // input capture 3
#bit  IC3SIDL = IC3CON1.13
#word IC4CON1 = 0x158      // input capture 4
#bit  IC4SIDL = IC4CON1.13
#word IC5CON1 = 0x160      // input capture 5
#bit  IC5SIDL = IC5CON1.13
#word IC6CON1 = 0x168      // input capture 6
#bit  IC6SIDL = IC6CON1.13
#word IC7CON1 = 0x170      // input capture 7
#bit  IC7SIDL = IC7CON1.13
#word IC8CON1 = 0x178      // input capture 8
#bit  IC8SIDL = IC8CON1.13
#word IC9CON1 = 0x180      // input capture 9
#bit  IC9SIDL = IC9CON1.13

// output compare
#word OC1CON1 = 0x0190     // output capture 1
#bit  OC1SIDL = OC1CON1.13
#word OC2CON1 = 0x019A     // output capture 2
#bit  OC2SIDL = OC2CON1.13
#word OC3CON1 = 0x01A4     // output capture 3
#bit  OC3SIDL = OC3CON1.13
#word OC4CON1 = 0x01AE     // output capture 4
#bit  OC4SIDL = OC4CON1.13
#word OC5CON1 = 0x01B8     // output capture 5
#bit  OC5SIDL = OC5CON1.13
#word OC6CON1 = 0x01C2     // output capture 6
#bit  OC6SIDL = OC6CON1.13
#word OC7CON1 = 0x01CC     // output capture 7
#bit  OC7SIDL = OC7CON1.13
#word OC8CON1 = 0x01D6     // output capture 8
#bit  OC8SIDL = OC8CON1.13
#word OC9CON1 = 0x01E0     // output capture 9
#bit  OC9SIDL = OC9CON1.13

// i2c

#word O2C1CON  = 0x0206     // i2c 1
#bit  I2C1SIDL = O2C1CON.13
#bit  I2C1EN   = O2C1CON.15

#word O2C2CON  = 0x0216     // i2c 2
#bit  I2C2SIDL = O2C2CON.13
#bit  I2C2EN   = O2C2CON.15

#word O2C3CON  = 0x0276     // i2c 3
#bit  I2C3SIDL = O2C3CON.13
#bit  I2C3EN   = O2C3CON.15

// UART

#word U1MODE  = 0x0220        // UART 1;
#bit  U1SIDL  = U1MODE.13
#bit  UART1EN = U1MODE.15

#word U2MODE  = 0x0230        // UART 2;
#bit  U2SIDL  = U2MODE.13
#bit  UART2EN = U2MODE.15

#word U3MODE  = 0x0250        // UART 3;
#bit  U3SIDL  = U3MODE.13
#bit  UART3EN = U3MODE.15

#word U4MODE  = 0x02B0        // UART 4;
#bit  U4SIDL  = U4MODE.13
#bit  UART4EN = U4MODE.15

// SPI

#word SPI1STAT = 0x0240       // SPI 1
#bit  SPI1SIDL = SPI1STAT.13
#bit  SPI1EN   = SPI1STAT.15

#word SPI2STAT = 0x0260       // SPI 2
#bit  SPI2SIDL = SPI2STAT.13
#bit  SPI2EN   = SPI2STAT.15

#word SPI3STAT = 0x0280       // SPI 3
#bit  SPI3SIDL = SPI3STAT.13
#bit  SPI3EN   = SPI3STAT.15


// A/D

#word AD1CON1 = 0x0320     // A/D
#bit  AD1SIDL = AD1CON1.13

// CTMU

#word CTMUCON  = 0x033C
#bit  CTMUSIDL = CTMUCON.13
#bit  CTMUEN   = CTMUCON.15

// USB

#word U1OTGCON = 0x0486    // USB on the go reg
#bit  OTGEN    = U1OTGCON.2    // enable bit for OTG
#bit  DPPULUP  = U1OTGCON.7    // pull ups on USB

#word U1PWRC = 0x0488
#bit  USBPWR = U1PWRC.0

#word U1CON = 0x0494
#bit  USBEN = U1CON.0
#bit HOSTEN = U1CON.3

#word U1CNFG1  = 0x04A6
#bit  USBSIDL  = U1CNFG1.13

#word U1PWMCON = 0x04CE
#bit  PWMEN    = U1PWMCON.15

// parallel master / slave port

#word PMCON = 0x0600
#bit  PSIDL = PMCON.13
#bit  PMPEN = PMCON.15

// CRC

#word CRCCON = 0x0640
#bit  CSIDL = CRCCON.13

/******************************************************************************/


/*********************** PMD / MODULE DISABLE BITS ****************************/

#word PMD1 = 0x0770
#word PMD2 = 0x0772
#word PMD3 = 0x0774
#word PMD4 = 0x0776
#word PMD5 = 0x0778
#word PMD6 = 0x077A

/******************************************************************************/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group