This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Repeated pin toggling is not executing

I am trying to write my own FLASH programmer on a Cypress USB 8051 chip that will program a SiLabs 8051 using their C2 Interface. I have written a macro that simply sets a pin low in the first statement and high in the second statement (to create the strobe signal that I connect to the SiLabs C2 clock input line). When I run the debugger on this code, this pin transition only occurs one times and then all other pin strobes are seemingly ignored or optimized out. I have the compiler set to Optimization 0 but these pin operations are still ignored. Has anyone run into this problem? The macro I set up looks like:

#define  Strobe_C2CK       C2CK = LOW; C2CK = HIGH

and I have also tried:

#define  Strobe_C2CK       C2CK = (volatile)LOW;
                          C2CK = (volatile)HIGH

and the C2CK value is defined as:

#define  C2CK           PB0

Finally, the code that uses the above macros is:

void C2_Write_Address(uint8 address)
{
   uint8 i;

   // First send the start field for the ADDRESS Write command
   Strobe_C2CK;

   // Send the instruction field (0b11, LSB first) for the command
   C2D = HIGH;
   C2D_Driver_On;
   Strobe_C2CK;
   C2D = HIGH;
   Strobe_C2CK;

   // Send the address field one single bit at a time
   for ( i = 0; i < 8; i++ )
   {
      C2D = ( address & 0x01 );
      Strobe_C2CK;
      address >>= 1;
   }

   // Send the stop field for the command and disable the C2 driver pin
   C2D_Driver_Off;
   Strobe_C2CK;

}  // End of function

Thank you for the help.

-Thomas