??? 09/02/12 15:40 Read: 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++); } } |
Topic | Author | Date |
Does 0xFF refer to HIGH? Simple blink program | 01/01/70 00:00 | |
Now ... I haven't examined your code ... | 01/01/70 00:00 | |
Right back to real basics! | 01/01/70 00:00 | |
You are nearly there | 01/01/70 00:00 |