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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/02/12 09:40
Read: 1311 times


 
#188212 - Does 0xFF refer to HIGH? Simple blink program
This is the code to blink a LED.
When I debug it in KEIL, Port 0 keeps switching between 0xFF(255) and 0xFE(254)
1) Does this mean the equivalent of 1 is 0xFF?
2) Does 0xFF mean the port is currently HIGH?

#include <reg52.h>

sbit LED_pin = P0^0;

bit LED_state_G;

void LED_FLASH_Init(void);
void LED_FLASH_Change_State(void);
void DELAY_LOOP_Wait(int);

void main(void)
{
LED_FLASH_Init();
while(1)
{

LED_FLASH_Change_State();

DELAY_LOOP_Wait(1000);
}
}

void LED_FLASH_Init(void)
{
LED_state_G = 0;
}

void LED_FLASH_Change_State(void)
{

if (LED_state_G == 1)
{
LED_state_G = 0;
LED_pin = 0;
}
else
{
LED_state_G = 1;
LED_pin = 1;
}
}
void DELAY_LOOP_Wait(int DELAY)
{
unsigned int x, y;
for (x = 0; x <= DELAY; x++)
{
for (y = 0; y <= 120; y++);
}
}


List of 4 messages in thread
TopicAuthorDate
Does 0xFF refer to HIGH? Simple blink program      Sai Siddharth      09/02/12 09:40      
   Now ... I haven't examined your code ...       Richard Erlacher      09/02/12 12:45      
      Right back to real basics!      Andy Neil      09/02/12 16:07      
   You are nearly there       Jim Granville      09/02/12 16:12      

Back to Subject List