Tool/software: Code Composer Studio
Sorry for asking this naïve question.
I have the bare-metal piece of code below to toggle a led. It works fine as long as the #include . . . /driverlib.h is not commented.
My question is why do I need this file if I am not using any define at all?
Also, could you tell me where to find the clock cycles required for each instruction?
Thanks in advance.
Marcos Lopez
// #include <ti/devices/msp432p4xx/driverlib/driverlib.h>
void main(void)
{
uint32_t i;
uint16_t * wdt = (uint16_t*)0x4000480c; /*pointer to watchdog timer */
uint8_t * p1_out = (uint8_t*)0x40004c02; /*pointer to port 1 output register */
uint8_t * p1_dir = (uint8_t*)0x40004c04; /*pointer to port 1 direction register */
{
uint32_t i;
uint16_t * wdt = (uint16_t*)0x4000480c; /*pointer to watchdog timer */
uint8_t * p1_out = (uint8_t*)0x40004c02; /*pointer to port 1 output register */
uint8_t * p1_dir = (uint8_t*)0x40004c04; /*pointer to port 1 direction register */
*wdt = 0x5a80; /*WDT pswd | stop WDT*/
*p1_dir |= 0x01; /*define pin0 of port 1 as an output*/
*p1_dir |= 0x01; /*define pin0 of port 1 as an output*/
while(1)
{
*p1_out ^= 0x01; /* toggle pin 0 of port 1*/
{
*p1_out ^= 0x01; /* toggle pin 0 of port 1*/
for(i = 100000; i > 0; i--); /* delay */
}
}
}
}